Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Nope!

In Rule 59 the S? is defined by:

White Space [3] S ::= (#x20 | #x9 | #xD | #xA)+

So (  toto  |  tata  ) is just as valid as (  toto  | tata  ). The problem is that expat and XML::Parser report _everything_ in the document, including non-significant spaces. Now Expat is required by the spec to do so. XML::Parser could probably choose to normalize those whitespaces but does not, and XML::DOM definitely should normalize them but does not. The SAX-2 extension for declaration for example normalizes declarations by removing all spaces around tokens.

The bottom-line is that this is a feature of XML::DOM that could easily pass for a bug (and should be fixed as soon as somebody provides a patch, I certainly don't want to get involved in XML::DOM but line 1970 of the DOM.pm in libxml-enno-1.04pre3 seems like the place to insert the normalization for attribute declarations, then on to element content models before line 2343).

As a side note, the best way to read the XML specification is probably to go to The Annotated XML Specification for the spec and Tim Bray's comments on xml.com

Update: Crap! My mistake (as usual :--(, XML::DOM (or maybe XML::Parser) does normalize attribute declarations. Actually that's why the test fails. It is fixed in libxml-enno-1.04pre though. The only remaining problem is that 1.04 does not pass the test on 5.6.0


In reply to Re: Re: Weirdness (and bugfix for) XML::DOM ... by mirod
in thread Weirdness (and bugfix for) XML::DOM ... by deprecated

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2024-04-16 23:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found