You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Michael Lancaster <m....@philology.com.au> on 2004/10/14 03:57:13 UTC

strange behaviour, xmlbeans generate invalid xml...

hi,

 

i have the following schema chunk:

 

<xs:element name="Element" type="ElementType" minOccurs="0"
maxOccurs="unbounded"/>

 

            <xs:complexType name="ElementType">

                        <xs:element name="ElementSet">

                                                <xs:complexType>

                                                            <xs:sequence>

 
<xs:element name="Element" type="ElementType" minOccurs="0"
maxOccurs="unbounded"/>

                                                            </xs:sequence>

                                                </xs:complexType>

                        </xs:element>

            </xs:complexType>

 

with the following xml chunk:

 

<Element id="0">

<ElementSet>

                        <Element id="1"/>

                        <Element id="2"/>

</ElementSet>

</Element>

 

the following code:

 

ElementType el = getIDZeroElement();

 

for (int i = 0; i < el.getElementSet().getElementArray().length; i++) 

el.getElementSet().removeElement(0);

 

(note: schema, xml and code are artificial, but hopefully you get the
idea...)

 

produces this xml:

 

<Element id="0">

            <ElementSet>

 

            </ElementSet>

</Element>

 

however, this is not valid because the ElementSet tag should not allow text.
Am I missing something silly here or is this a bug...

 

Thanks,

 

Michael