You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Javier Ramos <ra...@parsec.es> on 2003/11/10 11:50:14 UTC

how to deal with extensible schemas

Hi,

    I am trying to figure out how to deal with extensible schemas. What want is to have the possibility to use xs:any element to declare that any xml content can be hooked under a given element. If I create a schema like:

<xs:complexType name="container">
    <xs:sequence>
        <xs:any minOccurs="0"/>
    </xs:sequence>
</xs:complexType>

    when I use scomp to generate java code and classes I obtain a dummy class for the element type 'container' and can find no way to hook any XMLObject inside it.

    In XMLCursor I can see there are methods to insert single elements or attributes, but no way to insert a whole XMLObject contents under a given cursor position.
    In XMLObject I cannot find nothing of help.

Does anybody have any ideas?

Javier


Re: how to deal with extensible schemas

Posted by Javier Ramos <ra...@parsec.es>.
Thanks a lot,  Yogesh, I was already playing with this.
Actually, I was not sure about calling cursorTo.toNextToken()
after creating cursorTo. I will try with your code.

Thanks again

Javier



----- Original Message ----- 
From: "Yogesh L. Simmhan" <ys...@cs.indiana.edu>
To: <xm...@xml.apache.org>
Sent: Monday, November 10, 2003 5:24 PM
Subject: RE: how to deal with extensible schemas


> You can create an XmlCursor for the XmlObject you wish to insert and to
the
> Container and use the copyXml method in the cursor.
>
> e.g. to insert 'child' XmlObject in container,
>
>         XmlCursor cursorTo = container.newCursor();
>         cursorTo.toNextToken();
>
>         XmlCursor cursorFrom = child.newCursor();
>         cursorFrom.copyXml(cursorTo);
>
>         cursorFrom.dispose();
>         cursorTo.dispose();
>
> --Yogesh
>
> ________________________________________
> From: Javier Ramos [mailto:ramos@parsec.es]
> Sent: Monday, November 10, 2003 5:50 AM
> To: xmlbeans-user@xml.apache.org
> Subject: how to deal with extensible schemas
>
> Hi,
>
> I am trying to figure out how to deal with extensible schemas. What want
is
> to have the possibility to use xs:any element to declare that any xml
content
> can be hooked under a given element. If I create a schema like:
>
> <xs:complexType name="container">
> <xs:sequence>
> <xs:any minOccurs="0"/>
> </xs:sequence>
> </xs:complexType>
>
> when I use scomp to generate java code and classes I obtain a dummy class
> for the element type 'container' and can find no way to hook any XMLObject
> inside it.
>
> In XMLCursor I can see there are methods to insert single elements or
> attributes, but no way to insert a whole XMLObject contents under a given
cursor
> position.
> In XMLObject I cannot find nothing of help.
>
> Does anybody have any ideas?
>
> Javier
>
>
>
>
> - ---------------------------------------------------------------------
> To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
> Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
>



- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Re: how to deal with extensible schemas

Posted by Javier Ramos <ra...@parsec.es>.
Hi,

    I am still trying to copy a document inside a placeholder in an
extensible schema. Usage of cursors semms to be the solution, as pointed out
by Yogesh.

But now I face another problem: if I try to copy a whole document, instead
of a document fragment, I get an exception ( IllegalArgumentException )
telling me that the operation cannot be carried out for a whole document.

Is there a way around this??

Javier


----- Original Message ----- 
From: "Yogesh L. Simmhan" <ys...@cs.indiana.edu>
To: <xm...@xml.apache.org>
Sent: Monday, November 10, 2003 5:24 PM
Subject: RE: how to deal with extensible schemas


> You can create an XmlCursor for the XmlObject you wish to insert and to
the
> Container and use the copyXml method in the cursor.
>
> e.g. to insert 'child' XmlObject in container,
>
>         XmlCursor cursorTo = container.newCursor();
>         cursorTo.toNextToken();
>
>         XmlCursor cursorFrom = child.newCursor();
>         cursorFrom.copyXml(cursorTo);
>
>         cursorFrom.dispose();
>         cursorTo.dispose();
>
> --Yogesh
>
> ________________________________________
> From: Javier Ramos [mailto:ramos@parsec.es]
> Sent: Monday, November 10, 2003 5:50 AM
> To: xmlbeans-user@xml.apache.org
> Subject: how to deal with extensible schemas
>
> Hi,
>
> I am trying to figure out how to deal with extensible schemas. What want
is
> to have the possibility to use xs:any element to declare that any xml
content
> can be hooked under a given element. If I create a schema like:
>
> <xs:complexType name="container">
> <xs:sequence>
> <xs:any minOccurs="0"/>
> </xs:sequence>
> </xs:complexType>
>
> when I use scomp to generate java code and classes I obtain a dummy class
> for the element type 'container' and can find no way to hook any XMLObject
> inside it.
>
> In XMLCursor I can see there are methods to insert single elements or
> attributes, but no way to insert a whole XMLObject contents under a given
cursor
> position.
> In XMLObject I cannot find nothing of help.
>
> Does anybody have any ideas?
>
> Javier
>
>
>
>
> - ---------------------------------------------------------------------
> To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
> Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
>



- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Re: how to deal with extensible schemas

Posted by Javier Ramos <ra...@parsec.es>.
Hi,

    I am still trying to copy a document inside a placeholder in an
extensible schema. Usage of cursors semms to be the solution, as pointed out
by Yogesh.

But now I face another problem: if I try to copy a whole document, instead
of a document fragment, I get an exception ( IllegalArgumentException )
telling me that the operation cannot be carried out for a whole document.

Is there a way around this??

Javier


----- Original Message ----- 
From: "Yogesh L. Simmhan" <ys...@cs.indiana.edu>
To: <xm...@xml.apache.org>
Sent: Monday, November 10, 2003 5:24 PM
Subject: RE: how to deal with extensible schemas


> You can create an XmlCursor for the XmlObject you wish to insert and to
the
> Container and use the copyXml method in the cursor.
>
> e.g. to insert 'child' XmlObject in container,
>
>         XmlCursor cursorTo = container.newCursor();
>         cursorTo.toNextToken();
>
>         XmlCursor cursorFrom = child.newCursor();
>         cursorFrom.copyXml(cursorTo);
>
>         cursorFrom.dispose();
>         cursorTo.dispose();
>
> --Yogesh
>
> ________________________________________
> From: Javier Ramos [mailto:ramos@parsec.es]
> Sent: Monday, November 10, 2003 5:50 AM
> To: xmlbeans-user@xml.apache.org
> Subject: how to deal with extensible schemas
>
> Hi,
>
> I am trying to figure out how to deal with extensible schemas. What want
is
> to have the possibility to use xs:any element to declare that any xml
content
> can be hooked under a given element. If I create a schema like:
>
> <xs:complexType name="container">
> <xs:sequence>
> <xs:any minOccurs="0"/>
> </xs:sequence>
> </xs:complexType>
>
> when I use scomp to generate java code and classes I obtain a dummy class
> for the element type 'container' and can find no way to hook any XMLObject
> inside it.
>
> In XMLCursor I can see there are methods to insert single elements or
> attributes, but no way to insert a whole XMLObject contents under a given
cursor
> position.
> In XMLObject I cannot find nothing of help.
>
> Does anybody have any ideas?
>
> Javier
>
>
>
>
> - ---------------------------------------------------------------------
> To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
> Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
>



- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Re: how to deal with extensible schemas

Posted by Javier Ramos <ra...@parsec.es>.
Thanks a lot,  Yogesh, I was already playing with this.
Actually, I was not sure about calling cursorTo.toNextToken()
after creating cursorTo. I will try with your code.

Thanks again

Javier



----- Original Message ----- 
From: "Yogesh L. Simmhan" <ys...@cs.indiana.edu>
To: <xm...@xml.apache.org>
Sent: Monday, November 10, 2003 5:24 PM
Subject: RE: how to deal with extensible schemas


> You can create an XmlCursor for the XmlObject you wish to insert and to
the
> Container and use the copyXml method in the cursor.
>
> e.g. to insert 'child' XmlObject in container,
>
>         XmlCursor cursorTo = container.newCursor();
>         cursorTo.toNextToken();
>
>         XmlCursor cursorFrom = child.newCursor();
>         cursorFrom.copyXml(cursorTo);
>
>         cursorFrom.dispose();
>         cursorTo.dispose();
>
> --Yogesh
>
> ________________________________________
> From: Javier Ramos [mailto:ramos@parsec.es]
> Sent: Monday, November 10, 2003 5:50 AM
> To: xmlbeans-user@xml.apache.org
> Subject: how to deal with extensible schemas
>
> Hi,
>
> I am trying to figure out how to deal with extensible schemas. What want
is
> to have the possibility to use xs:any element to declare that any xml
content
> can be hooked under a given element. If I create a schema like:
>
> <xs:complexType name="container">
> <xs:sequence>
> <xs:any minOccurs="0"/>
> </xs:sequence>
> </xs:complexType>
>
> when I use scomp to generate java code and classes I obtain a dummy class
> for the element type 'container' and can find no way to hook any XMLObject
> inside it.
>
> In XMLCursor I can see there are methods to insert single elements or
> attributes, but no way to insert a whole XMLObject contents under a given
cursor
> position.
> In XMLObject I cannot find nothing of help.
>
> Does anybody have any ideas?
>
> Javier
>
>
>
>
> - ---------------------------------------------------------------------
> To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
> Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
>



- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


RE: how to deal with extensible schemas

Posted by "Yogesh L. Simmhan" <ys...@cs.indiana.edu>.
You can create an XmlCursor for the XmlObject you wish to insert and to the
Container and use the copyXml method in the cursor.

e.g. to insert 'child' XmlObject in container,

        XmlCursor cursorTo = container.newCursor();
        cursorTo.toNextToken();

        XmlCursor cursorFrom = child.newCursor();
        cursorFrom.copyXml(cursorTo);

        cursorFrom.dispose();
        cursorTo.dispose();

--Yogesh

________________________________________
From: Javier Ramos [mailto:ramos@parsec.es] 
Sent: Monday, November 10, 2003 5:50 AM
To: xmlbeans-user@xml.apache.org
Subject: how to deal with extensible schemas

Hi,
 
    I am trying to figure out how to deal with extensible schemas. What want is
to have the possibility to use xs:any element to declare that any xml content
can be hooked under a given element. If I create a schema like:
 
<xs:complexType name="container">
    <xs:sequence>
        <xs:any minOccurs="0"/>
    </xs:sequence>
</xs:complexType>
 
    when I use scomp to generate java code and classes I obtain a dummy class
for the element type 'container' and can find no way to hook any XMLObject
inside it.
 
    In XMLCursor I can see there are methods to insert single elements or
attributes, but no way to insert a whole XMLObject contents under a given cursor
position.
    In XMLObject I cannot find nothing of help.
 
Does anybody have any ideas?
 
Javier
 
 


- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


RE: how to deal with extensible schemas

Posted by "Yogesh L. Simmhan" <ys...@cs.indiana.edu>.
You can create an XmlCursor for the XmlObject you wish to insert and to the
Container and use the copyXml method in the cursor.

e.g. to insert 'child' XmlObject in container,

        XmlCursor cursorTo = container.newCursor();
        cursorTo.toNextToken();

        XmlCursor cursorFrom = child.newCursor();
        cursorFrom.copyXml(cursorTo);

        cursorFrom.dispose();
        cursorTo.dispose();

--Yogesh

________________________________________
From: Javier Ramos [mailto:ramos@parsec.es] 
Sent: Monday, November 10, 2003 5:50 AM
To: xmlbeans-user@xml.apache.org
Subject: how to deal with extensible schemas

Hi,
 
    I am trying to figure out how to deal with extensible schemas. What want is
to have the possibility to use xs:any element to declare that any xml content
can be hooked under a given element. If I create a schema like:
 
<xs:complexType name="container">
    <xs:sequence>
        <xs:any minOccurs="0"/>
    </xs:sequence>
</xs:complexType>
 
    when I use scomp to generate java code and classes I obtain a dummy class
for the element type 'container' and can find no way to hook any XMLObject
inside it.
 
    In XMLCursor I can see there are methods to insert single elements or
attributes, but no way to insert a whole XMLObject contents under a given cursor
position.
    In XMLObject I cannot find nothing of help.
 
Does anybody have any ideas?
 
Javier
 
 


- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/