[jdom-interest] Validation using XML Schemas

Miguel Angel Medina migue at paisvirtual.net
Wed Jan 17 01:33:22 PST 2001


Hello:
    I'm using JDOM beta 5 and I want to validate a XML document using a schema. I have followed some examples that should work right but I have a JDOM Exception. I don't now if the problem is from JDOM or from my XML files (.xml and .xsd). Here is my XML files, I thank if someone can tell me what problem or send some files that work right.

 -- XML
<?xml version="1.0" encoding="US-ASCII"?>
<persona xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="schemaPrueba.xsd">
<nombre>Miguel</nombre>      
<apellidos>Medina</apellidos>      
</persona>

-- Schema
<?xml version="1.0" encoding="US-ASCII"?>

<xsd:schema xmlns:xsd="http://www.w3.org/1999/XMLSchema">

 <xsd:ElementType name="nombre" content="textOnly"/>
 <xsd:ElementType name="apellidos" content="textOnly"/>

 <xsd:ElementType name="persona" content="eltOnly">
   <xsd:element type="nombre" minOccurs="1" maxOccurs="1"/>
   <xsd:element type="apellidos" minOccurs="0" maxOccurs="1"/>
 </xsd:ElementType>
</xsd:schema>

and the Exception:
Excepcion: org.jdom.JDOMException: Attribute "xmlns:xsi" must be declared for element type "persona".: Error on line 3 of document file:/pais/invitados/miguela/xml_java/jdom/Prueba.xml: Attribute "xmlns:xsi" must be declared for element type "persona".

Thank You. Miguel Angel.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20010117/2c7cd7e6/attachment.htm


More information about the jdom-interest mailing list