Solved

How to get the file position of a IXMLDOMNode ?

Posted on 2003-11-25
3
822 Views
Last Modified: 2011-10-03
After loading a xml file, I get a IXMLDOMNode from a Xpath with the method selectSingleNode.
How to get the corresponding file position in the XML file, and also its line number & character number ?

JPG
0
Comment
Question by:JP_Goblet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
sparkplug earned 250 total points
ID: 9818722
The XML DOM doesn't store the file position. There is a filepos property but this only applies to parsing errors. Depending on why you need to know the file position, I guess the best solution, other then reading the XML file character by character, would be to use SAX http://msdn.microsoft.com/library/en-us/xmlsdk/htm/sax_devgd_overview_0jef.asp. The ISAXLocator interface http://msdn.microsoft.com/library/en-us/xmlsdk/htm/sax_isaxlocator_7kx1.asp provides both columnNumber and LineNumber properties.

>S'Plug<
0
 
LVL 9

Expert Comment

by:sparkplug
ID: 9819181
http://www.experts-exchange.com/help.jsp#hi73

Why the grade C? Did this not answer your question? If you needed more information you should say so. I now have a grade C against my name just for taking the time to answer your question. Thanks.

>S'Plug<
0
 

Author Comment

by:JP_Goblet
ID: 9823136
sorry i'm not familiar with experts exchange conventions, i did not think that giving a C grade was almost like a blame...
I gave a C grade because your answer did not really learn anything to me; i knew about SAX but it seems to me a very complicated solution. But perhaps there is no other way.
If there is a way i can modify the grade, let me know.

JPG
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question