XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] [ Revised ] 15 elementary truths about XML

> Are you saying that an XML processors builds on top of another piece of software (which converts bytes to characters)?

I'm pretty sure sure the xml parser will parse a character stream
which it gets from either the layer below (offloading the conversion
to the host language) or the layer above (getting a string from the
application).  (if I'm wrong we'll soon find out :)

For example, in Java land the parse() method of the XMLReader takes an
'InputSource' which can be either a byte stream or a character stream.

You need to use a character stream if the lexical xml you want to
parse is either a) already in character form or b) you need to convert
the byte stream yourself using some external encoding information (xml
over http).  Either way, the application above provides the xml parser
with a character stream, not bytes.

If you provide the xml parser with a byte stream (or a system id (a
file path)) then xml parser will determine the encoding itself and
then pass the byte stream and the encoding to the host language method
to get the characters.  It is a bit of grey area here, because to
determine the correct encoding to use it would need to parse the few
bytes itself as ascii looking for the prolog, but as far as I know,
that's the only time it will do that.

Aren't parsers all token based anyway?  Nothing works at the byte
level.  (again, hoping to be corrected or confirmed there)

> Perhaps I should use the word "file" rather than "document"? For example:  The contents of an XML file is a sequence of zeros and ones called bits.

I would say 'xml is a tree of nodes' rather than 'xml is a sequence of bytes'.



-- 
Andrew Welch
http://andrewjwelch.com


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS