I've been charged with updating old schemas for various files that have
never actually been validated against each other. I've got the schema
itself in good form at this point - I'm positive that they're pretty
clean. My only remaining problem is namespaces.
The XML files, which I can't modify, use no namespaces at all. They
contain elements from as many as four different files. Example:
"CargoList" in CargoList.xsd contains a sequence of "Cargo" elements
which are defined in Cargo.xsd, which uses simple types (things like
certain ID number formats etc.) defined in xyzcorptypes.xsd
As they are now, the schemas use namespaces, but most of them are
broken in weird ways.
What I'd like to do is abolish namespaces in these schemas. This would
make things a lot easier for me, I'm sure. There are no collisions
among all the different schemas, so I'm not worried about that. Is it
possible to make everything "global"?
Here's a sample problem I'm having, but I don't know if it's related to
the namespaces:
I have a schema like so:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.xyzcorp.com/CargoLi st"
xmlns="http://www.xyzcorp.com/CargoLi st"
xmlns:xs="http://www.w3.org/2001/XMLSche ma"
xmlns:crg="http://www.xyzcorp.com/Cargo"xmlns:cdm="http://www.xyzcorp.com/xyzcorptypes">
<xs:import
namespace="http://www.xyzcorp.com/xyzcorptypes"schemaLocation="xyzcorptypes.xsd"/>
<xs:import
namespace="http://www.xyzcorp.com/Cargo"schemaLocation="Cargo.xsd"/>
<xs:element name="CargoList">
.............Complex Type etc. etc...........
And an xml file like so:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<CargoList IDNumber="788723">
<Cargo............. attributes etc.............
I get the following error when I run it through my Java SAX validator:
"Cannot find the declaration of element 'CargoList'." on the second
line of the xml file.
Any help/tips/links are appreciated.
Thanks!
-Tyson