0

We're running into some trouble with supplied XSDs of the following kind:

<xsd:complexType name="foo">
    ...
    <xsd:attribute name="version" fixed="1" />
</xsd:complexType>

The XML-Result is then expected look something like this:

<foo version="1">...</foo>

Since this is not how fixed attribute values are actually supposed to work XMLBeans will not generate such a result for us by default. We have hundreds of XSDs like this with varying versions and want to avoid adding them all by hand.

Does anyone know of a way to programmatically determine the values of fixed attributes of a given XMLObject so we can add them generically?

kjosh
  • 587
  • 4
  • 11
  • Did you look at http://xmlbeans.apache.org/docs/2.0.0/guide/conIntroToTheSchemaTypeSystem.html – Petru Gardea Feb 27 '13 at 18:29
  • Thank you, I don't know how we missed that. We already had a SchemaType but somehow missed the link to the corresponding SchemaAttributeModel which seems to be all that's needed for this. – kjosh Feb 28 '13 at 08:33

1 Answers1

0

As described in the documentation provided by Petru Gardea's comment above you can access information about an XMLObjects schema, its attributes and their default values by using the SchemaTypeSystem.

kjosh
  • 587
  • 4
  • 11