Dear Gordon,

I hope what I say here is correct (not my field of expertise but I
thought I knew this one).

> successfully opened file c:\projects\schemaProc\flat\C
> SIParty.xsd
> [Warning] :-1:-1: SchemaLocation: schemaLocation value =
> 'file:///c:/projects/ schemaProc/flat/CSICommon.xsd
> file:///c:/projects/schemaProc/flat/CSIParty.xsd
> file:///c:/projects/schemaProc/flat/Custom.xsd
> file:///c:/projects/schemaProc/flat/Party.xsd
> file:///c:/projects/schemaProc/flat/CSICustom.xsd
> file:///c:/projects/schemaProc/flat/Common.xsd
> file:///c:/projects/schemaProc/flat/PaymentMethod.xsd' must 
> have even number
> of URI's.
> 
> This leads me to think that the external-schemaLocation is 
> expecting pairs
> of values (perhaps namemspace, schema location pairs), although it is
> documented as expecting just a list of schema location URI's.

The namespaces is a good guess, and that is how I read it being
documented at
        http://xml.apache.org/xerces2-j/properties.html
('same as schemaLocation attribute in *instance documents*').

> 1.    What am I doing wrong with my setProperty call?

I think the error is that you are using setProperty while all you want
to do is have Xerces find the imported files.

> 2.    What is the best way to tell Xerces where to find schema files
> referenced in an import statement?
> 3.    If the import statement specifies a relative file path, 
> is there any
> way to tell Xerces where the root of the file path is? 

The problem is that you load the schema based on
         XMLInputSource is = new
 org.apache.xerces.xni.parser.XMLInputSource(null,null,null,(Reader)r,
null);
So you only specify a Reader, which is basically a stream of characters.
So Xerces has no idea where to find schema's that are imported relative
to any file, because there is no reference to the file. So you can
remove the setProperty, and simply tell Xerces where to find related
files by making that part of the inputsource, e.g.
         XMLInputSource is = new
 org.apache.xerces.xni.parser.XMLInputSource(
        null,
        "file:///c:/projects/schemaProc/flat/thisfile.xsd",
        "file:///c:/projects/schemaProc/flat/",
        (Reader)r,
        null);

(untested, but this should give you the idea).

> Here is one of the import statements from the schema that I 
> am trying to
> parse:
> 
>         <xs:import namespace="http://www.companyX.com/csi/csicommon";
> schemaLocation="./CSICommon"/>

Ah, or maybe this won't work at all. Any reason why you do not specify
the file location as "./CSICommon.xsd" in your schema?
If you have schema-locations in your schema file which do not point to
actual existing file-names, you should specify an entity resolver which
maps CSICommon to an inputstream of the file CSICommon.xsd.

Kind regards,

--Sander.

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

Reply via email to