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 "Arthur Ryman (JIRA)" <xe...@xml.apache.org> on 2005/09/29 19:47:47 UTC

[jira] Created: (XERCESJ-1100) Error when refers to a schema inlined in another XML document

Error when <import> refers to a schema inlined in another XML document
----------------------------------------------------------------------

         Key: XERCESJ-1100
         URL: http://issues.apache.org/jira/browse/XERCESJ-1100
     Project: Xerces2-J
        Type: Bug
    Versions: 2.7.1    
 Environment: Any JDK
    Reporter: Arthur Ryman


The XSD spec states that the schemaLocation attribute of the <import> element MAY point to a <schema> element that is contained in another XML document. However, Xerces reports an error when the root element is not a <schema> element. It should examine the full URL, including the fragment identifier to identify the part of the document being refered to. This problem occurs in practice in WSDL documents where <schema> may be inlined inside the WSDL <types> element, both in WSDL 1.1 and WSDL 2.0. For example, we need imports like this to work where the other schema is refered to via an id:

			<xs:import
				namespace="http://greath.example.com/2004/schemas/reservationItems"
				schemaLocation="#items" />


We are attempting to make the Apache Woden WSDL validator fully spec compliant and need the support in Xerces. Here is an example WSDL 2.0 document:
(available at the W3C CVS resository http://dev.w3.org/cvsweb/~checkout~/2002/ws/desc/test-suite/documents/good/SchemaId-1G/schemaIds.wsdl)

<?xml version="1.0" encoding="utf-8" ?>
<description xmlns="http://www.w3.org/2005/05/wsdl"
	targetNamespace="http://greath.example.com/2004/services/retrieveDetails"
	xmlns:tns="http://greath.example.com/2004/services/retrieveDetails"
	xmlns:wdetails="http://greath.example.com/2004/schemas/reservationDetails"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.w3.org/2005/05/wsdl ../../../xmlcatalog/wsdl/wsdl20.xsd http://www.w3.org/2001/XMLSchema ../../../xmlcatalog/xsd/XMLSchema.xsd">

	<documentation>
		This document describes the GreatH Retrieve Reservation Details
		Web service.
	</documentation>

	<types>

		<xs:schema id="items"
			targetNamespace="http://greath.example.com/2004/schemas/reservationItems">

			<xs:element name="confirmationNumber" type="xs:string" />
			<xs:element name="checkInDate" type="xs:date" />
			<xs:element name="checkOutDate" type="xs:date" />
			<xs:element name="roomType" type="xs:string" />
			<xs:element name="smoking" type="xs:boolean" />

		</xs:schema>

		<xs:schema id="details"
			targetNamespace="http://greath.example.com/2004/schemas/reservationDetails"
			xmlns:items="http://greath.example.com/2004/schemas/reservationItems">

			<xs:import
				namespace="http://greath.example.com/2004/schemas/reservationItems"
				schemaLocation="#items" />

			<xs:element name="reservationDetails">
				<xs:complexType>
					<xs:sequence>
						<xs:element ref="items:confirmationNumber" />
						<xs:element ref="items:checkInDate" />
						<xs:element ref="items:checkOutDate" />
						<xs:element ref="items:roomType" />
						<xs:element ref="items:smoking" />
					</xs:sequence>
				</xs:complexType>
			</xs:element>
		</xs:schema>

	</types>

	<interface name="retrieveDetailsInterface">

		<operation name="retrieve"
			pattern="http://www.w3.org/2004/03/wsdl/in-out">
			<input messageLabel="In" element="#none" />
			<output messageLabel="Out"
				element="wdetails:reservationDetails" />
		</operation>

	</interface>

</description>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Resolved: (XERCESJ-1100) Error when refers to a schema inlined in another XML document

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XERCESJ-1100?page=all ]
     
Michael Glavassevich resolved XERCESJ-1100:
-------------------------------------------

    Resolution: Won't Fix

Marking this issue resolved since it's already possible to process inline schemas using JAXP 1.3 and XNI.

> Error when <import> refers to a schema inlined in another XML document
> ----------------------------------------------------------------------
>
>          Key: XERCESJ-1100
>          URL: http://issues.apache.org/jira/browse/XERCESJ-1100
>      Project: Xerces2-J
>         Type: Bug
>     Versions: 2.7.1
>  Environment: Any JDK
>     Reporter: Arthur Ryman

>
> The XSD spec states that the schemaLocation attribute of the <import> element MAY point to a <schema> element that is contained in another XML document. However, Xerces reports an error when the root element is not a <schema> element. It should examine the full URL, including the fragment identifier to identify the part of the document being refered to. This problem occurs in practice in WSDL documents where <schema> may be inlined inside the WSDL <types> element, both in WSDL 1.1 and WSDL 2.0. For example, we need imports like this to work where the other schema is refered to via an id:
> 			<xs:import
> 				namespace="http://greath.example.com/2004/schemas/reservationItems"
> 				schemaLocation="#items" />
> We are attempting to make the Apache Woden WSDL validator fully spec compliant and need the support in Xerces. Here is an example WSDL 2.0 document:
> (available at the W3C CVS resository http://dev.w3.org/cvsweb/~checkout~/2002/ws/desc/test-suite/documents/good/SchemaId-1G/schemaIds.wsdl)
> <?xml version="1.0" encoding="utf-8" ?>
> <description xmlns="http://www.w3.org/2005/05/wsdl"
> 	targetNamespace="http://greath.example.com/2004/services/retrieveDetails"
> 	xmlns:tns="http://greath.example.com/2004/services/retrieveDetails"
> 	xmlns:wdetails="http://greath.example.com/2004/schemas/reservationDetails"
> 	xmlns:xs="http://www.w3.org/2001/XMLSchema"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xsi:schemaLocation="http://www.w3.org/2005/05/wsdl ../../../xmlcatalog/wsdl/wsdl20.xsd http://www.w3.org/2001/XMLSchema ../../../xmlcatalog/xsd/XMLSchema.xsd">
> 	<documentation>
> 		This document describes the GreatH Retrieve Reservation Details
> 		Web service.
> 	</documentation>
> 	<types>
> 		<xs:schema id="items"
> 			targetNamespace="http://greath.example.com/2004/schemas/reservationItems">
> 			<xs:element name="confirmationNumber" type="xs:string" />
> 			<xs:element name="checkInDate" type="xs:date" />
> 			<xs:element name="checkOutDate" type="xs:date" />
> 			<xs:element name="roomType" type="xs:string" />
> 			<xs:element name="smoking" type="xs:boolean" />
> 		</xs:schema>
> 		<xs:schema id="details"
> 			targetNamespace="http://greath.example.com/2004/schemas/reservationDetails"
> 			xmlns:items="http://greath.example.com/2004/schemas/reservationItems">
> 			<xs:import
> 				namespace="http://greath.example.com/2004/schemas/reservationItems"
> 				schemaLocation="#items" />
> 			<xs:element name="reservationDetails">
> 				<xs:complexType>
> 					<xs:sequence>
> 						<xs:element ref="items:confirmationNumber" />
> 						<xs:element ref="items:checkInDate" />
> 						<xs:element ref="items:checkOutDate" />
> 						<xs:element ref="items:roomType" />
> 						<xs:element ref="items:smoking" />
> 					</xs:sequence>
> 				</xs:complexType>
> 			</xs:element>
> 		</xs:schema>
> 	</types>
> 	<interface name="retrieveDetailsInterface">
> 		<operation name="retrieve"
> 			pattern="http://www.w3.org/2004/03/wsdl/in-out">
> 			<input messageLabel="In" element="#none" />
> 			<output messageLabel="Out"
> 				element="wdetails:reservationDetails" />
> 		</operation>
> 	</interface>
> </description>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (XERCESJ-1100) Error when refers to a schema inlined in another XML document

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
    [ http://issues.apache.org/jira/browse/XERCESJ-1100?page=comments#action_12330866 ] 

Michael Glavassevich commented on XERCESJ-1100:
-----------------------------------------------

With the current release you should already be able to get the support you're looking for by using JAXP 1.3 and an XNI entity resolver.  I fixed a bug [1] in this area recently so you'll probably want to grab the latest build from CVS [2].

There's a sample that is included with the parser called jaxp.InlineSchemaValidator [3] which demonstrates how inline schemas can be loaded from a DOM using JAXP 1.3 and also shows how to validate document fragments using those inlined schemas.  The only thing not shown in the sample is how you can use an entity resolver to resolve schemaLocations which point somewhere within the same document (or at an inlined schema in another document).  Unfortunately this isn't possible using JAXP alone since the standard entity resolvers return system identifiers/streams.  With an XNI entity resolver [4] registered on the schema loader you can return an inlined schema wrapped in a DOMInputSource [5]. This last part isn't documented anywhere.  I was planning to write an FAQ; I just haven't found the time yet.

[1] http://marc.theaimsgroup.com/?l=xerces-cvs&m=112614280305060&w=2
[2] http://vmgump.apache.org/gump/public-jars/xml-xerces2/jars/
[3] http://xml.apache.org/xerces2-j/samples-jaxp.html#InlineSchemaValidator
[4] http://xml.apache.org/xerces2-j/javadocs/xni/org/apache/xerces/xni/parser/XMLEntityResolver.html
[5] http://xml.apache.org/xerces2-j/javadocs/xerces2/org/apache/xerces/util/DOMInputSource.html

> Error when <import> refers to a schema inlined in another XML document
> ----------------------------------------------------------------------
>
>          Key: XERCESJ-1100
>          URL: http://issues.apache.org/jira/browse/XERCESJ-1100
>      Project: Xerces2-J
>         Type: Bug
>     Versions: 2.7.1
>  Environment: Any JDK
>     Reporter: Arthur Ryman

>
> The XSD spec states that the schemaLocation attribute of the <import> element MAY point to a <schema> element that is contained in another XML document. However, Xerces reports an error when the root element is not a <schema> element. It should examine the full URL, including the fragment identifier to identify the part of the document being refered to. This problem occurs in practice in WSDL documents where <schema> may be inlined inside the WSDL <types> element, both in WSDL 1.1 and WSDL 2.0. For example, we need imports like this to work where the other schema is refered to via an id:
> 			<xs:import
> 				namespace="http://greath.example.com/2004/schemas/reservationItems"
> 				schemaLocation="#items" />
> We are attempting to make the Apache Woden WSDL validator fully spec compliant and need the support in Xerces. Here is an example WSDL 2.0 document:
> (available at the W3C CVS resository http://dev.w3.org/cvsweb/~checkout~/2002/ws/desc/test-suite/documents/good/SchemaId-1G/schemaIds.wsdl)
> <?xml version="1.0" encoding="utf-8" ?>
> <description xmlns="http://www.w3.org/2005/05/wsdl"
> 	targetNamespace="http://greath.example.com/2004/services/retrieveDetails"
> 	xmlns:tns="http://greath.example.com/2004/services/retrieveDetails"
> 	xmlns:wdetails="http://greath.example.com/2004/schemas/reservationDetails"
> 	xmlns:xs="http://www.w3.org/2001/XMLSchema"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xsi:schemaLocation="http://www.w3.org/2005/05/wsdl ../../../xmlcatalog/wsdl/wsdl20.xsd http://www.w3.org/2001/XMLSchema ../../../xmlcatalog/xsd/XMLSchema.xsd">
> 	<documentation>
> 		This document describes the GreatH Retrieve Reservation Details
> 		Web service.
> 	</documentation>
> 	<types>
> 		<xs:schema id="items"
> 			targetNamespace="http://greath.example.com/2004/schemas/reservationItems">
> 			<xs:element name="confirmationNumber" type="xs:string" />
> 			<xs:element name="checkInDate" type="xs:date" />
> 			<xs:element name="checkOutDate" type="xs:date" />
> 			<xs:element name="roomType" type="xs:string" />
> 			<xs:element name="smoking" type="xs:boolean" />
> 		</xs:schema>
> 		<xs:schema id="details"
> 			targetNamespace="http://greath.example.com/2004/schemas/reservationDetails"
> 			xmlns:items="http://greath.example.com/2004/schemas/reservationItems">
> 			<xs:import
> 				namespace="http://greath.example.com/2004/schemas/reservationItems"
> 				schemaLocation="#items" />
> 			<xs:element name="reservationDetails">
> 				<xs:complexType>
> 					<xs:sequence>
> 						<xs:element ref="items:confirmationNumber" />
> 						<xs:element ref="items:checkInDate" />
> 						<xs:element ref="items:checkOutDate" />
> 						<xs:element ref="items:roomType" />
> 						<xs:element ref="items:smoking" />
> 					</xs:sequence>
> 				</xs:complexType>
> 			</xs:element>
> 		</xs:schema>
> 	</types>
> 	<interface name="retrieveDetailsInterface">
> 		<operation name="retrieve"
> 			pattern="http://www.w3.org/2004/03/wsdl/in-out">
> 			<input messageLabel="In" element="#none" />
> 			<output messageLabel="Out"
> 				element="wdetails:reservationDetails" />
> 		</operation>
> 	</interface>
> </description>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (XERCESJ-1100) Error when refers to a schema inlined in another XML document

Posted by "Arthur Ryman (JIRA)" <xe...@xml.apache.org>.
    [ http://issues.apache.org/jira/browse/XERCESJ-1100?page=comments#action_12330874 ] 

Arthur Ryman commented on XERCESJ-1100:
---------------------------------------

Michael,

Thx. We'll try that.

> Error when <import> refers to a schema inlined in another XML document
> ----------------------------------------------------------------------
>
>          Key: XERCESJ-1100
>          URL: http://issues.apache.org/jira/browse/XERCESJ-1100
>      Project: Xerces2-J
>         Type: Bug
>     Versions: 2.7.1
>  Environment: Any JDK
>     Reporter: Arthur Ryman

>
> The XSD spec states that the schemaLocation attribute of the <import> element MAY point to a <schema> element that is contained in another XML document. However, Xerces reports an error when the root element is not a <schema> element. It should examine the full URL, including the fragment identifier to identify the part of the document being refered to. This problem occurs in practice in WSDL documents where <schema> may be inlined inside the WSDL <types> element, both in WSDL 1.1 and WSDL 2.0. For example, we need imports like this to work where the other schema is refered to via an id:
> 			<xs:import
> 				namespace="http://greath.example.com/2004/schemas/reservationItems"
> 				schemaLocation="#items" />
> We are attempting to make the Apache Woden WSDL validator fully spec compliant and need the support in Xerces. Here is an example WSDL 2.0 document:
> (available at the W3C CVS resository http://dev.w3.org/cvsweb/~checkout~/2002/ws/desc/test-suite/documents/good/SchemaId-1G/schemaIds.wsdl)
> <?xml version="1.0" encoding="utf-8" ?>
> <description xmlns="http://www.w3.org/2005/05/wsdl"
> 	targetNamespace="http://greath.example.com/2004/services/retrieveDetails"
> 	xmlns:tns="http://greath.example.com/2004/services/retrieveDetails"
> 	xmlns:wdetails="http://greath.example.com/2004/schemas/reservationDetails"
> 	xmlns:xs="http://www.w3.org/2001/XMLSchema"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xsi:schemaLocation="http://www.w3.org/2005/05/wsdl ../../../xmlcatalog/wsdl/wsdl20.xsd http://www.w3.org/2001/XMLSchema ../../../xmlcatalog/xsd/XMLSchema.xsd">
> 	<documentation>
> 		This document describes the GreatH Retrieve Reservation Details
> 		Web service.
> 	</documentation>
> 	<types>
> 		<xs:schema id="items"
> 			targetNamespace="http://greath.example.com/2004/schemas/reservationItems">
> 			<xs:element name="confirmationNumber" type="xs:string" />
> 			<xs:element name="checkInDate" type="xs:date" />
> 			<xs:element name="checkOutDate" type="xs:date" />
> 			<xs:element name="roomType" type="xs:string" />
> 			<xs:element name="smoking" type="xs:boolean" />
> 		</xs:schema>
> 		<xs:schema id="details"
> 			targetNamespace="http://greath.example.com/2004/schemas/reservationDetails"
> 			xmlns:items="http://greath.example.com/2004/schemas/reservationItems">
> 			<xs:import
> 				namespace="http://greath.example.com/2004/schemas/reservationItems"
> 				schemaLocation="#items" />
> 			<xs:element name="reservationDetails">
> 				<xs:complexType>
> 					<xs:sequence>
> 						<xs:element ref="items:confirmationNumber" />
> 						<xs:element ref="items:checkInDate" />
> 						<xs:element ref="items:checkOutDate" />
> 						<xs:element ref="items:roomType" />
> 						<xs:element ref="items:smoking" />
> 					</xs:sequence>
> 				</xs:complexType>
> 			</xs:element>
> 		</xs:schema>
> 	</types>
> 	<interface name="retrieveDetailsInterface">
> 		<operation name="retrieve"
> 			pattern="http://www.w3.org/2004/03/wsdl/in-out">
> 			<input messageLabel="In" element="#none" />
> 			<output messageLabel="Out"
> 				element="wdetails:reservationDetails" />
> 		</operation>
> 	</interface>
> </description>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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