Got it. Thanks.
From more careful review, Miguel's original example is missing xmlns="http://www.ogf.org/dfdl/dfdl-1.0/examples/" which would set his example ns to be the default ns, or add the tns prefix to the references.
...mikeb
Mike ->>>> My read of the XML Schema spec indicates this QName is interpreted same as any other QName which is to say if it does not have a prefix part, then a default namespace >>>> should be used if one is defined via xmlns="...".This is true.. But the problem with the schema was that the PersonInfo type is defined in namespace http://www.ogf.org/dfdl/dfdl-1.0/examples/ . Without qualification of type in the reference, it would look into default namespace and would not find it and hence the schema validation error..
To: Suman Kalia/Toronto/IBM@IBMCA,
Suman Kalia
IBM Canada Lab
WMB Toolkit Architect and Development Lead
Tel: 905-413-3923 T/L 313-3923
Email: kalia@ca.ibm.com
For info on Message broker
http://www.ibm.com/developerworks/websphere/zones/businessintegration/wmb.html
From: Mike Beckerle <mbeckerle.dfdl@gmail.com>
Cc: Miguel Vieira <carlos.vieira@gmv.com>, dfdl-wg@ogf.org
Date: 08/31/2012 02:27 PMSubject: Re: [DFDL-WG] WS shcema/dfdl validation failing
Suman,
I was not sure about this requirement "when an element references a global type it must qualify it with the namespace".
Is this really required? My read of the XML Schema spec indicates this QName is interpreted same as any other QName which is to say if it does not have a prefix part, then a default namespace should be used if one is defined via xmlns="...".
I did not check for errata or anything like that.
...mikeb
On Fri, Aug 31, 2012 at 2:02 PM, Suman Kalia <kalia@ca.ibm.com> wrote:
Mike - Not exactly right.. In the original schema, target namespace was defined and it had the prefix tns. When an element references a global type, it must qualify it with the namespace.
Miguel was getting the error because without namespace qualification, schema could not determine where personInfo was defined ..CTDX1100E : XSD: Type reference '#name' is unresolved … line 13 XSD Schema Validation Problem
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" targetNamespace="http://www.ogf.org/dfdl/dfdl-1.0/examples/"
xmlns:tns="http://www.ogf.org/dfdl/dfdl-1.0/examples/"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="employee" type="personinfo" />
<xs:element name="student" type="personinfo" />Miguel ,
With the XSD error resolved, now you are getting DFDL validation errors. The presence of "http://www.ogf.org/dfdl/dfdl-1.0/" namespace in the schema kicks of the DFDL validator.. We supplied General purpose format for DFDL to the work group which contains reasonable defaults for DFDL annotations for most uses cases for text representation ..
Here is the document that describes how this format can be included in your schema.
http://www.ogf.org/Public_Comment_Docs/Documents/2012-04/gwdi-dfdl-example-format-v1.pdfYou should include /import the DFDLGeneralFormatDefinition.xsd in your schema depending on the target namespace of your schema. In your case it would be xs:include statement as the tns of your schema is same as the tns of the general purpose format.
Your schema would look like following
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified"
elementFormDefault="qualified" targetNamespace="http://www.ogf.org/dfdl/dfdl-1.0/examples/"
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:tns="http://www.ogf.org/dfdl/dfdl-1.0/examples/"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="DFDLGeneralFormatDefinition.xsd"/>
<xs:annotation>
<xs:appinfo source="http://www.ogf.org/dfdl/">
<dfdl:format ref="tns:GeneralFormat" />
</xs:appinfo>
</xs:annotation>
<xs:element name="employee" type="tns:personinfo" />
<xs:element name="student" type="tns:personinfo" />
<xs:element name="member" type="tns:personinfo" />
<xs:complexType name="personinfo">
<xs:sequence>
<xs:element name="aPersonsName" type="tns:name" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="name">
<xs:sequence>
<xs:element name="firstname" type="xs:string" />
<xs:element name="lastname" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:schema>
Suman Kalia
IBM Canada Lab
WMB Toolkit Architect and Development Lead
Tel: 905-413-3923 T/L 313-3923
Email: kalia@ca.ibm.com
For info on Message broker
http://www.ibm.com/developerworks/websphere/zones/businessintegration/wmb.html
From: Mike Beckerle <mbeckerle.dfdl@gmail.com>
To: Miguel Vieira <carlos.vieira@gmv.com>,
Cc: Suman Kalia/Toronto/IBM@IBMCA, "dfdl-wg@ogf.org" <dfdl-wg@ogf.org>, "dfdl-wg-bounces@ogf.org" <dfdl-wg-bounces@ogf.org>
Date: 08/31/2012 12:29 PM
Subject: Re: [DFDL-WG] WS shcema/dfdl validation failing
Miguel,
I think your original schema as written is technically correct. You have XMLSchema namespace fully qualified everywhere. Only the target namespace is unqualified. Hence your type='...' references from element to your type definitions should be interpreted in that target namespace.
(My rationale: See: http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/structures.html#src-qname)
But perhaps I am missing some nuance?
My own style has evolved to one where I make little or no use of unqualified names to avoid this issue entirely.
...mikeb
On Fri, Aug 31, 2012 at 3:31 AM, Miguel Vieira <carlos.vieira@gmv.com> wrote:
Hello!
But if I do that, I get:
CTDV1116E : DFDL property 'encoding' must be set. Element: #xmlns(p="http://www.ogf.org/dfdl/dfdl-1.0/examples/")xscd(/schemaElement::p:employee). line 7 DFDL Validation Problem
CTDV1116E : DFDL property 'encoding' must be set. Element: #xmlns(p="http://www.ogf.org/dfdl/dfdl-1.0/examples/")xscd(/schemaElement::p:member). line 9 DFDL Validation Problem
CTDV1116E : DFDL property 'encoding' must be set. Element: #xmlns(p="http://www.ogf.org/dfdl/dfdl-1.0/examples/")xscd(/schemaElement::p:student). line 8 DFDL Validation
(…)
CTDV1118E : When 'sequenceKind' is 'ordered', DFDL property 'floating' must be set. Element: #xmlns(p="http://www.ogf.org/dfdl/dfdl-1.0/examples/")xscd(/type::p:name/model::sequence/schemaElement::p:firstname). line 19 DFDL Validation Problem
CTDV1118E : When 'sequenceKind' is 'ordered', DFDL property 'floating' must be set. Element: #xmlns(p="http://www.ogf.org/dfdl/dfdl-1.0/examples/")xscd(/type::p:name/model::sequence/schemaElement::p:lastname). line 20 DFDL Validation Problem
CTDV1118E : When 'sequenceKind' is 'ordered', DFDL property 'floating' must be set. Element: #xmlns(p="http://www.ogf.org/dfdl/dfdl-1.0/examples/")xscd(/type::p:personinfo/model::sequence/schemaElement::p:aPersonsName). line 13 DFDL Validation Problem
(…)
CTDV1202E : DFDL property 'leadingSkip' must be set. Object Element: #xmlns(p="http://www.ogf.org/dfdl/dfdl-1.0/examples/")xscd(/schemaElement::p:employee). line 7 DFDL Validation Problem
CTDV1202E : DFDL property 'leadingSkip' must be set. Object Element: #xmlns(p="http://www.ogf.org/dfdl/dfdl-1.0/examples/")xscd(/schemaElement::p:member). line 9 DFDL Validation Problem
CTDV1202E : DFDL property 'leadingSkip' must be set. Object Element: #xmlns(p="http://www.ogf.org/dfdl/dfdl-1.0/examples/")xscd(/schemaElement::p:student). line 8 DFDL Validation Problem
(…)
CTDV1204E : DFDL property 'alignment' must be set. Element: #xmlns(p="http://www.ogf.org/dfdl/dfdl-1.0/examples/")xscd(/schemaElement::p:employee). line 7 DFDL Validation Problem
(…)
CTDV1238E : When type is string, DFDL property 'representation' must be set. Element: #xmlns(p="http://www.ogf.org/dfdl/dfdl-1.0/examples/")xscd(/type::p:name/model::sequence/schemaElement::p:firstname). line 19 DFDL Validation Problem
CTDV1238E : When type is string, DFDL property 'representation' must be set. Element: #xmlns(p="http://www.ogf.org/dfdl/dfdl-1.0/examples/")xscd(/type::p:name/model::sequence/schemaElement::p:lastname). line 20 DFDL Validation Problem
(…)
CTDV1259E : DFDL property 'initiator' must either be set or be empty. Element: #xmlns(p="http://www.ogf.org/dfdl/dfdl-1.0/examples/")xscd(/schemaElement::p:employee). line 7 DFDL Validation Problem
CTDV1259E : DFDL property 'initiator' must either be set or be empty. Element: #xmlns(p="http://www.ogf.org/dfdl/dfdl-1.0/examples/")xscd(/schemaElement::p:member). line 9 DFDL Validation Problem
CTDV1259E : DFDL property 'initiator' must either be set or be empty. Element: #xmlns(p="http://www.ogf.org/dfdl/dfdl-1.0/examples/")xscd(/schemaElement::p:student). line 8 DFDL Validation Problem
CTDV1259E : DFDL property 'initiator' must either be set or be empty. Element: #xmlns(p="http://www.ogf.org/dfdl/dfdl-1.0/examples/")xscd(/type::p:name/model::sequence/schemaElement::p:firstname). line 19 DFDL Validation Problem
CTDV1259E : DFDL property 'initiator' must either be set or be empty. Element: #xmlns(p="http://www.ogf.org/dfdl/dfdl-1.0/examples/")xscd(/type::p:name/model::sequence/schemaElement::p:lastname). line 20 DFDL Validation Problem
(…)
(…)
I don’t think I have to set all these properties, or do I?
From: Suman Kalia [mailto:kalia@ca.ibm.com]
Sent: quinta-feira, 30 de Agosto de 2012 19:22
To: Miguel Vieira
Cc: dfdl-wg@ogf.org; dfdl-wg-bounces@ogf.org
Subject: Re: [DFDL-WG] WS shcema/dfdl validation failing
You have to qualify the type with namespace prefix as follows..
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" targetNamespace="http://www.ogf.org/dfdl/dfdl-1.0/examples/"
xmlns:tns="http://www.ogf.org/dfdl/dfdl-1.0/examples/"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="employee" type="tns:personinfo" />
<xs:element name="student" type="tns:personinfo" />
<xs:element name="member" type="tns:personinfo" />
<xs:complexType name="personinfo">
<xs:sequence>
<xs:element name="aPersonsName" type="tns:name"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="name">
<xs:sequence>
<xs:element name="firstname" type="xs:string" />
<xs:element name="lastname" type="xs:string" />
</xs:sequence>
</xs:complexType>
Suman Kalia
IBM Canada Lab
WMB Toolkit Architect and Development Lead
Tel: 905-413-3923 T/L 313-3923
Email: kalia@ca.ibm.com
For info on Message broker
http://www.ibm.com/developerworks/websphere/zones/businessintegration/wmb.html
From: Miguel Vieira <carlos.vieira@gmv.com>
To: "dfdl-wg@ogf.org" <dfdl-wg@ogf.org>,
Date: 08/30/2012 01:03 PM
Subject: [DFDL-WG] WS shcema/dfdl validation failing
Sent by: dfdl-wg-bounces@ogf.org
Hi!
I have this simple schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" targetNamespace="http://www.ogf.org/dfdl/dfdl-1.0/examples/"
xmlns:tns="http://www.ogf.org/dfdl/dfdl-1.0/examples/"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="employee" type="personinfo" />
<xs:element name="student" type="personinfo" />
<xs:element name="member" type="personinfo" />
<xs:complexType name="personinfo">
<xs:sequence>
<xs:element name="aPersonsName" type="name"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="name">
<xs:sequence>
<xs:element name="firstname" type="xs:string" />
<xs:element name="lastname" type="xs:string" />
</xs:sequence>
</xs:complexType>
Message Broker gives me the following errors:
CTDX1100E : XSD: Type reference '#name' is unresolved … line 13 XSD Schema Validation Problem
CTDX1100E : XSD: Type reference '#personinfo' is unresolved … line 7 XSD Schema Validation Problem
CTDX1100E : XSD: Type reference '#personinfo' is unresolved … line 8 XSD Schema Validation Problem
CTDX1100E : XSD: Type reference '#personinfo' is unresolved … line 9 XSD Schema Validation Problem
In this model, all the elements and the complex type are given a name and are global. Shouldn’t it be possible to reference them?
If I remove the [xmlns:dfdl=http://www.ogf.org/dfdl/dfdl-1.0/ targetNamespace=http://www.ogf.org/dfdl/dfdl-1.0/examples/] every thing is ok.
P Please consider the environment before printing this e-mail.This message including any attachments may contain confidential information, according to our Information Security Management System, and intended solely for a specific individual to whom they are addressed. Any unauthorised copy, disclosure or distribution of this message is strictly forbidden. If you have received this transmission in error, please notify the sender immediately and delete it.
Este mensaje, y en su caso, cualquier fichero anexo al mismo, puede contener información clasificada por su emisor como confidencial en el marco de su Sistema de Gestión de Seguridad de la Información siendo para uso exclusivo del destinatario, quedando prohibida su divulgación copia o distribución a terceros sin la autorización expresa del remitente. Si Vd. ha recibido este mensaje erróneamente, se ruega lo notifique al remitente y proceda a su borrado. Gracias por su colaboración.
Esta mensagem, incluindo qualquer ficheiro anexo, pode conter informação confidencial, de acordo com nosso Sistema de Gestão de Segurança da Informação, sendo para uso exclusivo do destinatário e estando proibida a sua divulgação, cópia ou distribuição a terceiros sem autorização expressa do remetente da mesma. Se recebeu esta mensagem por engano, por favor avise de imediato o remetente e apague-a. Obrigado pela sua colaboração.
--
dfdl-wg mailing list
dfdl-wg@ogf.org
https://www.ogf.org/mailman/listinfo/dfdl-wg
P Please consider the environment before printing this e-mail.
This message including any attachments may contain confidential information, according to our Information Security Management System, and intended solely for a specific individual to whom they are addressed. Any unauthorised copy, disclosure or distribution of this message is strictly forbidden. If you have received this transmission in error, please notify the sender immediately and delete it.
Este mensaje, y en su caso, cualquier fichero anexo al mismo, puede contener información clasificada por su emisor como confidencial en el marco de su Sistema de Gestión de Seguridad de la Información siendo para uso exclusivo del destinatario, quedando prohibida su divulgación copia o distribución a terceros sin la autorización expresa del remitente. Si Vd. ha recibido este mensaje erróneamente, se ruega lo notifique al remitente y proceda a su borrado. Gracias por su colaboración.
Esta mensagem, incluindo qualquer ficheiro anexo, pode conter informa�ão confidencial, de acordo com nosso Sistema de Gestão de Segurança da Informa�ão, sendo para uso exclusivo do destinatário e estando proibida a sua divulga�ão, cópia ou distribui�ão a terceiros sem autoriza�ão expressa do remetente da mesma. Se recebeu esta mensagem por engano, por favor avise de imediato o remetente e apague-a. Obrigado pela sua colabora�ão.
--
dfdl-wg mailing list
dfdl-wg@ogf.org
https://www.ogf.org/mailman/listinfo/dfdl-wg
--
Mike Beckerle | OGF DFDL WG Co-Chair
Tel: 781-330-0412
--
Mike Beckerle | OGF DFDL WG Co-Chair
Tel: 781-330-0412