Hello,

I can't seem to get my parser (neither SAX nor DOM) to validate/parse my
source xml file when I use any namespace defined in the schema tag of my
.xsd file.  For example, take the following snippet of this xml file:

<?xml version="1.0"?>
<PurchaseOrder>
....
</PurchaseOrder>

And now the following snippet of an xsd without a namespace:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
elementFormDefault="qualified">
...
</xsd:schema>

In this situation I can validate/parser just fine.  However, when I put a
namespace into the xsd file (which I need for my WSDL file), I run into
problems.  Here is the same schema file with a namespace:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
elementFormDefault="qualified"
targetNamespace="http://production.psg.company.com/types";
xmlns="http://production.psg.company.com/types";>
...
</xsd:schema>

In this case, the parser throws the following error:
"Cannot find the declaration of element 'PurchaseOrder'"

Because the xml comes from outside sources, it is necessary that the source
xml be devoid of any namespace and schema information to alieviate the
possibilty of errors.  Our application should supply that information - not
the outside sources.

So, I've done the follwing to try to set the namespace in the code with
statements such as:

parser.setProperty("http://apache.org/xml/properties/schema/external-schemaL
ocation",
                "http://production.psg.company.com/types " + schemaName);

I've tried every permutation for the .xsd file, and have been looking high
and low for an example of an xml and xsd file that replicates my situtaion,
as well as for source code, but I can't seem to find anything.  Arrg!

Any help you have to point me in the right direction would be great.

Thank you,
Matt




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

Reply via email to