  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | JSP - A mailing list about Java Server Pages specification and reference | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | Validate XML with XSD Schema with DOMBuilder | Validate XML with XSD Schema with DOMBuilder 2007-05-28 - By kerod@(protected)
Back Hi,
I have a big problem with DOMBuilder. I want to parse an XML document and validate it with a XML Schema but with DOMBuilder it can't do it. Why ? Here my code :
public int validXMLWithDOM(File xmlFile) { try { DOMParser dom = new DOMParser(); //Instanciation d'un ?l?ment DOM DOMBuilder jdomParser = new DOMBuilder("org.apache.xerces.parsers .DOMParser"); //Instanciation d'un ?l?ment JDOM //Parse le document afin de r?cup?rer un arbre DOM dom.setFeature("http://xml.org/sax/features/validation", true); dom.parse("Durand.xml"); org.w3c.dom.Document docDom = dom.getDocument(); //R?cup?ration de notre arbre JDOM org.jdom.Element jdomDoc = jdomParser.build(docDom .getDocumentElement()); } catch(DOMParseException e) { e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } return 0; }
Where is the problem ? How Can I get the error with DOMParseException ?
Thanks <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content=text/html;charset=iso-8859 (See http://iso-8859.ora-code.com)-1> <STYLE></STYLE>
<META content="MSHTML 6.00.2900.3086" name=GENERATOR></HEAD> <BODY id=MailContainerBody style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; FONT-SIZE: 10pt; COLOR: #000080 ; PADDING-TOP: 15px; FONT-FAMILY: Palatino Linotype" bgColor=#ffffff leftMargin=0 topMargin=0 CanvasTabStop="true" acc_role="text" name="Compose message area"> <DIV>Hi,</DIV> <DIV> </DIV> <DIV>I have a big problem with DOMBuilder. I want to parse an XML document and validate it with a XML Schema but with DOMBuilder it can't do it. Why ?</DIV> <DIV>Here my code : </DIV> <DIV> </DIV> <DIV>public int validXMLWithDOM(File xmlFile) <BR> {<BR> try<BR> {<BR> DOMParser dom = new DOMParser(); //Instanciation d'un ?l?ment DOM<BR> DOMBuilder jdomParser = new DOMBuilder("org.apache.xerces.parsers.DOMParser"); //Instanciation d'un ?l?ment JDOM<BR> <BR> //Parse le document afin de r?cup?rer un arbre DOM<BR> dom.setFeature("<A title=http://xml.org/sax/features/validation href="http://xml.org/sax/features/validation">http://xml.org/sax/features /validation</A>", true);<BR> dom.parse("Durand.xml"); <BR> <BR> org.w3c.dom.Document docDom = dom.getDocument();<BR> //R?cup?ration de notre arbre JDOM<BR> org.jdom.Element jdomDoc = jdomParser.build(docDom.getDocumentElement());<BR>   ; <BR> }<BR> catch(DOMParseException e)<BR> {<BR> e.printStackTrace();<BR> }<BR> catch(Exception e)<BR> {<BR> e.printStackTrace();<BR> }<BR> <BR> return 0; <BR> }</DIV> <DIV> </DIV> <DIV>Where is the problem ? How Can I get the error with DOMParseException ?</DIV> <DIV> </DIV> <DIV>Thanks</DIV></BODY></HTML>
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ To control your jdom-interest membership: http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
|
|
 |