<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2873" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi, </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>I am trying to validate a xml against schema.<BR>I
have successfully validated the xml against the schema in XMLSpy. <BR>But when i
am trying to validate it in my java code using JDOM, it is giving me the
following error: </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>"org.jdom.input.JDOMParseException: Error on line
1: cvc-elt.1: Cannot find the declaration of element 'Mensagem'." </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>I am using the following code: </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> SAXBuilder sb = new
SAXBuilder("org.apache.xerces.parsers.SAXParser");<BR>
sb.setValidation(true);<BR> sb.setFeature("<A
href="http://apache.org/xml/features/validation/schema">http://apache.org/xml/features/validation/schema</A>",
true);<BR> sb.setProperty("<A
href="http://apache.org/xml/properties/schema/external-schemaLocation">http://apache.org/xml/properties/schema/external-schemaLocation</A>",
"<A
href="http://localhost:8988/gofer/gofer.xsd">http://localhost:8988/gofer/gofer.xsd</A>");</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>
this.setDocumentoXML( sb.build( new StringReader(valorParam) ) ); </FONT></DIV>
<DIV> </DIV><FONT face=Arial size=2>
<DIV><BR>gofer.xsd (Root Element): <BR>================= <BR><xs:schema
xmlns:xs="<A
href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<BR> <xs:element name="Mensagem"></DIV>
<DIV> </DIV>
<DIV>xml String (Root Element) <BR>================= <BR><?xml version="1.0"
encoding="ISO-8859-1" ?><BR> <Mensagem xmlns:xsi="<A
href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</A>"
xsi:noNamespaceSchemaLocation="<A
href="http://localhost:8988/gofer/gofer.xsd">http://localhost:8988/gofer/gofer.xsd</A>"
<BR>
identificador="L00196b6272223b453ed9844a8815ac7f2f9"></DIV>
<DIV> </DIV>
<DIV><BR>I am wondering if I am doing anything wrong. </DIV>
<DIV> </DIV>
<DIV>Thanks </DIV>
<DIV> </DIV>
<DIV>Marcio Nielsen Baptista. <BR></FONT></DIV></BODY></HTML>