logo       

Re: making mozilla's xml to behave in a non-standard way: msg#00017

mozilla.devel.xml

Subject: Re: making mozilla's xml to behave in a non-standard way

none wrote:
Extracted from the specs:

2.10 White Space Handling

In editing XML documents, it is often convenient to use "white space" (spaces, tabs, and blank lines) to set apart the markup for greater readability. Such white space is typically not intended for inclusion in the delivered version of the document. On the other hand, "significant" white space that should be preserved in the delivered version is common, for example in poetry and source code.

An XML processor MUST always pass all characters in a document that are
-----------------------------------------------------------------------
not markup through to the application
-------------------------------------

looks clear

Yes. And if you have whitespace before the <?xml..., then the character data as whole doesn't match the document production, and is thus not a document. So the quote above comes long time after the initial whitespace problem.

Axel

Axel Hecht wrote:

none wrote:



Marco Milanesi wrote:

hi, this is a strange question I know, but I hope to get some responses:

I have a web application that I can't modify. it outputs an xml to
the browser with newlines and spaces at the beginning of the xml.

now the question. How can I modify this behaviour of mozilla? how can it
be more tolerant to this malformed xml?


It is not malformed. It is legal to put whites characters before the <?xml .. tag
It's mozilla which needs fixing, as many other buggy xml parsers.


Actually, could you quote the spec? Or tell me how I quote wrong?

From XML 1.0 3rd edition:


http://www.w3.org/TR/2004/REC-xml-20040204/#sec-well-formed

[Definition: A textual object is a well-formed XML document if:]
1. Taken as a whole, it matches the production labeled document.
...

http://www.w3.org/TR/2004/REC-xml-20040204/#NT-document

[1] document ::= prolog element Misc*

http://www.w3.org/TR/2004/REC-xml-20040204/#NT-prolog

[22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)?
[23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'

As you can see, there is no whitespace in front of the XMLDecl.

Axel




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise