Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: xerces/SAX xml search

From: Joe Kesselman <keshlam-nospam@-------.--->
To: NULL
Date: 5/1/2007 9:25:00 PM

foolproofplan@g... wrote:
> I am currently working on coding something in c++ which allows me to
> find locations (line/column) of certain elements and attributes within
> an xml file.

OK, looking at this another time... You're almost certainly looking at 
building your own SAX-based search, since you said you want line/column 
information and most of the other APIs don't deliver that. (SAX may not 
either, but you can at least try the SAXLocator API.)

Of course if you take that approach, it's entirely up to you to code the 
logic that turns your search (however you want to express it) into a 
state machine that can be driven by SAX events, or that runs over 
whatever data structure you build from the SAX events to record the 
document structure plus locator information (an annotated DOM, perhaps, 
that adds location information... or some custom data structure tuned 
for your own application's needs). Simple searches may not need much 
stored state information; really complex ones may require the whole 
document tree be available.

You've given us no indication of what kinds of searches you want to 
perform, so generalities are all I can give you. You may be talking 
about anything from a trivial subset of XPath to full XPath to full 
XQuery to something more complicated than that. Obviously, simpler is 
easier to implement.

Personal reaction: Line/column is usually a Bad Thing to use in the XML 
world, because documents with identical semantics may not have the same 
detailed syntax, and indeed tools don't always have that information 
available to them. Expressing a point in the document as a simple XPath 
to that location is often a better alternative.


-- 
() ASCII Ribbon Campaign  | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent