Coker, Jonathan M wrote:
Thanks to everyone who has replied. I worked with the SimpleXPathAPI example and determined that my fudamental problem was not wrapping my input with single quotes. Once I did that, the sample started doing what I expected. Now here is what I would really like to do: My XML file has many more entries in each section and some entries could be several (4+) levels deep. Once I parse the document, I want to be able to do things like get all the player nodes that have swords with an active value of '1'. Or, I may simply want to get the name of a player with a given ID. I am using code from 'C++ Cookbook' as my starting point. See Attached. The main difference I see is that I am creating my document using the XercesDOMParser. If I need to rethink my approach, please let me know.
The code you attached is a trivial program that converts a tab character to 3 spaces, so I can't comment on your code.
However, unless you have some need for a DOM instance that you can modify, I would suggest you stick with using Xalan-C's standard source tree.
If you find you are doing lots of searches for attribute values, you might want to consider writing a DTD that declares those attributes as type ID, so you can use the XPath id() function to find nodes more efficiently.
Dave