Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - xerces/SAX xml search >Thread Next - Re: xerces/SAX xml search Re: xerces/SAX xml searchTo: 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 | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
