1. IIUC your sample document should look like
<myElem xmlns="mine">
<myChlid>
<daughter>foo</daughter>
</myChild>
</myElem>

2. Try XmlObject.selectChildren(QNameSet desiredQNames);

If all your schemas are compiled at once into one jar I think this will return the desired XmlObjects as the types you expect. Otherwise if you get a plain XmlObject you may have to copy and call changeType(desiredSchemaType) on them. When I do this I find that trying to call changeType without making a new copy usually doesn't work, but I'm also trying to glue together a lot of schema type systems from several jars, so it may work better if all your schemas are compiled at once.

hope this helps
david jencks

On Jun 20, 2007, at 5:39 AM, Desmond Whewell (CV/ETL) wrote:

Sorry about Yet-Another-Any question, but this is my first expedition in Xmlbeans and I have seached the documentation and Javadocs and I'm still
banging my head against a brick wall.

Suppose I have a schema with an element, 'myElem', say. One of the child
elements, 'myChild', is defined as:

    <xs:element name="myChild" type="MyChildType" minOccurs="0" />
    <xs:complexType name="MyChildType">
        <xs:sequence>
              <xs:any namespace="##any" processContents="lax"
maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>

I can get at MyChild by:

    MyChildType myChild = myElem.getMyChild();

But, and you all know what's coming, how do I get the object that is
*actually* being carried in the place of the Any? I have tried using
XmlCursors to navigate to the object, but I really don't want to have to disassemble the XmlObject, what I really want is to get back to the cosy
world of gets and sets on the concrete objects.

So, if I had a xml fragement that looked like:

    <myElem>
        <daughter>britney spears</daughter>
    </myElem>

What is the cleanest way of extracting the XmlObject and creating the
associated 'daughter' xmlbean so that I can go back to :

        daughter.getAge();

Assume that 'daughter' is the only element type that I'm prepared to
accept and that other elements will be rejected by the surrounding
application as 'not supported'.

Thanks for any help.

Cheers, Des

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to