You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Ajay Aggarwal <aa...@covergence.com> on 2007/06/14 22:03:50 UTC
help with manipulating Xml document
Sorry this is a little long. I needed to explain myself....
I need to manipulate an XML document which follows a schema. But I don't
know of the schema beforehand. So there are no Java classes for types
defined in the schema and I don't want to generate these runtime if I
don't have to.
Our goal is to support a dynamic GUI based on whatever schema and
manipulate the XML document based on user input from the GUI.
As a result I have to add/remove XML fragments (corresponding to
types/properties in the schema).
Removing is easy. Just position the XmlCursor at the right place and
remove.
What is the best way to add XmlObjects corresponding to
types/properties? Say an object O (of some type) has an optional
property of type 'T'. If I have to add the XmlObject corresponding to
this property, what steps should I take? Should I create a new instance
of type 'T' using schemaTypeLoader? How do I insert this instance at the
right place in the original document?
I think what I am looking for is something like this
setPropertyValue (XmlObject parentObject, SchemaProperty prop,
XmlObject propValue)
where prop is a property of parentObject's SchemaType and we need to set
its value to propValue.
Thanks.
-Ajay
RE: help with manipulating Xml document
Posted by Ajay Aggarwal <aa...@covergence.com>.
Never mind. Looks like creating an ELEMENT at the right place inside
parent XmlObject does the trick; provided this new ELEMENT is as per the
SchemaType of the parent object. The XmlObject associated with the new
element is automatically of the right SchemaType.
________________________________
From: Ajay Aggarwal [mailto:aaggarwal@covergence.com]
Sent: Friday, June 15, 2007 3:40 PM
To: user@xmlbeans.apache.org
Subject: RE: help with manipulating Xml document
I am still awaiting some answers...
Essentially I need to be able to create XmlObjects corresponding to a
SchemaType and add them to an existing Xml document at the appropriate
places, all without having the actual Java classes for my SchemaTypes.
-Ajay
________________________________
From: Ajay Aggarwal [mailto:aaggarwal@covergence.com]
Sent: Thursday, June 14, 2007 4:04 PM
To: user@xmlbeans.apache.org
Subject: help with manipulating Xml document
Sorry this is a little long. I needed to explain myself....
I need to manipulate an XML document which follows a schema. But I don't
know of the schema beforehand. So there are no Java classes for types
defined in the schema and I don't want to generate these runtime if I
don't have to.
Our goal is to support a dynamic GUI based on whatever schema and
manipulate the XML document based on user input from the GUI.
As a result I have to add/remove XML fragments (corresponding to
types/properties in the schema).
Removing is easy. Just position the XmlCursor at the right place and
remove.
What is the best way to add XmlObjects corresponding to
types/properties? Say an object O (of some type) has an optional
property of type 'T'. If I have to add the XmlObject corresponding to
this property, what steps should I take? Should I create a new instance
of type 'T' using schemaTypeLoader? How do I insert this instance at the
right place in the original document?
I think what I am looking for is something like this
setPropertyValue (XmlObject parentObject, SchemaProperty prop,
XmlObject propValue)
where prop is a property of parentObject's SchemaType and we need to set
its value to propValue.
Thanks.
-Ajay
RE: help with manipulating Xml document
Posted by Ajay Aggarwal <aa...@covergence.com>.
I am still awaiting some answers...
Essentially I need to be able to create XmlObjects corresponding to a
SchemaType and add them to an existing Xml document at the appropriate
places, all without having the actual Java classes for my SchemaTypes.
-Ajay
________________________________
From: Ajay Aggarwal [mailto:aaggarwal@covergence.com]
Sent: Thursday, June 14, 2007 4:04 PM
To: user@xmlbeans.apache.org
Subject: help with manipulating Xml document
Sorry this is a little long. I needed to explain myself....
I need to manipulate an XML document which follows a schema. But I don't
know of the schema beforehand. So there are no Java classes for types
defined in the schema and I don't want to generate these runtime if I
don't have to.
Our goal is to support a dynamic GUI based on whatever schema and
manipulate the XML document based on user input from the GUI.
As a result I have to add/remove XML fragments (corresponding to
types/properties in the schema).
Removing is easy. Just position the XmlCursor at the right place and
remove.
What is the best way to add XmlObjects corresponding to
types/properties? Say an object O (of some type) has an optional
property of type 'T'. If I have to add the XmlObject corresponding to
this property, what steps should I take? Should I create a new instance
of type 'T' using schemaTypeLoader? How do I insert this instance at the
right place in the original document?
I think what I am looking for is something like this
setPropertyValue (XmlObject parentObject, SchemaProperty prop,
XmlObject propValue)
where prop is a property of parentObject's SchemaType and we need to set
its value to propValue.
Thanks.
-Ajay