[jdom-interest] XML Schema problem
Brett McLaughlin
brett at newInstance.com
Wed Aug 22 08:02:20 PDT 2001
> I have defined the following schema, test.xsd:
>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <xsd:element name="test" type="xsd:string"/>
> </xsd:schema>
>
> I have also defined the following xml file, test.xml:
>
> <?xml version="1.0"?>
> <test
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.w3.org/2001/XMLSchema test.xsd"/>
This last attribute isn't right. The value for schemaLocation should be
1. The namespace being constrained
2. The file for that namespace
So you want something like:
<test
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xmlns=http://default.namespace.com
xsi:schemaLocation=http://default.namespace.com test.xsd />
That will locate the schema for the default namespace (which the element
"test" is in), and should work.
---
Brett McLaughlin
Enhydra Strategist http://www.enhydra.org
Lutris Technologies http://www.lutris.com
O'Reilly Author http://www.oreilly.com/catalog/javaxml2
More information about the jdom-interest
mailing list