- From: Antti Sissonen <antti_sissonen@hotmail.com>
- Date: Wed, 07 Feb 2007 10:43:28 +0200
- To: xmlschema-dev@w3.org
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@hotmail.com] _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
Received on Wednesday, 7 February 2007 08:43:45 UTC