[jdom-interest] XML Schema problem

Eric e.macaulay at cs.ucl.ac.uk
Wed Aug 22 08:32:42 PDT 2001


Hi,

I tried your suggestion. My xml file is now:

<?xml version="1.0"?>
<test
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://default.namespace.com test.xsd"/>

But I'm still getting the same exception. Any ideas?

Eric M.



Brett McLaughlin wrote:
>>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
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
> 
> 






More information about the jdom-interest mailing list