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

Accurate line and column numbers for elements and attributes in Java

  • From: "Klotz, Leigh" <Leigh.Klotz@x...>
  • To: <xml-dev@l...>
  • Date: Fri, 6 Jun 2008 09:10:08 -0700

Accurate line and column numbers for elements and attributes in Java
I'm developing an XML representation for a templating system which can
report errors at both parse and at execution time.

The existing system does a good job of reporting input file line numbers
on its element- and attribute-like constructs, and I'd like to provide
that same functionality with the XML representation.

Most SAX2 implementations (including the default one with recent Sun
Java systems) offer start and end line numbers of tags, but provide only
the ending column number of element content.

While I'm able to make use of this information, the most critical need
for column numbers comes in attribute values, so that errors in
attribute-value template expressions can be reported with column numbers
accurate in the original input stream.  SAX2 is no help here, as the
attributes spring forth fully formed as if from Zeus's forehead.

I've taken a look at Piccolo, which has a commented-out set of column
number info (on elements only), and at Micahel Kay's suggestion of using
the Saxon AugmentedSource (
http://www.nabble.com/-xml-dev--Line-number-of-a-node-to7990605.html#a79
90605 ) but again this provides only line numbers, not column numbers,
and not for attributes.

Does anyone have experience or recommendations for a non-validating,
namespace-aware XML parser in Java which supports or can easily be made
to support accurate beginning line and column numbers of both elements
and attributes (and maybe text)?  The solution needs to be released
under a BSD license.

Thank you,
Leigh.


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