You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by Ronny Priv <ro...@gmx.de> on 2008/05/14 16:20:36 UTC

XmlSchema: How does manipulating/creating work?

Hello,

the XmlSchema tutorial explains how to read, navigate and print a schema but I don't understand how to manipulate it. I couldn't even find an information about that via Google.

You describe how to get e.g. a Type node.
XmlSchemaType schemaType = schema.getTypeByName("MyType1");

Ok, and via debugging I know there is a a sequence with my element-items attached but there is no add-method to add a new XmlSchemaElement to the sequence. I couldn't even find a getter for the sequence collection I want to manipulate.

Could you help me out here, please?

Thanks
Ronny
-- 
249 Spiele für nur 1 Preis. Die GMX Spieleflatrate schon ab 9,90 Euro.
Neu: Asterix bei den Olympischen Spielen: http://flat.games.gmx.de

Re: XmlSchema: How does manipulating/creating work?

Posted by Ronny Priv <ro...@gmx.de>.
Thank you, dims. 
Though the javadocs don't tell too much it was enough impact for solving my problem. The reason why I coudn't find any getter was because I did not use the correct subtype.

XmlSchemaComplexType schemaType = (XmlSchemaComplexType) schema.getTypeByName("MyType1");
XmlSchemaSequence particle = (XmlSchemaSequence) schemaType.getParticle();
particle.getItems().add(newElement);

best regards
ronny

-------- Original-Nachricht --------
> > Hello,
> >
> > the XmlSchema tutorial explains how to read, navigate and print a schema
> but I don't understand how to manipulate it. I couldn't even find an
> information about that via Google.
> >
> > You describe how to get e.g. a Type node.
> > XmlSchemaType schemaType = schema.getTypeByName("MyType1");
> >
> > Ok, and via debugging I know there is a a sequence with my element-items
> attached but there is no add-method to add a new XmlSchemaElement to the
> sequence. I couldn't even find a getter for the sequence collection I want
> to manipulate.
> >
> > Could you help me out here, please?
> >
> > Thanks
> > Ronny

-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser

Re: XmlSchema: How does manipulating/creating work?

Posted by Davanum Srinivas <da...@gmail.com>.
schema.getElements().add()

plz check the api docs
http://ws.apache.org/commons/XmlSchema/apidocs/index.html

thanks,
dims

On Wed, May 14, 2008 at 10:20 AM, Ronny Priv <ro...@gmx.de> wrote:
> Hello,
>
> the XmlSchema tutorial explains how to read, navigate and print a schema but I don't understand how to manipulate it. I couldn't even find an information about that via Google.
>
> You describe how to get e.g. a Type node.
> XmlSchemaType schemaType = schema.getTypeByName("MyType1");
>
> Ok, and via debugging I know there is a a sequence with my element-items attached but there is no add-method to add a new XmlSchemaElement to the sequence. I couldn't even find a getter for the sequence collection I want to manipulate.
>
> Could you help me out here, please?
>
> Thanks
> Ronny
> --
> 249 Spiele für nur 1 Preis. Die GMX Spieleflatrate schon ab 9,90 Euro.
> Neu: Asterix bei den Olympischen Spielen: http://flat.games.gmx.de
>



-- 
Davanum Srinivas :: http://davanum.wordpress.com