Subject: RE: [xsl] Anonymous Elements From: aspsa <aspsa@xxxxxxxxxxxxx> Date: Tue, 26 Apr 2005 02:29:03 -0400 |
Ramkumar, Thanks for the reply. Yes, I see your point; it wouldn't make any sense. Let me pose a specific example. I'm trying to translate a DTD element declaration into an XML Schema element declaration. I believe this will work, but I'd appreciate your comments. DTD element declaration ----------------------- <!ELEMENT PERSONAE (TITLE, (PERSONA|PGROUP)+)> I'd like to translate the above to an XML Schema Complex Type. I see it as a sequence, with <TITLE> appearing first in the element order followed by at least one more element, which is a choice between <PERSONA> and <PGROUP>. <xs:complexType name="personaeType"> <xs:sequence> <xs:element name="TITLE" type="minStrLenType" /> <xs:group ref="PePgType" maxOccurs="unbounded" /> </xs:sequence> </xs:complexType> ...followed by a "PePgType" <xs:group> element... <xs:group name="PePgType"> <xs:choice> <xs:element name="PERSONA" type="minStrLenType" /> <xs:element name="PGROUP" type="pgroupType" /> </xs:choice> </xs:group> ...elsewhere, a "minStrLenType" exists, also... Again, thanks for your feedback Respectfully, ASP -----Original Message----- From: Ramkumar Menon [mailto:ramkumar.menon@xxxxxxxxx] Sent: Tuesday, April 26, 2005 1:51 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] Anonymous Elements I am just curous to know what you are trying to acheive through definition of an "anonymous element". It does not make sense to define an <xsd:element> without a name within your schema. What you can do is to have an <xsd:any>.This element will allow you to extend the instancet with elements not specified by the schema. What you are first referring to in your email is about anonymous types. Anonymous types are used to express intent that the types are not intended for reuse. So they are defined local to the element declaration. What you have to understand is that Elements and attributes are the items that actually appear in your instance that the schema defines. Types are just the metadata for descrbing the structure and content of these elements/attributes. -Menon On 4/26/05, aspsa <aspsa@xxxxxxxxxxxxx> wrote: > Hi, folks. > > As I understand it, anonymous elements are most often used with the > <xs:complexType> XML Schema element. However, is it possible to apply this > same concept to the <xs:element> element? I've commented out the named > version of the <xs:element> element in question. > > <xs:complexType name="personaeType"> > <xs:sequence> > <xs:element name="TITLE" type="minStrLenType" /> > <!--<xs:element name="PERSONAorPGROUP">--> > <xs:element> > <xs:complexType> > <xs:choice> > <xs:element name="PERSONA" type="minStrLenType" maxOccurs="unbounded" > /> > <xs:element name="PGROUP" type="pgroupType" maxOccurs="unbounded" /> > </xs:choice> > </xs:complexType> > </xs:element> > </xs:sequence> > </xs:complexType> > > Thanks for your feedback. > > Respectfully, > > ASP > > -- Shift to the left, shift to the right! Pop up, push down, byte, byte, byte! -Ramkumar Menon A typical Macroprocessor
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Anonymous Elements, Ramkumar Menon | Thread | Re: [xsl] Anonymous Elements, Ramkumar Menon |
Re: [xsl] Anonymous Elements, Ramkumar Menon | Date | Re: [xsl] Anonymous Elements, Ramkumar Menon |
Month |