logo       

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

mozilla.devel.xml

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



Axel Hecht wrote:
none wrote:

Extracted from the specs:

2.10 White Space Handling


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.

I do not want to enter into religious war. Section 2.10 clearly states
"In editing XML documents, it is often convenient to use "white space" ..."

Look, in C++ grammar, or Java grammar for example any program should
begin with comments or declarations.
But the white space handling in both specs lets you put whites.

I do not know which MS/Sun/whatsover developper launched the fashion of rejecting white spaces at the beginning of XML documents, but clearly it is a way to make some brand reject other implementations.

Then, if you want to stuck to 2.8 ( and play with words ):
-----------------------------------------------------------------
2.8 Prolog and Document Type Declaration

[Definition: XML documents SHOULD begin with an XML declaration which specifies the version of XML being used.] For example, the following is a complete XML document, well-formed but not valid:

<?xml version="1.0"?>
<greeting>Hello, world!</greeting>

and so is this:

<greeting>Hello, world!</greeting>

------------------------------------------------
RFC 2119:
3. SHOULD This word, or the adjective "RECOMMENDED", mean that there
may exist valid reasons in particular circumstances to ignore a
particular item, but the full implications must be understood and
carefully weighed before choosing a different course.
-------------------------------------------------------------


So if you want to promote "mozilla-XML" versus "non-mozilla-XML"
you should not accept whites before the <?xml..

( the capitals are copy-pasted from rfc )
Olivier



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