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

SAX and Locator

  • To: xml-dev@l...
  • Subject: SAX and Locator
  • From: Jonathan Baxter <jbaxter@p...>
  • Date: Tue, 23 Jul 2002 12:30:32 +0930
  • Organization: Panscient
  • Reply-to: jbaxter@p...
  • User-agent: KMail/1.4.1

locator sax
I am new to XML so if this is a dumb question, please don't be too 
hard on me. 

Background: 
=========
I am using SAX to parse HTML that has been "tidied" (I am using JTidy 
and also experimenting with NekoHTML). 

I need to know exactly where in the original document certain SAX 
events originate, so I am using the Locator mechanism.

Question:
=======
Locator measures the origin of SAX events by line number and column 
number. Apart from the hassle of having to keep track of line numbers 
in the original document as the parse progresses, it is "lossy" to 
communicate event locations just by line number and column number, 
since events are generally the result of processing a range of 
characters in the original document. 

Would it be possible to have Locator return the starting character 
offset and the ending character offset of the sequence of characters 
that generated the SAX event? For example, after a tag is processed, 
within the corresponding startElement(...) callback a call to 
Locator.getStartCharacter() would return the location of the "<" at 
the start of the tag and a call to Locator.getEndCharacter() would 
return the location  of the ">" at the end. The location would simply 
be the index of the characters within the original stream.

Thanks,

Jonathan Baxter


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.