Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Re: (YA) Perl XML parser

by belg4mit (Prior)
on May 07, 2002 at 06:50 UTC ( [id://164549]=note: print w/replies, xml ) Need Help??


in reply to Re: (YA) Perl XML parser
in thread (YA) Perl XML-like parser

Did you run the code? Did you read the comments? It handles nested tags, you mean a tag nested within itself, they are parsed but a level is lost. PI won't be supported. I shall endeavor to handle > in the attributes and CDATA.

I did not see XML::SAX::PurePerl in my search earlier, oh well.

The XML spec is far from the easiest thing to read. I appreciate the insight, and am filling in most of the gaps but this is going to be like perl52perl6, 100%, 80% of the time. It wasn't even the original intent. It started as just an RSS parser but seemed to handle generic XML and so It thought I'd share it. Other things to keep in mind are; I did in fact say it was lax, this is snippets not craft.

--
perl -pew "s/\b;([mnst])/'$1/g"

Replies are listed 'Best First'.
Re: Re: Re: (YA) Perl XML parser
by mirod (Canon) on May 07, 2002 at 09:28 UTC

    If I spent time debugging all the pseudo-xml parsers I come accross I would not have much time left for real work. That said you are right, your thing handles nested tags just fine. It does not handle mixed content though.

    The problem is not which specific feature your code does or does not handle, it is that you have no idea what portion of the XML spec it covers. As you said the XML spec is complex and hard to read. It includes a grammar though, and that's how you should tackle writing a parser: extract the grammar (Ways to Rome will give you 11 ways to do this) and work from there. Do not pretend that code that parses "stuff with pointy brackets" is an XML parser.

    There have been numerous discussions about this on this forum (parse the "Other Users XML Ticker" with index and substr being a recent one, On XML parsing giving you a bunch of features that make parsing difficult). It boils down to "do what you want at home, but please don't spread improper code".

    Now if you had worked on XML::RSS to get it to work with XML::SAX::PurePerl, now you would have written something useful for you (minimal dependance for an RSS parser) and for the rest of the World.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://164549]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-19 17:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found