[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: [ Revised ] 15 elementary truths about XML

  • From: Andrew Welch <andrew.j.welch@gmail.com>
  • To: "Costello, Roger L." <costello@mitre.org>
  • Date: Tue, 1 Nov 2011 15:29:19 +0000

Re:  [ 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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.