Hi John,

<[EMAIL PROTECTED]> wrote on 08/15/2007 12:44:31 PM:

> Hi Michael,
> 
> Thank you for pointing out the "load-external-dtd" feature.  That did
> the trick at least for my original problem with the DOCTYPE handling.
> 
> I tried as you suggested by setting:
> 
> spf.setNamespaceAware(true); // the default is false, but I think you're
> setting it to true
> spf.setValidating(false);
> 
> Actually, I was setting setNamespaceAware to true before, but I had been
> setting setValidating incorrectly.
> 
> Now I'm still catching this error:
> 
> cvc-elt.1: Cannot find the declaration of element 'shiporder'
> 
> If I change my schema definition from:
> 
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
>   xmlns="http://www.ncbi.nlm.nih.gov";
>   targetNamespace="http://www.ncbi.nlm.nih.gov";
>   elementFormDefault="qualified"
>   attributeFormDefault="unqualified">
> 
> And remove the targetNamespace:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
>   xmlns="http://www.ncbi.nlm.nih.gov";
>   elementFormDefault="qualified"
>   attributeFormDefault="unqualified">
> 
> Then the parse succeeds.
> 
> Is there something in my code that can handle the targetNamespace?

As I said before, you need to either add a namespace declaration to the 
instance document or remove the target namespace from the schema document. 
If you don't want to edit the sources directly, you can do this 
programmatically with a SAX filter, DOM, XSLT, etc...

> My XML document does not have any namespace qualification.  I also tried 
to
> set elementFormDefault to "unqualified" in the schema definition but
> that didn't do anything.

The element declaration for "shipOrder" in your schema is global. 
elementFormDefault only affects local element declarations, in other words 
those which are declared within complex type definitions. 

> Thanks,
> John

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to