Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to find an XML's element-attribute given a line number?

Status
Not open for further replies.

mkuan

Programmer
Sep 19, 2001
69
0
0
CA
I've validated my XML file with a schema, and I know which lines (through the implementations of IVBSAXContentHandler, IVBSAXErrorHandler, and IVBSAXLocator interfaces) are not conforming to the schema.

Is there a way to use the line number and attract the element-attribute value pairs that're giving me the errors?

For example,

99 ...
100 <person>
101 <surname>blah</surname>
102 <firstname>blahblah</firstname>
103 <age>x</age>
104 </person>
105 ...

Does the DOM object has any facility that can help me to figure out it's the "age" attribute of "person" element with "blah" surname that's giving me the problem?

Thanks.

mink


 
I don't think so -- You'll probably need to load your document into a text or XML editor to find the line number.

Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
Thanks Chip for your prompt reply.

I wonder if there's any object that does it? :( Getting desperate....
 
It's because XML in it's most basic form doesn't care about line breaks. It's happiest if the document is all on one line (because CR & LF combos just bulk up the file unnecessarily).

Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top