Solved

How to get the file position of a IXMLDOMNode ?

Posted on 2003-11-25
3
757 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
  • 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Xsl Nested Loop 4 21
XSLT question to add element to a particular xpath... 13 28
Create XML 5 33
ASP.NET reading ATOM 2 26
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now