Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Determining if there are errors in an XML document, programatically.
Determining if there are errors in an XML document, programatically. [message #173525] Fri, 07 July 2006 18:04 Go to next message
Brian Jakubik is currently offline Brian JakubikFriend
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 Go to previous message
Lawrence Mandel is currently offline Lawrence MandelFriend
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
Previous Topic:How to get details of this error message
Next Topic:Newbie migrating from sysdeo tomcat plugin.
Goto Forum:
  


Current Time: Tue Dec 23 00:21:53 GMT 2014

Powered by FUDForum. Page generated in 0.02597 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software