users@jaxb.java.net

Re: Forcing lax=true in _at_XmlAnyElement

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Tue, 16 Feb 2010 17:37:03 +0100

A slight modification of the XML schema:

<xsd:complexType name="ComplexDataType">
  <xsd:complexContent mixed="true">
    <xsd:restriction base="xsd:anyType">
      <xsd:sequence>
        <xsd:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
      </xsd:sequence>
      <xsd:attribute name="foo" type="xsd:string"/>
    </xsd:restriction>
  </xsd:complexContent>
</xsd:complexType>

and xjc produces

    @XmlMixed
    @XmlAnyElement(lax = true)
    protected List<Object> content;

and the rest is pretty much the same, unless I've overlooked something.
-W


On Tue, Feb 16, 2010 at 1:45 PM, Aleksei Valikov <valikov_at_gmx.net> wrote:

> Hi,
>
> I have a following schema fragment:
>
> <complexType name="ComplexDataType" mixed="true">
> <annotation>
> <documentation>Complex data (such as an image),
> including a
> definition of the complex value data structure (i.e., schema, format,
> and encoding). May be an ows:Manifest data structure.</documentation>
> </annotation>
> <complexContent mixed="true">
> <extension base="anyType">
> <attributeGroup
> ref="wps:ComplexDataEncoding"/>
> </extension>
> </complexContent>
> </complexType>
>
> XJC generates the following content property for the content of this type:
>
> @XmlMixed
> @XmlAnyElement
> protected List<Object> content;
>
> public List<Object> getContent() {
> if (content == null) {
> content = new ArrayList<Object>();
> }
> return this.content;
> }
>
> Note the @XmlAnyElement without any attributes.
>
> What I need is a lax-ed @XmlAnyElement there:
>
> @XmlMixed
> @XmlAnyElement(lax=true)
> protected List<Object> content;
>
> My question is: is there any possibility to customize this property so
> that it gets lax=true in @XmlAnyElement definition?
>
> If not, I'll write a plugin for that - but I don't want to make useless
> work.
>
> Thank you for your time!
>
> Bye,
> /lexi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>