File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Log only the wrong datas from where it ocuured to the end using XSD Validations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Log only the wrong datas from where it ocuured to the end using XSD Validations" Watch "Log only the wrong datas from where it ocuured to the end using XSD Validations" New topic
Author

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

prathibha, ar
Greenhorn

Joined: Jun 22, 2001
Posts: 13
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

Joined: Mar 17, 2000
Posts: 5782
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.


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
 
 
subject: Log only the wrong datas from where it ocuured to the end using XSD Validations
 
Similar Threads
Need help in Validations
Manipulating XML Documents
Editable XML-PDF
Need Help on Remote Host Screen Capture
Log4j Viewer