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 "Mukul Gandhi (Jira)" <xe...@xml.apache.org> on 2019/09/19 06:35:00 UTC

[jira] [Commented] (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:comment-tabpanel&focusedCommentId=16933098#comment-16933098 ] 

Mukul Gandhi commented on XERCESJ-1674:
---------------------------------------

Apologies for a delayed response.

I agree that, this looks like a bug (present in version 2.12.0 as well). We'll try to fix it.

> 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
>            Priority: Major
>
> 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|title=example_instance.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|title=example_schema.xsd}
> <?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. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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