- From: Pete Cordell <petexmldev@codalogic.com>
- Date: Tue, 12 Jul 2011 16:28:57 +0100
- To: "Avinash Nagabhushan" <avinash.sit@gmail.com>
- Cc: <David.Hirtle@nrc-cnrc.gc.ca>, <xmlschema-dev@w3.org>
Hi Avinash, I afraid there is no way to refer to an Local element. HTH, Pete Cordell Codalogic Ltd Interface XML to C++ the easy way using C++ XML data binding to convert XSD schemas to C++ classes. Visit http://codalogic.com/lmx/ or http://www.xml2cpp.com for more info ----- Original Message ----- From: "Avinash Nagabhushan" <avinash.sit@gmail.com> To: "Pete Cordell" <petexmldev@codalogic.com> Cc: <David.Hirtle@nrc-cnrc.gc.ca>; <xmlschema-dev@w3.org> Sent: Tuesday, July 12, 2011 11:57 AM Subject: Re: Self reference in an element Hi Pete, Thanks a lot for the clarification :) I was wordering if there was a way to refer to an Local element or an "Anonymous Type Definitions". Thanks a lot for the clarification :) Thanks and Regards, Avinash K N On Tue, Jul 12, 2011 at 4:20 PM, Pete Cordell <petexmldev@codalogic.com> wrote: > Hi Avinash, > > To do this you will need to break "Department" out into its own top-level > element (or top-level complexType). For example: > > <xs:element name="Organization"> > <xs:complexType> > <xs:sequence> > <xs:element ref="ns1:Department" maxOccurs="unbounded"/> > </xs:sequence> > </xs:complexType> > </xs:element> > > <xs:element name="Department"> > <xs:complexType> > <xs:sequence> > <xs:element name="Name"/> > <xs:element name="TotalEmp"/> > <xs:element ref="ns1:Department" minOccurs="0" maxOccurs="unbounded"/> > </xs:sequence> > <xs:attribute name="num" type="xs:string"/> > </xs:complexType> > </xs:element> > > HTH, > > Pete Cordell > Codalogic Ltd > Interface XML to C++ the easy way using C++ XML > data binding to convert XSD schemas to C++ classes. > Visit http://codalogic.com/lmx/ or http://www.xml2cpp.com > for more info > > ----- Original Message ----- From: "Avinash Nagabhushan" > <avinash.sit@gmail.com> > To: <David.Hirtle@nrc-cnrc.gc.ca>; <xmlschema-dev@w3.org> > Sent: Tuesday, July 12, 2011 7:20 AM > Subject: Self reference in an element > > > > Hi Sir, > > I am writing an schema for the following structure: > > Organization > dept + > @num > name > total_emp > dept + > where dept elements are nested within another dept element, but all > departments are under organization. > > > My Schema is: > > > <xs:schema xmlns:ns1="VIPRE Anti-phishing found a known bad URL in your > email message. It was deleted or quarantined, depending on your settings, > and replaced with this message. The anti-phishing setting is located in > File>Settings under the Email Protection tab." > xmlns:xs="http://www.w3.org/2001/XMLSchema" > targetNamespace="VIPRE Anti-phishing found a known bad URL in your email > message. It was deleted or quarantined, depending on your settings, and > replaced with this message. The anti-phishing setting is located in > File>Settings under the Email Protection tab."> > <xs:element name="Organization"> > <xs:complexType> > <xs:sequence> > <xs:element name="Department" maxOccurs="unbounded"> > <xs:complexType> > <xs:sequence> > <xs:element name="Name"/> > <xs:element name="TotalEmp"/> > <xs:element ref="ns1:Department" minOccurs="0" maxOccurs="unbounded"/> > </xs:sequence> > <xs:attribute name="num" type="xs:string"/> > </xs:complexType> > </xs:element> > </xs:sequence> > </xs:complexType> > </xs:element> > </xs:schema> > > > There is a validation error saying "ns1:Department" is not a QName and > cannot find declaration for the same. Is there something wrong in my > definition? > > > Can you please let me know whether it is a correct approach or wrong? > > > Thanks, > > Avinash K N > > > >
Received on Tuesday, 12 July 2011 15:29:40 UTC