Hi, philipp_s wrote: > hmm, I am still stuck, I need to add some facets in the generated schema, and > therefore cannot just simple reference the type from the other schema, > > it seems I need to do something like this in the generated schema: > > <?xml version="1.0" encoding="UTF-8"?> > <schema xmlns="http://www.w3.org/2001/XMLSchema" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > targetNamespace="http://foo/barGenerated" > xmlns:fooGenerated="http://foo/barGenerated" > xmlns:foo="http://foo/bar" elementFormDefault="qualified" > version="1.0"> > <xs:import namespace="http://foo/bar" /> > > <xs:element name="bla"> > <xs:complexType> > <xs:simpleContent> > <xs:extension base="fooGenerated:blaBaseType"> > <xs:attributeGroup ref="foo:stringAttributes" /> > </xs:extension> > </xs:simpleContent> > </xs:complexType> > </xs:element> > > <xs:simpleType name="blaBaseType"> > <xs:restriction base="xs:string"> > <xs:pattern value="[0-3][0-9]-[A-Za-z]{3}-[1|2][0-9]{3}" /> > </xs:restriction> > </xs:simpleType> > > </schema> > > where the attributeGroup is located in a pre-existing schema In other words, you are NOT creating the following schema programmatically, correct ?
> > <?xml version="1.0" encoding="UTF-8"?> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" > targetNamespace="http://foo/bar" attributeFormDefault="unqualified" > elementFormDefault="qualified" version="1.0"> > > <xs:attributeGroup name="stringAttributes"> > <xs:attribute name="lang" type="xs:string" use="optional" /> > <xs:attribute name="index" type="xs:int" use="optional" default="1" /> > </xs:attributeGroup> > > </xs:schema> > > I now have the problem that I don't know how to create a anonymous > complexType for the element definition - any help would be appreciated... > > thx, > > Philipp > > > philipp_s wrote: >> Hi Werner, >> >> let's assume we have a schema like this, containing an attribute group >> definition: >> >> <?xml version="1.0" encoding="UTF-8"?> >> <schema xmlns="http://www.w3.org/2001/XMLSchema" >> xmlns:xs="http://www.w3.org/2001/XMLSchema" >> targetNamespace="http://foo/bar" elementFormDefault="qualified" >> version="1.0"> >> <xs:attributeGroup name="someAttributes"> >> <xs:attribute name="index" type="xs:string" use="optional" >> default="1" /> >> <xs:attribute name="lang" type="xs:string" use="optinal" /> >> </xs:attributeGroup> >> </Schema> >> >> now I want to programmatically generate a schema that uses the attribute >> group for an element definition based on the xs:string, it should look >> something like this: >> >> <?xml version="1.0" encoding="UTF-8"?> >> <schema xmlns="http://www.w3.org/2001/XMLSchema" >> xmlns:xs="http://www.w3.org/2001/XMLSchema" >> targetNamespace="http://foo/barGenerated" xmlns:foo="http://foo/bar" >> elementFormDefault="qualified" version="1.0"> >> <xs:element name="bla"> >> <xs:complexType> >> <xs:simpleContent> >> <xs:restriction base="xs:string"></xs:restriction> >> </xs:simpleContent> >> <xs:attributeGroup ref="foo:someAttributes" /> >> </xs:complexType> >> </xs:element> >> </schema> >> >> But it seems that doesn't work at all, so now I reverted to declare not an >> attributeGroup but an element type in the pre-existing schema: >> >> <xs:complexType name="fooType"> >> <xs:simpleContent> >> <xs:extension base="xs:string"> >> <xs:attribute name="lang" type="xs:string" use="optional" /> >> <xs:attribute name="index" type="xs:int" use="optional" >> default="1" /> >> </xs:extension> >> </xs:simpleContent> >> </xs:complexType> >> >> and reference that in the generated schema. >> >> >> thx, >> >> Philipp >> >> >> Werner Guttmann wrote: >>> Hi, >>> >>> can you show me one ro two example of the (anonymuous) type definitions >>> you'd like to create ? >>> >>> Thanks >>> Werner >>> >>> philipp_s wrote: >>>> When programmatically creating a schema using castor, I now need to add >>>> an >>>> attributeGroup to an element (type) declaration - how can I do that? >>>> >>>> thx, >>>> >>>> Philipp >>> --------------------------------------------------------------------- >>> To unsubscribe from this list, please visit: >>> >>> http://xircles.codehaus.org/manage_email >>> >>> >>> >>> >> > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

