Hi Werner and all,

I have couple of quick questions on using Castor schema model.

1. I declared default schema namespace in the Schema object with the prefix
"xs". Then I set the type reference of an element as "xs:string". But when I
used SchemaWriter to serialize the Schema object, the type of the element is
serialized as "string" and not as "xs:string". What should I do to fix this?

FYI : XMLInstance2SchemaHandler class had used setReference method instead
of setType method to set a simple type as a type of an element. I think it
is not the best way to do that, but I followed the same thing assuming
XMLInstance2SchemaHandler is doing it with a proper reason.

2. There is a simple type defined to define a restriction. How can I set
this restriction to Castor schema model. For example, take the following
schema fragment.

<xs:simpleType name="bookCategoryType" >
  <xs:restriction base="xs:string">
     <xs:enumeration value="magazine" />
     <xs:enumeration value="novel" />
     <xs:enumeration value="fiction" />
     <xs:enumeration value="other" />
  </xs:restriction>
</xs:simpleType>

This is what I did.

SimpleType simpleType = new UrType();
schema.addSimpleType(simpleType);

After this how can I add the restriction to simpleType?

Thanks.
SD

Reply via email to