<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.0.5762.3">
<TITLE>validation problem</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">Hi,</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">New jdom user here. I try to validate some XML against a schema...</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">SAXBuilder sb = new SAXBuilder(true);</FONT>
<BR><FONT SIZE=2 FACE="Arial">Document d = sb.build(new java.net.URL("<A HREF="file://C:/Test/src/test.xml">file://C:/Test/src/test.xml</A>"));</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">throws exception about "Element 'response' used but not declared". The same two files validate just fine in XMLSpy IDE. Can someone help me?</FONT></P>
<P><FONT SIZE=2 FACE="Arial">PS, when I add a child element (without namespace) using Element.addContent(Element), it automatically inserts xmlns="" into the child element when the parent namespace is not empty. Why is that happening?</FONT></P>
<P><FONT SIZE=2 FACE="Arial">Thank you!</FONT>
</P>
<BR>
<P><FONT SIZE=2 FACE="Arial">Here's test.xml:</FONT>
<BR><FONT SIZE=2 FACE="Arial">====</FONT>
<BR><FONT COLOR="#008080" SIZE=2 FACE="Arial"><?xml version="1.0" encoding="UTF-8"?></FONT>
<BR><FONT COLOR="#0000FF" SIZE=2 FACE="Arial"><</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">response</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> xmlns</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial"><A HREF="http://my.com">http://my.com</A></FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> xmlns:xsi</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial"><A HREF="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</A></FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> xsi:schemaLocation</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial"><A HREF="http://my.com">http://my.com</A></FONT>
<BR><FONT COLOR="#000000" SIZE=2 FACE="Arial">C:\Test\src\test.xsd</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"><</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">stuff</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">></FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">String</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial"></</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">stuff</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">></FONT>
<BR><FONT COLOR="#0000FF" SIZE=2 FACE="Arial"></</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">response</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">></FONT>
<BR><FONT SIZE=2 FACE="Arial">====</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">test.xsd:</FONT>
<BR><FONT SIZE=2 FACE="Arial">====</FONT>
<BR><FONT COLOR="#008080" SIZE=2 FACE="Arial"><?xml version="1.0" encoding="UTF-8"?></FONT>
<BR><FONT COLOR="#0000FF" SIZE=2 FACE="Arial"><</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:schema</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> targetNamespace</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial"><A HREF="http://my.com">http://my.com</A></FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> xmlns</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial"><A HREF="http://my.com">http://my.com</A></FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> xmlns:xsd</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial"><A HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A></FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> elementFormDefault</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">qualified</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> attributeFormDefault</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">unqualified</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"></FONT></P>
<P> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"><</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:complexType</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> name</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">error_TYPE</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"><</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:sequence</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"><</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:element</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> name</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">error_code</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> type</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">xsd:string</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"/></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"><</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:element</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> name</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">error_detail</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> type</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">xsd:string</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"/></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"><</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:element</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> name</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">error_level</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> type</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">xsd:unsignedShort</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> minOccurs</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">0</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"/></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"></</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:sequence</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"><</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:attribute</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> name</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">id</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> type</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">xsd:unsignedLong</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> use</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">required</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"/></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"></</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:complexType</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"><</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:element</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> name</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">response</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"><</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:complexType</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"><</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:choice</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"><</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:element</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> name</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">stuff</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> type</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">xsd:string</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"/></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"><</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:element</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> name</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">error</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> type</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">error_TYPE</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> maxOccurs</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">unbounded</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"/></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"></</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:choice</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"><</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:attribute</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> name</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">mode</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> use</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">optional</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"><</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:simpleType</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"><</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:restriction</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> base</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">xsd:string</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"><</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:enumeration</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> value</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">PROD</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"/></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"><</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:enumeration</FONT><FONT COLOR="#FF0000" SIZE=2 FACE="Arial"> value</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">="</FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">DEMO</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">"/></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"></</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:restriction</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"></</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:simpleType</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"></</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:attribute</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"></</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:complexType</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">></FONT>
<BR> <FONT COLOR="#0000FF" SIZE=2 FACE="Arial"></</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:element</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">></FONT>
<BR><FONT COLOR="#0000FF" SIZE=2 FACE="Arial"></</FONT><FONT COLOR="#800000" SIZE=2 FACE="Arial">xsd:schema</FONT><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">></FONT>
<BR><FONT SIZE=2 FACE="Arial">====</FONT>
</P>
</BODY>
</HTML>