|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] SAX and Locator
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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








