Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Namespaces in Envelope + Payload -setup

From: "Antti Sissonen" <antti_sissonen@-------.--->
To: xmlschema-dev@--.---
Date: 2/7/2007 12:43:00 PM

I stumbled into some discrepancies in validation when defining the quite 
usual setup having a message inside an envelope. I created two versions of 
the combined xml message where the namespace declarations are a bit 
different from each other. Spy with external Xerces 2.6.2 validates the 
both, but another setup using Apache parser does not accept the first 
option. How to interpret this and which of the alternatives is closer to the 
'truth'?

Here a simplified example of the situation:

-Envelope -schema:

<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:envelope="http://www.company.com/schemas/eai/envelope"
targetNamespace="http://www.company.com/schemas/eai/envelope"
elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:element name="Envelope" type="envelope:EnvelopeType">
	</xs:element>
	<xs:complexType name="EnvelopeType">
		<xs:sequence>
			<xs:element ref="envelope:Type"/>
			<xs:element name="PayloadEnvelope" type="xs:anyType"/>
		</xs:sequence>
	</xs:complexType>
	<xs:element name="Type"/>
</xs:schema>

-Payload (i.e. Message) -schema:

<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.company.com/schemas/eai/payload"
targetNamespace="http://www.company.com/schemas/eai/payload"
elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:element name="Payload" type="PayloadType">
	</xs:element>
	<xs:complexType name="PayloadType">
		<xs:sequence>
			<xs:element name="MsgID"/>
			<xs:element name="MsgDate"/>
		</xs:sequence>
	</xs:complexType>
</xs:schema>

..Generated xml combo of the two:

<envelope:Envelope
xmlns:envelope="http://www.company.com/schemas/eai/envelope"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.company.com/schemas/eai/envelope 
TestEnvelope.xsd">
	<envelope:Type>Message</envelope:Type>
	<envelope:PayloadEnvelope>
	<Payload xmlns="http://www.company.com/schemas/eai/payload" 
xsi:schemaLocation="http://www.company.com/schemas/eai/payload
TestPayload.xsd">
	<MsgID>1221</MsgID>
	<MsgDate>2007</MsgDate>
</Payload>
	</envelope:PayloadEnvelope>
</envelope:Envelope>

..And an alternative version:

<envelope:Envelope
xmlns:envelope="http://www.company.com/schemas/eai/envelope"
xmlns="http://www.company.com/schemas/eai/payload"
xmlns:payload="http://www.company.com/schemas/eai/payload"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.company.com/schemas/eai/envelope 
TestEnvelope.xsd">
	<envelope:Type>Message</envelope:Type>
	<envelope:PayloadEnvelope>
	<Payload xsi:schemaLocation="http://www.company.com/schemas/eai/payload
TestPayload.xsd">
	<MsgID>1221</MsgID>
	<MsgDate>2007</MsgDate>
</Payload>
	</envelope:PayloadEnvelope>
</envelope:Envelope>

So basically the default namespace declaration in Payload is moved to 
Envelope root and payload: -namespace is declared to be the same as the 
default namespace. How is this different in practice?

_________________________________________

Antti Sissonen [Antti_Sissonen@h...]

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


From mike@s... Wed Feb 07 09:20:48 2007
Received: from maggie.w3.org ([193.51.208.68])
	by frink.w3.org with esmtp (Exim 4


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent