- From: George Cristian Bina <george@oxygenxml.com>
- Date: Thu, 23 Jun 2005 11:06:10 +0300
- To: Hämmer Wolfgang <Wolfgang.Haemmer@swx.com>
- Cc: xmlschema-dev@w3.org
Hi Wolf, You can reuse a type in XML schema if you define that is a global type definition and then set that type to the elements that you want to have the same content. Something like below: <xs:complexType name="CommonType" mixed="true"> <xs:sequence> <xs:element name="LocalVariables" minOccurs="1" maxOccurs="1"> <xs:complexType> <xs:choice> <xs:sequence> <xs:element name="l_start" minOccurs="1" maxOccurs="1"/> <xs:element name="l_end" minOccurs="1" maxOccurs="1"/> </xs:sequence> <xs:sequence> <xs:element name="l_first" minOccurs="1" maxOccurs="1"/> <xs:element name="l_second" minOccurs="1" maxOccurs="1"/> <xs:element name="l_third" minOccurs="1" maxOccurs="1"/> </xs:sequence> </xs:choice> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> <xs:element name="TableDrop" type="CommonType"/> <xs:element name="Sizes" type="CommonType"/> Best Regards, George --------------------------------------------------------------------- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com Hämmer Wolfgang wrote: > Hello, > > this is something I wanted to ask for a long time .... > > > Is there a way using a xml schema to describe an element which name changes as in ... > > <TableDrop> > public string code (string l_p) { > return l_first + l_p + l_second + l_p + l_third; > } > <LocalVariables> > <l_first> > aString = _T("drop table </l_first> > <l_second> > "); hr = Oc.Execute( aString ); > if ( FAILED(hr) ) _tprintf(_T("Oc.Execute drop table failed with EBSc_TAB_</l_second> > <l_third> > ")); > </l_third> > </LocalVariables> > </TableDrop> > <Sizes> > public string code (string l_p) { return l_start + l_p + l_end;} > <LocalVariables> > <l_start>//TYPEDEF[attribute::name=</l_start> > <l_end>]/attribute::size</l_end> > </LocalVariables> > </Sizes> > > The elements TableDrop and Sizes have the same structure but bear different names. > > I would like to write something like .... > > <xs:element name='.*'> > <xs:complexType> > <xs:sequence> > <xs:element name="LocalVariables" minOccurs="1" maxOccurs="1"> > <xs:complexType> > <xs:sequence> > <xs:element name="l_start" minOccurs="1" maxOccurs="1"> > <xs:element name="l_end" minOccurs="1" maxOccurs="1"> > <xs:sequence> > </xs:complexType> > </xs:element> > <xs:sequence> > </xs:complexType> > </xs:element> > > Thanks for your help! > > Kind regards, Wolf > > > This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please notify the sender urgently and then immediately delete the message and any copies of it from your system. Please also immediately destroy any hardcopies of the message. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. The sender's company reserves the right to monitor all e-mail communications through their networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of the sender's company. > >
Received on Thursday, 23 June 2005 08:03:27 UTC