문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top