Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Log only the wrong datas from where it ocuured to the end using XSD Validations

 
prathibha, ar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all!
iam creating an xml file by reading a simple text file which contains member details like name,address and some payment details.
Using schema validations iam validating this xml file with some 10 rules.
suppose if the parser throws some error while checking the rules
iam writing the errors in to the errorlog.txt file.
Is it is possible to get the data's from the xml file only from the point at which the error occured.Becuase I want to log into the errorlog.txt file only the datas from which the error occured
to the end of the file.
If possible Can I know how it is possible.
It is required uregently.
Thanks and Regards
prathibha

 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am assuming, you always validate the "current node". If you're using a SAX parser, you can get the reference to the current element using the Locator. It also has several useful methods such as getLineNumber(), getColumnNumber() etc. The only drawback withusing a SAX parser is that you cannot "look back" or "peek ahead" of the current element, if you need for example, to get the handle to the parent node of the current element. Many sample examples that come with either Xerces or JAXP download contain typical locator usage.
If you are using a DOM parser, you can get the current Node. This will be the current context that you are interested in. DOM has the ultimate flexibility in navigating the document hierarchy and so you don't have to confront the limited visibility problems.
Does that answer your question?
------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic