Hi,

I'm using Xerces-J 2.11.0 (XML Schema 1.1) Beta and may have run into a 
possible issue with the library:

I have an XML file with the following:


<Product_Collection
    xmlns="http://pds.nasa.gov/pds4/pds/v1";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xmlns:mvn="http://pds.nasa.gov/pds4/mission/mvn/v1";
    xsi:schemaLocation="
    http://pds.nasa.gov/pds4/pds/v1
    http://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1400.xsd

    http://pds.nasa.gov/pds4/mission/mvn/v1
    http://pds.nasa.gov/pds4/mvn/v1/PDS4_MVN_1011.xsd
    ">

…


        <Mission_Area>
            <MAVEN xmlns="http://pds.nasa.gov/pds4/mvn/v1";>
                <mission_phase_name>Transition</mission_phase_name>
                <mission_phase_name>Prime Mission</mission_phase_name>
            </MAVEN>
        </Mission_Area>


…


The XML file references a schema, PDS4_MVN_1011.xsd, with the following content:


  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
    targetNamespace="http://pds.nasa.gov/pds4/mvn/v1";
    xmlns:mvn="http://pds.nasa.gov/pds4/mvn/v1";
    xmlns:pds="http://pds.nasa.gov/pds4/pds/v1";
    elementFormDefault="qualified"
    attributeFormDefault="unqualified"
    version="1.0.1.1">


...

  <xs:element name="MAVEN" type="mvn:MAVEN"> </xs:element>



The first test I ran, I wanted to validate the XML file against the schemas 
declared in its label. So, I set up the Schema object as follows:


    schemaFactory = 
SchemaFactory.newInstance("http://www.w3.org/XML/XMLSchema/v1.1";);

    Schema schema = schemaFactory.newSchema();


I got an expected error when validating the XML file:


      ERROR  line 65, 60: cvc-complex-type.2.4.c: The matching wildcard is 
strict, but no declaration can be found for element 'MAVEN'.


Note that the target namespace value in the XSD,


http://pds.nasa.gov/pds4/mvn/v1


is different from the target namespace in the SchemaLocation of the XML:


http://pds.nasa.gov/pds4/mission/mvn/v1



For the second test, I simply downloaded the schemas listed in the XML file and 
explicitly passed them into the SchemaFactory to create a Schema object:


    schemaFactory = 
SchemaFactory.newInstance("http://www.w3.org/XML/XMLSchema/v1.1";);

    Schema schema = schemaFactory.newSchema(schemaSources);


Then, when I validated the XML file again, I got no errors.


I would have expected the 2nd test to produce an error just like the first.


I wanted to know if anyone on this list has thoughts on this.


Thanks,

Mike




Reply via email to