Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Restricting Attributes in Attributegroup >Thread Next - Re: Restricting Attributes in Attributegroup Re: Restricting Attributes in AttributegroupTo: NULL Date: 11/1/2004 2:21:00 AM Would you pls explain what you mean be tokenized... Using Complextype instead of Attributegroup works. -Maha. "Han" wrote: > Nice. The example seems to be tokenized one. Anyway, can be misleading. > Simply replace the <attributeGroud> with <complexType>. This seems to work > for me. > > <xs:schema > xmlns:xs="http://www.w3.org/2001/XMLSchema" > elementFormDefault="qualified" > > > > <xs:complexType name="A"> > <xs:attribute name="x"/> > <xs:attribute name="y"/> > </xs:complexType> > > <xs:complexType name="B"> > <xs:complexContent> > <xs:restriction base="A"> > <xs:attribute name="x" use="required" /> > <xs:attribute name="y" use="prohibited"/> > </xs:restriction> > </xs:complexContent> > </xs:complexType> > > <xs:element name='a' type='B'/> > > </xs:schema> > > "Mahalax" <Mahalax@d...> wrote in message > news:2E16A199-7E18-4CA8-999F-FCE336D365C8@m...... > > Here is the link: > > > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/xsdrefattributeelement.asp > > > > "Han" wrote: > > > >> Interesting example. As I read MSDN, only the name of a complexType is > >> allowed. > >> > >> (Excerpt) > >> > >> restriction (complexContent) > >> > >> base > >> The name of a complexType element defined in this schema (or another > >> schema > >> indicated by the specified namespace). The element containing the > >> restriction element is derived from the type specified by the base value. > >> > >> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/xsdrefrestrictioncomplexContentElement.asp > >> > >> Do you happened to have a link of the example? > >> > >> "Mahalax" <Mahalax@d...> wrote in message > >> news:796D6E29-A336-48B7-92B9-CA8C6F73F8CD@m...... > >> > Yes, it does. Here is the MSDN sample. > >> > > >> > <xs:attributeGroup name="A"> > >> > <xs:attribute name="x" type="xs:NCName"/> > >> > <xs:attribute name="y" type="xs:QName"/> > >> > </xs:attributeGroup> > >> > > >> > <xs:complexType name="B"> > >> > <xs:complexContent> > >> > <xs:restriction base="xs:A"> > >> > <xs:attribute name="x" use="required" /> > >> > <xs:attribute name="y" use="prohibited"/> > >> > </xs:restriction> > >> > </xs:complexContent> > >> > </xs:complexType> > >> > > >> > -Maha > >> > > >> > "Han" wrote: > >> > > >> >> I mean reuse. I mean @use attribute at reused attributeGroup. > >> >> By the way, does MSDN example use name of an attributeGroup for its > >> >> @base > >> >> attribute? > >> >> > >> >> "Mahalax" <Mahalax@d...> wrote in message > >> >> news:CE54F817-01C7-487C-B277-F8245F2E0531@m...... > >> >> > Hi Han, > >> >> > > >> >> > Actually I am trying to explore the attributegroup and its purpose. > >> >> > Many > >> >> > of > >> >> > my schemas have a set of common atributes which I am trying to > >> >> > declare > >> >> > commonly and reuse as required. The code I have posted is an > >> >> > adaptation > >> >> > from > >> >> > MSDN which is not working. > >> >> > > >> >> > "Han" wrote: > >> >> > > >> >> >> OOPS, I mean @use by @required in the earlier post. Values are, > >> >> >> > >> >> >> optional, prohibited, required > >> >> >> > >> >> >> "Mahalax" <Mahalax@d...> wrote in message > >> >> >> news:207B477E-4686-4015-8CFE-A510B3AEBE6B@m...... > >> >> >> > Greetings. > >> >> >> > > >> >> >> > Below is the schema snippet I am trying to explore > >> >> >> > attributegroups > >> >> >> > and > >> >> >> > attribute's use property. However I am getting a validation error > >> >> >> > saying > >> >> >> > "undefined value for base encountered", pointing to > >> >> >> > <xs:restriction>. > >> >> >> > Please > >> >> >> > help. > >> >> >> > > >> >> >> > <?xml version="1.0" encoding="UTF-8"?> > >> >> >> > <xs:schema elementFormDefault="qualified" > >> >> >> > attributeFormDefault="unqualified" > >> >> >> > xmlns:xs="http://www.w3.org/2001/XMLSchema"> > >> >> >> > <xs:attributeGroup name="grp"> > >> >> >> > <xs:attribute name="x" type="xs:string"/> > >> >> >> > <xs:attribute name="y" type="xs:string"/> > >> >> >> > <xs:attribute name="z" type="xs:string"/> > >> >> >> > </xs:attributeGroup> > >> >> >> > <xs:complexType name="A"> > >> >> >> > <xs:complexContent> > >> >> >> > <xs:restriction base="xs:grp"> > >> >> >> > <xs:attribute name="x" use="required"/> > >> >> >> > <xs:attribute name="y" use="prohibited"/> > >> >> >> > <xs:attribute name="z" use="required"/> > >> >> >> > </xs:restriction> > >> >> >> > </xs:complexContent> > >> >> >> > </xs:complexType> > >> >> >> > </xs:schema> > >> >> >> > > >> >> >> > Best Regards, > >> >> >> > Mahalakshmi Natarajan > >> >> >> > http://mahalax.blogspot.com > >> >> >> > http://dotnetjunkies.com/weblog/mahalax > >> >> >> > >> >> >> > >> >> > >> >> > >> > >> > > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
