xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Xmlbeans Wiki] Update of "XmlBeansFaq" by fx
Date Wed, 21 Aug 2013 17:01:02 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Xmlbeans Wiki" for change notification.

The "XmlBeansFaq" page has been changed by fx:

Added new Question: Why am I getting XmlValueDisconnectedException when I try to change an

    * [[#execQuery|Is execQuery(...) on XmlObject and XmlCursor working?]]
    * [[#xsdConfig|How do I modify the generated interfaces?]]
    * [[#cdataOptions|How do I control CDATA?]]
+   * [[#xmlValueDisconnectedException|Why am I getting XmlValueDisconnectedException when
I try to change an XmlObject?]]
   * '''[[#somQuestions|Schema Object Model Questions]] '''
    * [[#introToSTS|Is there an introduction document on the XMLBeans Schema Type System?]]
@@ -296, +297 @@

  Use CDATA options. Learn more here - CdataOptions.
+ <<Anchor(xmlValueDisconnectedException)>> '''Why am I getting !XmlValueDisconnectedException
when I try to change an XmlObject?'''
+ The cause is that the XmlObject is an orphan; i.e., it has become disassociated from the
XML store.  This can happen if you get a reference to an object (perhaps by fetching the first
item in an array), delete the item from the tree (perhaps by calling the array remove method
on element 0), and then try to invoke methods on that reference or any of its child elements.
 You cannot even invoke the toString() method on an orphaned object!  If you need to keep
a deleted object, make a copy before you delete it. For example:
+ {{{
+        LineItem nl = p.getLineItemArray(0).copy();
+        p.removeLineItem(0);
+ }}}
@@ -330, +341 @@

  In a few words, the difference is that !SchemaProperty represents a "flattened", simplified
view of the contents of a type, while !SchemaParticle represents a "complete" view including
all of the model groups, as defined in Schema. To exemplify, consider the following Schema:
+ {{{
- {{{<xs:complexType name="T">
+ <xs:complexType name="T">
   . <xs:sequence>
    . <xs:element name="a" type="xs:string"/> <xs:choice>
@@ -338, +350 @@

- </xs:complexType>}}}
+ </xs:complexType>
+ }}}
  As you can see, this content mandates an <a> element in the instance, followed by
either one or more <a>s or one or more <b>s (a (a+|b+)). The majority of applications
would only be interested in what are the names and types of elements allowed inside the content
for type "T" and would not care whether there are nested sequeces/choices and the like. As
such, they can use {{{SchemaType.getProperties()}}} and they will see two entries, one for
element "a" (built by collapsing the two occurences of an "a" element in the Schema) and one
for element "b".

To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org

View raw message