MSXML

Started by
4 comments, last by Hoser 19 years, 6 months ago
I've been looking at using the MSXML SDK, but I couldn't figure out if it could do what I would like it to do. Basically, after parsing the XML file, I would like to know the file position where some of the tags start. Anyone know of an easy way to go about doing this with MSXML? Thanks!
Advertisement
Physical file positions is one of the things XML is supposed to hide from you. So if you really need to know it then there's a good chance it was the wrong choice of format to begin with.
Do you mean that you want to obtain a list of tags under another tag or do you mean that you want to know that <mytag> is actually at position 1573 in the file?
Yeah, you won't get, nor should you want, that type of info from MSXML's parser. You set up callbacks that are triggered on certain events such as start of document, end of document, start of element, end of element, etc. You then get some data to go along with the event, such as the element name, attributes, and such.
"When you die, if you get a choice between going to regular heaven or pie heaven, choose pie heaven. It might be a trick, but if it's not, mmmmmmm, boy."
How to Ask Questions the Smart Way.
I wrote a scanner that builds a DOM out of an XML document, where it entirely uses the source text for storage of the tags (it uses base + length rather than zero termination). Thus, if you read the entire file, and then pass it to the scanner, it would implicitly give you that information (you just take the tag string and sutract the file start). It wasn't that hard to write, but it doesn't support all fancy features of XML. Wicked fast, though :-)
enum Bool { True, False, FileNotFound };
I'm writting a somewhat specialized application, and I'm not really using an XML based file system/application. It is just that the MSXML library does a lot of the things I need, and hence my question.

It won' t take too long to whip up what I need, I was just trying to save myself a bit of time if possible.

Thanks for the comments.

This topic is closed to new replies.

Advertisement