Determining if there are errors in an XML document, programatically. [message #173525] |
Fri, 07 July 2006 18:04 |
Brian Jakubik Messages: 140 Registered: July 2009 |
Senior Member |
|
|
This has come up again, and Im trying to figure out a way if thre is a way
to see is an xml document is valid, and has no errors.
Somone suggested to see if there are any problem markers, this would work,
but might not be ideal, but how do i get a list of markers for the editor.
Also, is there a way to ask the validator directly if the active doc is
valid, and/or can a listener be added to do something when it becomes valid.
If so, can you point me in the right direction.
Thanks
Brian
|
|
|
Re: Determining if there are errors in an XML document, programatically. [message #174159 is a reply to message #173525] |
Wed, 12 July 2006 17:53 |
Lawrence Mandel Messages: 486 Registered: July 2009 |
Senior Member |
|
|
Hi Brian,
>Somone suggested to see if there are any problem markers, this would
work,
>but might not be ideal, but how do i get a list of markers for the
editor.
You would request the list of markers for an IFile or IResource, not for
an editor. Take a look at [1].
>Also, is there a way to ask the validator directly if the active doc is
>valid, and/or can a listener be added to do something when it becomes
valid.
>If so, can you point me in the right direction.
No on the listener. Yes on the validator with the caveat that you need to
then run validation yourself and inspect the report.
NOTE: THE FOLLOWING IS NOT API AND IS LIKELY TO BREAK IN THE FUTURE.
[2] contains a link to the Eclipse XML validator (the XML validator with
any Eclipse extension such as URI resolution and error customization) in
WTP 1.5. You can use this validator to validate an XML file and get a
report containing any errors or warnings.
[1]
http://help.eclipse.org/help30/index.jsp?topic=/org.eclipse. platform.doc.isv/reference/api/org/eclipse/core/resources/IR esource.html
[2]
http://dev.eclipse.org/viewcvs/index.cgi/wst/components/xml/ plugins/org.eclipse.wst.xml.core/src-validation/org/eclipse/ wst/xml/core/internal/validation/eclipse/XMLValidator.java?r ev=1.2&cvsroot=WebTools_Project&content-type=text/vn d.viewcvs-markup
Lawrence
|
|
|
Powered by
FUDForum. Page generated in 0.03204 seconds