Jump to content
  • Advertisement
Sign in to follow this  
Hoser

MSXML

This topic is 5454 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 :-)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!