You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by Ritesh Shah <ri...@gmail.com> on 2008/12/24 06:05:57 UTC
How to delete a Child element in an XMLBeans application?
How to delete a child element in Java beans style of handling XML document
in an XMLBeans based Java application? I can't find way to deleting a child
element using Java types created by XMLBeans based on the XML Schema. I know
of doing it using XMLCursor interface.
I have attached XML Schema SchemaDel.xsd, its input data InputDel.xml, and
XMLBeans java application Delete_XmlBeans.java. This Java application logic
wants to remove the "childElement1". However, output shows that
childeElement1 is set to nil with xsi:nil="true". I was hoping for actual
output to have "childElement1" disappeared completely. How can I do that?
Thanks in advance.
Ritesh
RE: How to delete a Child element in an XMLBeans application?
Posted by Radu Preotiuc-Pietro <ra...@oracle.com>.
I haven't looked at your Schema, but for optional elements/attributes, XMLBeans will generate unsetXXX() methods, which will remove the element/attribute rather than setting it to null.
Radu
________________________________
From: Ritesh Shah [mailto:ritesh101@gmail.com]
Sent: Wednesday, December 24, 2008 12:06 AM
To: dev@xmlbeans.apache.org; xmlbeans-dev@xml.apache.org
Subject: How to delete a Child element in an XMLBeans application?
How to delete a child element in Java beans style of handling XML document in an XMLBeans based Java application? I can't find way to deleting a child element using Java types created by XMLBeans based on the XML Schema. I know of doing it using XMLCursor interface.
I have attached XML Schema SchemaDel.xsd, its input data InputDel.xml, and XMLBeans java application Delete_XmlBeans.java. This Java application logic wants to remove the "childElement1". However, output shows that childeElement1 is set to nil with xsi:nil="true". I was hoping for actual output to have "childElement1" disappeared completely. How can I do that?
Thanks in advance.
Ritesh