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

Re: How to handle "newline" characters in an XML parser.

  • From: Liam Quin <liam@w...>
  • To: Redefined Horizons <redefined.horizons@g...>
  • Date: Tue, 5 Dec 2006 14:41:02 -0500

xml parser ignore new line
On Tue, Dec 05, 2006 at 11:24:55AM -0800, Redefined Horizons wrote:
> I'm nearing the completion of an open source XML parser in Java. (It's
> an event-based, pull parser.)

why?  do we need more parsers? :-)

[...]
> I'm having some trouble figuring out how to handle "newline"
> characters in XML text files on different platforms. I typically
> ignore all whitespace in the parser, but I wanted to count newline
> characters to aid in errror reporting.

You can't ignore whitespace, you have to return it to the application,
except when it's explicitly ignorable because a DTD says so, or when
it's e.g. inside a tag matching the S production.

> I've taken a look at the XML specs, but didn't completely understand
> what they had to say about newline characters.

Can you ask a more specific question?  Are you asking when normalization
happens?  By newline do you mean the character at Unicode code point 10?

Remember that the spaces inside the desc element in:
    <desc>his socks were <em>very</em> <pattern>argyle</pattern>.</desc>
are all important, including the one between </em> and <pattern>.

For error reporting, line counting depends on the platform, and
should probably correspond to using a native text editor on that
platform -- as that's what users will have to use when they
get an error.

Liam

-- 
Liam Quin, W3C XML Activity Lead, http://www.w3.org/People/Quin/
http://www.holoweb.net/~liam/ * http://www.fromoldbooks.org/


[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.