You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Patrick Gratz (JIRA)" <xe...@xml.apache.org> on 2016/10/05 10:12:20 UTC

[jira] [Updated] (XERCESJ-1674) Namespace issue with xs:assert within xs:override

     [ https://issues.apache.org/jira/browse/XERCESJ-1674?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Gratz updated XERCESJ-1674:
-----------------------------------
    Description: 
When using xs:assert within an xs:override Xerces seems to have problems with resolving namespaces that are not defined in the base schema. Consequently, the following instance doesn't validate against the given schema because the mets prefix seems to be unknown.:

{code:xml}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<mets xmlns="http://www.loc.gov/METS/" xmlns:xlink="http://www.w3.org/1999/xlink" TYPE="delete" cellar-mets:version="3.0"
	PROFILE="http://publications.europa.eu/mdr/mets/cellar-mets-3_profile.xml"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cellar-mets="http://publications.europa.eu/cellar-mets-extensions"
	xsi:schemaLocation="http://www.loc.gov/METS/ http://www.loc.gov/standards/mets/version111/mets.xsd">
	<metsHdr CREATEDATE="2016-08-22T10:30:01.540+02:00">
		<metsDocumentID>celex_02009R1223-20150716_delete_item</metsDocumentID>
	</metsHdr>
	
	<structMap ID="structMap_1">
		<div TYPE="work" CONTENTIDS="celex:02009R1223-20150716">
			<div TYPE="expression" CONTENTIDS="celex:02009R1223-20150716.ENG">
				<div TYPE="manifestation" CONTENTIDS="celex:02009R1223-20150716.ENG.fmx4">
					<fptr CONTENTIDS="celex:02009R1223-20150716.ENG.fmx4.L_2009342EN.01020304.tif"/>
				</div>
			</div>
		</div>
	</structMap>
</mets>
{code}



{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" xmlns="http://www.loc.gov/METS/"
   xmlns:mets="http://www.loc.gov/METS/"
   xmlns:xlink="http://www.w3.org/1999/xlink" targetNamespace="http://www.loc.gov/METS/"
   elementFormDefault="qualified" attributeFormDefault="unqualified" vc:minVersion="1.1"
   version="3.0">
   <xs:import namespace="http://www.w3.org/1999/xlink"
      schemaLocation="http://www.loc.gov/standards/xlink/xlink.xsd"/>
   <xs:override schemaLocation="http://www.loc.gov/standards/mets/version111/mets.xsd">
     <xs:complexType name="structMapType">
         <xs:sequence>
            <xs:element name="div" type="divType">
               <xs:annotation>
                  <xs:documentation xml:lang="en"> The structural divisions of the hierarchical
                     organization provided by a &lt;structMap&gt; are represented by division
                     &lt;div&gt; elements, which can be nested to any depth. Each &lt;div&gt;
                     element can represent either an intellectual (logical) division or a physical
                     division. Every &lt;div&gt; node in the structural map hierarchy may be
                     connected (via subsidiary &lt;mptr&gt; or &lt;fptr&gt; elements) to content
                     files which represent that div's portion of the whole document.
                  </xs:documentation>
               </xs:annotation>
            </xs:element>
         </xs:sequence>
         <xs:attribute name="ID" type="xsd:ID" use="optional"/>
         <xs:attribute name="TYPE" type="xsd:string" use="optional"/>
         <xs:attribute name="LABEL" type="xsd:string" use="optional"/>   
         <xs:anyAttribute namespace="##other" processContents="lax"/>
         <xs:assert test="child::mets:div/@TYPE = ('work', 'dossier', 'agent', 'event')"
            xpathDefaultNamespace="##targetNamespace">
            <xs:annotation>
               <xs:documentation xml:lang="en">The root div within a structMap has to be either of
                  type 'work', 'dossier' or 'agent'.</xs:documentation>
               <xs:appinfo>
                  <metsSection>structMap</metsSection>
               </xs:appinfo>
            </xs:annotation>
         </xs:assert>
      </xs:complexType>
   </xs:override>
</xs:schema>
{code}

Replacing the mets prefix with a wildcard or adding it to the base schema will result in a successful validation. 



  was:
When using xs:assert within an xs:override Xerces seems to have problems with resolving namespaces that are not defined in the base schema. Consequently, the following instance doesn't validate against the given schema because the mets prefix seems to be unknown.:

{code:xml}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<mets xmlns="http://www.loc.gov/METS/" xmlns:xlink="http://www.w3.org/1999/xlink" TYPE="delete" cellar-mets:version="3.0"
	PROFILE="http://publications.europa.eu/mdr/mets/cellar-mets-3_profile.xml"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cellar-mets="http://publications.europa.eu/cellar-mets-extensions"
	xsi:schemaLocation="http://www.loc.gov/METS/ http://www.loc.gov/standards/mets/version111/mets.xsd">
	<metsHdr CREATEDATE="2016-08-22T10:30:01.540+02:00">
		<metsDocumentID>celex_02009R1223-20150716_delete_item</metsDocumentID>
	</metsHdr>
	
	<structMap ID="structMap_1">
		<div TYPE="work" CONTENTIDS="celex:02009R1223-20150716">
			<div TYPE="expression" CONTENTIDS="celex:02009R1223-20150716.ENG">
				<div TYPE="manifestation" CONTENTIDS="celex:02009R1223-20150716.ENG.fmx4">
					<fptr CONTENTIDS="celex:02009R1223-20150716.ENG.fmx4.L_2009342EN.01020304.tif"/>
				</div>
			</div>
		</div>
	</structMap>
</mets>
{code}



{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" xmlns="http://www.loc.gov/METS/"
   xmlns:mets="http://www.loc.gov/METS/"
   xmlns:xlink="http://www.w3.org/1999/xlink" targetNamespace="http://www.loc.gov/METS/"
   elementFormDefault="qualified" attributeFormDefault="unqualified" vc:minVersion="1.1"
   version="3.0">
   <xs:import namespace="http://www.w3.org/1999/xlink"
      schemaLocation="http://www.loc.gov/standards/xlink/xlink.xsd"/>
   <xs:override schemaLocation="http://www.loc.gov/standards/mets/version111/mets.xsd">
     <xs:complexType name="structMapType">
         <xs:sequence>
            <xs:element name="div" type="divType">
               <xs:annotation>
                  <xs:documentation xml:lang="en"> The structural divisions of the hierarchical
                     organization provided by a &lt;structMap&gt; are represented by division
                     &lt;div&gt; elements, which can be nested to any depth. Each &lt;div&gt;
                     element can represent either an intellectual (logical) division or a physical
                     division. Every &lt;div&gt; node in the structural map hierarchy may be
                     connected (via subsidiary &lt;mptr&gt; or &lt;fptr&gt; elements) to content
                     files which represent that div's portion of the whole document.
                  </xs:documentation>
               </xs:annotation>
            </xs:element>
         </xs:sequence>
         <xs:attribute name="ID" type="xsd:ID" use="optional"/>
         <xs:attribute name="TYPE" type="xsd:string" use="optional"/>
         <xs:attribute name="LABEL" type="xsd:string" use="optional"/>   
         <xs:anyAttribute namespace="##other" processContents="lax"/>
         <xs:assert test="child::mets:div/@TYPE = ('work', 'dossier', 'agent', 'event')"
            xpathDefaultNamespace="##targetNamespace">
            <xs:annotation>
               <xs:documentation xml:lang="en">The root div within a structMap has to be either of
                  type 'work', 'dossier' or 'agent'.</xs:documentation>
               <xs:appinfo>
                  <metsSection>structMap</metsSection>
               </xs:appinfo>
            </xs:annotation>
         </xs:assert>
      </xs:complexType>
   </xs:override>
</xs:schema>
{code}

Replacing the mets prefix with a wildcard or adding it to the base schema will cause a successful validation. 




> Namespace issue with xs:assert within xs:override
> -------------------------------------------------
>
>                 Key: XERCESJ-1674
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1674
>             Project: Xerces2-J
>          Issue Type: Bug
>    Affects Versions: 2.11.0
>            Reporter: Patrick Gratz
>
> When using xs:assert within an xs:override Xerces seems to have problems with resolving namespaces that are not defined in the base schema. Consequently, the following instance doesn't validate against the given schema because the mets prefix seems to be unknown.:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <mets xmlns="http://www.loc.gov/METS/" xmlns:xlink="http://www.w3.org/1999/xlink" TYPE="delete" cellar-mets:version="3.0"
> 	PROFILE="http://publications.europa.eu/mdr/mets/cellar-mets-3_profile.xml"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cellar-mets="http://publications.europa.eu/cellar-mets-extensions"
> 	xsi:schemaLocation="http://www.loc.gov/METS/ http://www.loc.gov/standards/mets/version111/mets.xsd">
> 	<metsHdr CREATEDATE="2016-08-22T10:30:01.540+02:00">
> 		<metsDocumentID>celex_02009R1223-20150716_delete_item</metsDocumentID>
> 	</metsHdr>
> 	
> 	<structMap ID="structMap_1">
> 		<div TYPE="work" CONTENTIDS="celex:02009R1223-20150716">
> 			<div TYPE="expression" CONTENTIDS="celex:02009R1223-20150716.ENG">
> 				<div TYPE="manifestation" CONTENTIDS="celex:02009R1223-20150716.ENG.fmx4">
> 					<fptr CONTENTIDS="celex:02009R1223-20150716.ENG.fmx4.L_2009342EN.01020304.tif"/>
> 				</div>
> 			</div>
> 		</div>
> 	</structMap>
> </mets>
> {code}
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>    xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" xmlns="http://www.loc.gov/METS/"
>    xmlns:mets="http://www.loc.gov/METS/"
>    xmlns:xlink="http://www.w3.org/1999/xlink" targetNamespace="http://www.loc.gov/METS/"
>    elementFormDefault="qualified" attributeFormDefault="unqualified" vc:minVersion="1.1"
>    version="3.0">
>    <xs:import namespace="http://www.w3.org/1999/xlink"
>       schemaLocation="http://www.loc.gov/standards/xlink/xlink.xsd"/>
>    <xs:override schemaLocation="http://www.loc.gov/standards/mets/version111/mets.xsd">
>      <xs:complexType name="structMapType">
>          <xs:sequence>
>             <xs:element name="div" type="divType">
>                <xs:annotation>
>                   <xs:documentation xml:lang="en"> The structural divisions of the hierarchical
>                      organization provided by a &lt;structMap&gt; are represented by division
>                      &lt;div&gt; elements, which can be nested to any depth. Each &lt;div&gt;
>                      element can represent either an intellectual (logical) division or a physical
>                      division. Every &lt;div&gt; node in the structural map hierarchy may be
>                      connected (via subsidiary &lt;mptr&gt; or &lt;fptr&gt; elements) to content
>                      files which represent that div's portion of the whole document.
>                   </xs:documentation>
>                </xs:annotation>
>             </xs:element>
>          </xs:sequence>
>          <xs:attribute name="ID" type="xsd:ID" use="optional"/>
>          <xs:attribute name="TYPE" type="xsd:string" use="optional"/>
>          <xs:attribute name="LABEL" type="xsd:string" use="optional"/>   
>          <xs:anyAttribute namespace="##other" processContents="lax"/>
>          <xs:assert test="child::mets:div/@TYPE = ('work', 'dossier', 'agent', 'event')"
>             xpathDefaultNamespace="##targetNamespace">
>             <xs:annotation>
>                <xs:documentation xml:lang="en">The root div within a structMap has to be either of
>                   type 'work', 'dossier' or 'agent'.</xs:documentation>
>                <xs:appinfo>
>                   <metsSection>structMap</metsSection>
>                </xs:appinfo>
>             </xs:annotation>
>          </xs:assert>
>       </xs:complexType>
>    </xs:override>
> </xs:schema>
> {code}
> Replacing the mets prefix with a wildcard or adding it to the base schema will result in a successful validation. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org