Hello everyone,
Just when I thought I was understanding the attributes of the document root element, I run into something that confuses me...
I've pruned down my schema and xml files in order to narrow down the validation problem and am getting the follwing errors from xerces 1.3.1
using "java sax.SAXCount -v acct.xml":
[Error] acct.xml:5:45: General Schema Error: Grammar with uri 2: http://test , can not found.
[Error] acct.xml:5:45: Element type "transaction" must be declared.
[Error] acct.xml:7:8: Element type "acct" must be declared.
[Error] acct.xml:8:15: Element type "First_Name" must be declared.
[Error] acct.xml:9:14: Element type "Last_Name" must be declared.
acct.xml: 130 ms (4 elems, 3 attrs, 0 spaces, 15 chars)
If I remove xmlns="http://test" from the xml document, the first error goes away, but the declaration errors still exist... It seems that the
validator is not even reading the schema, and my problem simply resizes in the header of my XML file.
According to section 5.6 (http://www.w3.org/TR/2001/PR-xmlschema-0-20010316/#schemaLocation>
of the schema primer, it looks like I'm doing the right thing.... So, what part of the big picture am I missing here?
Thanks,
-Pete
----------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<transaction
xmlns="http://test"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://test trans.xsd">
<acct>
<First_Name> </First_Name>
<Last_Name> </Last_Name>
</acct>
</transaction>
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://test"
targetNamespace="http://test">
<xsd:element name="transaction">
<xsd:complexType><xsd:sequence>
<xsd:element name="acct" minOccurs="0">
<xsd:complexType><xsd:sequence>
<xsd:element name="First_Name" type="xsd:string"/>
<xsd:element name="Last_Name" type="xsd:string"/>
</xsd:sequence></xsd:complexType>
</xsd:element>
</xsd:sequence></xsd:complexType>
</xsd:element>
</xsd:schema>
