[xsd-users] Parsing mixed content
Fred OLeary
fred at essentel.com
Fri Feb 21 14:05:35 EST 2014
Thanks Boris!
On 2/16/14 8:07 AM, "Boris Kolpackov" <boris at codesynthesis.com> wrote:
>Hi Fred,
>
>Fred OLeary <fred at essentel.com> writes:
>
>> Our XSD for this is of the form:
>> <xs:complexType name="foobar" mixed="true">
>> <xs:attribute name="attriubute1" type="xs:string"
>>use="optional"/>
>> </xs:complexType>
>
>The simplest solution is to change (I would even say "fix") your schema:
>
> <xs:complexType name="foobar">
> <xs:simpleContent>
> <xs:extension base="xs:string">
> <xs:attribute name="attriubute1" type="xs:string" use="optional"/>
> </xs:extension>
> </xs:simpleContent>
> </xs:complexType>
>
>
>> I would like the generated classes to contain methods to retreive the
>> content if is present and hopefully a method to indicate if content is
>> available
>
>If you cannot change your schema, then the other two options are:
>
>1. Use the DOM association feature. This approach is shown in the
> 'mixed' example.
>
>2. Customize the generated class to extract the content and provide
> the desired API. This approach is shown in the 'custom/mixed'
> example.
>
>Boris
>
More information about the xsd-users
mailing list