Class XmlObjectBase

    • Method Detail

      • monitor

        public final Object monitor()
        Description copied from interface: XmlTokenSource
        Returns the synchronization object for the document. If concurrent multithreaded access to a document is required, the access should should be protected by synchronizing on this monitor() object. There is one monitor per XML document tree.
        Specified by:
        monitor in interface XmlTokenSource
      • copy

        public final XmlObject copy()
        Description copied from interface: XmlObject
        Returns a deep copy of this XmlObject. The returned object has the same type as the current object, and has all the content of the XML document underneath the current object. Note that any parts of the XML document above or outside this XmlObject are not copied. Note: The result object will be in the same synchronization domain as the source, and additional synchronization is required for concurent access. To use a different synchronization domain use setCopyUseNewSynchronizationDomain option with copy(XmlOptions) method.
        Specified by:
        copy in interface XmlObject
        See Also:
        XmlObject.copy(XmlOptions), XmlOptions.setCopyUseNewSynchronizationDomain(boolean)
      • copy

        public final XmlObject copy​(XmlOptions options)
        Description copied from interface: XmlObject
        Returns a deep copy of this XmlObject. The returned object has the same type as the current object, and has all the content of the XML document underneath the current object. Note that any parts of the XML document above or outside this XmlObject are not copied. Note: The result object will be in the same synchronization domain as the source, and additional synchronization is required for concurent access. To use a different synchronization domain use setCopyUseNewSynchronizationDomain option when creating the original XmlObject.
        Specified by:
        copy in interface XmlObject
        See Also:
        XmlOptions.setCopyUseNewSynchronizationDomain(boolean)
      • _copy

        public final XmlObject _copy()
        Same as copy() but unsynchronized. Warning: Using this method in mutithreaded environment can cause invalid states.
      • _copy

        public final XmlObject _copy​(XmlOptions xmlOptions)
        Same as copy() but unsynchronized. If Locale.COPY_USE_NEW_LOCALE is set in the options, a new locale will be created for the copy. Warning: Using this method in mutithreaded environment can cause invalid states.
      • newXMLInputStream

        public XMLInputStream newXMLInputStream()
        Deprecated.
        XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API.
        Description copied from interface: XmlTokenSource
        Returns a new XmlInputStream. The stream starts at the current begin-tag or begin-document position and ends at the matching end-tag or end-document. This is a fail-fast stream, so if the underlying data is changed while the stream is being read, the stream throws a ConcurrentModificationException. Throws an IllegalStateException if the XmlTokenSource is not positioned at begin-tag or begin-document (e.g., if it is at an attribute).
        Specified by:
        newXMLInputStream in interface XmlTokenSource
      • newXMLStreamReader

        public XMLStreamReader newXMLStreamReader()
        Description copied from interface: XmlTokenSource
        Returns a new XMLStreamReader. The stream starts at the current begin-tag or begin-document position and ends at the matching end-tag or end-document. This is a fail-fast stream, so if the underlying data is changed while the stream is being read, the stream throws a ConcurrentModificationException.
        Specified by:
        newXMLStreamReader in interface XmlTokenSource
      • newInputStream

        public InputStream newInputStream()
        Description copied from interface: XmlTokenSource
        Returns a new stream containing standard XML text, encoded according to the given encoding. The byte stream contains contents starting at the current begin-tag or begin-document and ending at the matching end-tag or end-document. The specified encoding is used and also emitted in a PI at the beginning of the stream. This is a fail-fast stream, so if the underlying data is changed while the stream is being read, the stream throws a ConcurrentModificationException. Throws an IllegalStateException if the XmlTokenSource is not positioned at begin-tag or begin-document (e.g., if it is at an attribute).
        Specified by:
        newInputStream in interface XmlTokenSource
      • newReader

        public Reader newReader()
        Description copied from interface: XmlTokenSource
        Returns a new character reader containing XML text. The contents of the reader represents the document contents starting at the current begin-tag or begin-document and ending at the matching end-tag or end-document. No encoding annotation will be made in the text itself. This is a fail-fast reader, so if the underlying data is changed while the reader is being read, the reader throws a ConcurrentModificationException. Throws an IllegalStateException if the XmlTokenSource is not positioned at begin-tag or begin-document (e.g., if it is at an attribute).
        Specified by:
        newReader in interface XmlTokenSource
      • getDomNode

        public Node getDomNode()
        Description copied from interface: XmlTokenSource
        Returns a W3C DOM Node containing the XML represented by this source. This is a live DOM node, not a copy. Any changes made through this node are immediately reflected in the document associated with this token source. Depending on the kind of token this XmlTokenSource represents, an appropriate node will be returned.
        Specified by:
        getDomNode in interface XmlTokenSource
      • newDomNode

        public Node newDomNode()
        Description copied from interface: XmlTokenSource
        Returns a W3C DOM Node containing the XML represented by this source. This is a copy of the XML, it is not a live with the underlying store of this token source. If this is the document node, then a Document is returned, else a DocumentFragment is returned.
        Specified by:
        newDomNode in interface XmlTokenSource
      • save

        public void save​(File file,
                         XmlOptions options)
                  throws IOException
        Description copied from interface: XmlTokenSource
        Writes the XML represented by this source to the given File. This method will save the XML declaration, including encoding information, with the XML.
        Specified by:
        save in interface XmlTokenSource
        Throws:
        IOException
      • save

        public void save​(File file)
                  throws IOException
        Description copied from interface: XmlTokenSource
        Writes the XML represented by this source to the given File. This method will save the XML declaration, including encoding information, with the XML.
        Specified by:
        save in interface XmlTokenSource
        Throws:
        IOException
      • save

        public void save​(OutputStream os)
                  throws IOException
        Description copied from interface: XmlTokenSource
        Writes the XML represented by this source to the given output stream. This method will save the XML declaration, including encoding information, with the XML.
        Specified by:
        save in interface XmlTokenSource
        Throws:
        IOException
      • dump

        public void dump()
        Description copied from interface: XmlTokenSource
        Prints to stdout the state of the document in which this token source is positioned. This is very implementation specific and may change at any time. Dump can be useful for debugging purposes. It is very different from the save methods which produce XML text which only approximates the actual state of the document.
        Specified by:
        dump in interface XmlTokenSource
      • newCursorForce

        public XmlCursor newCursorForce()
      • newCursor

        public XmlCursor newCursor()
        Description copied from interface: XmlTokenSource
        Returns a new XML cursor. A cursor provides random access to all the tokens in the XML data, plus the ability to extract strongly-typed XmlObjects for the data. If the data is not read-only, the XML cursor also allows modifications to the data. Using a cursor for the first time typically forces the XML document into memory.
        Specified by:
        newCursor in interface XmlTokenSource
      • schemaType

        public abstract SchemaType schemaType()
        Specified by:
        schemaType in interface XmlObject
        Returns:
        The schema type for this instance. This is a permanent, unchanging property of the instance.
      • instanceType

        public SchemaType instanceType()
        Description copied from interface: SimpleValue
        The same as getSchemaType unless this is a union instance or nil value.

        For unions, this returns the non-union consituent type of this instance. This type may change if setters are called that cause the instance to change to another constituent type of the union.

        For nil values, this returns null.

        Specified by:
        instanceType in interface SimpleValue
      • validate

        public boolean validate()
        Description copied from interface: XmlObject
        Does a deep validation of the entire subtree under the object, but does not validate the parents or siblings of the object if the object is in the interior of an xml tree.
        Specified by:
        validate in interface XmlObject
        Returns:
        true if the contents of this object are valid accoring to schemaType().
      • validate

        public boolean validate​(XmlOptions options)
        Description copied from interface: XmlObject

        Just like validate(), but with options.

        If you wish to collect error messages and locations while validating, use the XmlOptions.setErrorListener(java.util.Collection) method. With that method, you can specify an object in which to store messages related to validation. The following is a simple example.

         // Create an XmlOptions instance and set the error listener.
         XmlOptions validateOptions = new XmlOptions();
         ArrayList errorList = new ArrayList();
         validateOptions.setErrorListener(errorList);
         
         // Validate the XML.
         boolean isValid = newEmp.validate(validateOptions);
         
         // If the XML isn't valid, loop through the listener's contents,
         // printing contained messages.
         if (!isValid)
         {
              for (int i = 0; i < errorList.size(); i++)
              {
                  XmlError error = (XmlError)errorList.get(i);
                  
                  System.out.println("\n");
                  System.out.println("Message: " + error.getMessage() + "\n");
                  System.out.println("Location of invalid XML: " + 
                      error.getCursorLocation().xmlText() + "\n");
              }
         }
         
        Specified by:
        validate in interface XmlObject
        Parameters:
        options - An object that implements the Collection interface.
        Returns:
        true if the contents of this object are valid accoring to schemaType().
      • selectPath

        public XmlObject[] selectPath​(String path)
        Description copied from interface: XmlObject
        Selects a path. Path can be a string or precompiled path String.

        The path must be a relative path, where "." represents the element or attribute containg this XmlObject, and it must select only other elements or attributes. If a non-element or non-attribute is selected, an unchecked exception is thrown.

        The array that is returned contains all the selected XmlObjects, within the same document, listed in document order. The actual array type of the result is inferred from the closest common base type of selected results.

        Here is an example of usage. Suppose we have a global element definition for "owner" whose type is "person":

           <schema targetNamespace="http://openuri.org/sample">
              <element name="owner" type="person"/>
              <complexType name="person">
                 [...]
              </complexType>
           </schema>
         
        and suppose "owner" tags can be scattered throughout the document. Then we can write the following code to find them all:
         import org.openuri.sample.Person;
         import org.apache.xmlbeans.*;
         [...]
           XmlObject xobj = XmlObject.Factory.parse(myFile);
           Person[] results;
           results = (Person[])xobj.selectPath(
              "declare namespace s='http://www.openuri.org/sample' " +
              ".//s:owner");
         
        Notice the way in which namespace declarations are done in XPath 2.0. Since XPath can only navigate within an XML document - it cannot construct new XML - the resulting XmlObjects all reside in the same XML document as this XmlObject itself.
        Specified by:
        selectPath in interface XmlObject
        Parameters:
        path - the xpath
        Returns:
        an array of all selected XmlObjects
      • execQuery

        public XmlObject[] execQuery​(String path)
        Description copied from interface: XmlObject
        Executes a query. Query can be a string or precompiled query String.

        An XQuery is very similar to an XPath, except that it also permits construction of new XML. As a result, the XmlObjects that are returned from execQuery are in newly created documents, separate from the XmlObject on which the query is executed.

        Syntax and usage is otherwise similar to selectPath.

        Specified by:
        execQuery in interface XmlObject
        Parameters:
        path - The XQuery expression
        Returns:
        an array of all selected XmlObjects
        See Also:
        XmlObject.selectPath(String)
      • changeType

        public XmlObject changeType​(SchemaType type)
        Description copied from interface: XmlObject
        Changes the schema type associated with this data and returns a new XmlObject instance whose schemaType is the new type.

        Returns the new XmlObject if the type change was successful, the old XmlObject if no changes could be made.

        Certain type changes may be prohibited in the interior of an xml tree due to schema type system constraints (that is, due to a parent container within which the newly specified type is not permissible), but there are no constraints at the roottype changes are never prohibited at the root of an xml tree.

        If the type change is allowed, then the new XmlObject should be used rather than the old one. The old XmlObject instance and any other XmlObject instances in the subtree are permanently invalidated and should not be used. (They will return XmlValueDisconnectedException if you try to use them.) If a type change is done on the interior of an Xml tree, then xsi:type attributes are updated as needed.

        Specified by:
        changeType in interface XmlObject
        Returns:
        a new XmlObject instance whose schemaType is the new type
      • substitute

        public XmlObject substitute​(QName name,
                                    SchemaType type)
        Description copied from interface: XmlObject
        Changes the schema type associated with this data using substitution groups and returns an XmlObject instance whose schemaType is the new type and container name is the new name.

        Returns the new XmlObject if the substitution was successful, the old XmlObject if no changes could be made.

        In order for the operation to succeed, several conditions must hold:

        • the container of this type must be an element
        • a global element with the name newName must exist and must be in the substition group of the containing element
        • the newType type must be consistent with the declared type of the new element

        If the type change is allowed, then the new XmlObject should be used rather than the old one. The old XmlObject instance and any other XmlObject instances in the subtree are permanently invalidated and should not be used. (They will return XmlValueDisconnectedException if you try to use them.) If necessary, xsi:type attributes are updated.

        Specified by:
        substitute in interface XmlObject
        Parameters:
        name - the new name
        type - the new type
        Returns:
        an XmlObject instance whose schemaType is the new type and container name is the new name
      • setValidateOnSet

        public void setValidateOnSet()
      • isNil

        public final boolean isNil()
        True if the value is nilled.
        Specified by:
        isNil in interface XmlObject
        Returns:
        true if the value is nil.
      • isFixed

        public final boolean isFixed()
        True if the value is fixed.
      • isNillable

        public final boolean isNillable()
        True if the value is allowed to be nil.
      • isDefaultable

        public final boolean isDefaultable()
        True if the value is currently defaulted.
      • isDefault

        public final boolean isDefault()
        True if the value is currently defaulted.
      • setNil

        public final void setNil()
        Nils the value.
        Specified by:
        setNil in interface XmlObject
      • setImmutable

        public void setImmutable()
        Used to make a free-standing xml simple value instance immutable. This is a one-way street, and it is illegal to attempt to make a value that is embedded in an xml document immutable. Once a value is marked as immutable, it is illegal to call setters of any kind.
      • isImmutable

        public boolean isImmutable()
        Is this instance an immutable value?
        Specified by:
        isImmutable in interface XmlObject
        Returns:
        true if the value is an immutable value.
      • attach_store

        public final void attach_store​(TypeStore store)
        Called to initialize the TypeStore associated with this XmlObject implementation. If not called, this is a free-floating value holder. When a value is first attached, it is put in a completely invalidated state.
        Specified by:
        attach_store in interface TypeStoreUser
      • invalidate_value

        public final void invalidate_value()
        Called by a TypeStore to indicate that the text has been invalidated and should be fetched next time the value is needed.
        Specified by:
        invalidate_value in interface TypeStoreUser
      • uses_invalidate_value

        public final boolean uses_invalidate_value()
        Description copied from interface: TypeStoreUser
        A store can call uses_invalidate_value to know if calls to invalidate_value will be fruitful. If uses_invalidate_value returns false, invalidate_value need never be called.
        Specified by:
        uses_invalidate_value in interface TypeStoreUser
      • invalidate_nilvalue

        public final void invalidate_nilvalue()
        Called by a TypeStore to indicate that the xsi:nil attribute on the containing element (and possibly the text) has been invalidated and both should be consulted next time the value is needed.
        Specified by:
        invalidate_nilvalue in interface TypeStoreUser
      • invalidate_element_order

        public final void invalidate_element_order()
        Called by a TypeStore to indicate that the element's default value, nillability, fixedness, etc, may have changed by virtue of the element order changing (and xsi:nil and the text may have changed too); so the store should be consulted next time any setter or getter is called.
        Specified by:
        invalidate_element_order in interface TypeStoreUser
      • get_store

        public final TypeStore get_store()
        Used by the ComplexTypeImpl subclass to get direct access to the store.
        Specified by:
        get_store in interface TypeStoreUser
      • getXmlLocale

        public final XmlLocale getXmlLocale()
      • build_text

        public final String build_text​(NamespaceManager nsm)
        Called by a TypeStore to pull out the most reasonable text value from us. This is done after we have invalidated the store (typically when our value has been set).
        Specified by:
        build_text in interface TypeStoreUser
      • build_nil

        public boolean build_nil()
        A store will call back on build_nil after we've called invalidate_nil and it needs to know what the nil value is.
        Specified by:
        build_nil in interface TypeStoreUser
      • validate_now

        public void validate_now()
        A store will call back on validate_now to force us to look at the text if we're in an invalid state. We're allowed to throw an exception if the text isn't valid for our type.
        Specified by:
        validate_now in interface TypeStoreUser
      • disconnect_store

        public void disconnect_store()
        A store calls back here in order to force a disconnect. After this is done, the object should be considered invalid. Any attempt to access or set a value should result in an exception. Note that this is how we handle deletions and xsi:type changes.
        Specified by:
        disconnect_store in interface TypeStoreUser
      • create_element_user

        public TypeStoreUser create_element_user​(QName eltName,
                                                 QName xsiType)
        A typestore user can create a new TypeStoreUser instance for a given element child name as long as you also pass the qname contained by the xsi:type attribute, if any. Note that we will ignore the xsiType if it turns out to be invalid. Returns null if there is no strongly typed information for that given element (which implies, recusively, no strongly typed information downwards).
        Specified by:
        create_element_user in interface TypeStoreUser
      • create_attribute_user

        public TypeStoreUser create_attribute_user​(QName attrName)
        A typestore user can create a new TypeStoreUser instance for a given attribute child, based on the attribute name. Returns null if there is no strongly typed information for that given attributes.
        Specified by:
        create_attribute_user in interface TypeStoreUser
      • get_default_element_text

        public String get_default_element_text​(QName eltName)
        Returns the default element text, if it's consistent. If it's not consistent, returns null, and requires a visitor walk. Also returns null if there is no default at all (although that can also be discovered via get_elementflags without doing a walk).
        Specified by:
        get_default_element_text in interface TypeStoreUser
      • get_default_attribute_text

        public String get_default_attribute_text​(QName attrName)
        Returns the default attribute text for the attribute with the given name, or null if no default.
        Specified by:
        get_default_attribute_text in interface TypeStoreUser
      • get_elementflags

        public int get_elementflags​(QName eltName)
        Returns the elementflags, if they're consistent. If they're not, returns -1, and requires a vistor walk.
        Specified by:
        get_elementflags in interface TypeStoreUser
      • is_child_element_order_sensitive

        public boolean is_child_element_order_sensitive()
        Returns false if child elements are insensitive to order; if it returns true, you're required to call invalidate_element_order on children to the right of any child order rearrangement.
        Specified by:
        is_child_element_order_sensitive in interface TypeStoreUser
      • get_element_ending_delimiters

        public final QNameSet get_element_ending_delimiters​(QName eltname)
        Inserting a new element is always unambiguous except in one situation: when adding an element after the last one with that name (or the first one if there are none). In that case, add the element at the first possible slot BEFORE any element whose qname is contained in the QNameSet given. (If the QNameSet is empty, that means add the new element at the very end.) If the returned QNameSet is null, treat it as if the QNameSet contained all QNames, i.e., add the new element at the very first position possible (adjacent to the last element of the same name, or at the very first slot if it is the first elt with that name).
        Specified by:
        get_element_ending_delimiters in interface TypeStoreUser
      • new_visitor

        public TypeStoreVisitor new_visitor()
        A typestore user can return a visitor that is used to compute default text and elementflags for an arbitrary element.
        Specified by:
        new_visitor in interface TypeStoreUser
      • check_dated

        public final void check_dated()
        Called prior to every get operation, to ensure that the value being read is valid. If the value has been invalidated, it is re-read from the underlying text store, and this may cause an out of range exception. This method deals with nils, nillability, defaults, etc.
      • get_wscanon_text

        public final String get_wscanon_text()
        Grabs the undelying litral representation, applying the implementation's wscanon rule. Null if not simple content.
      • getFloatValue

        public float getFloatValue()
        Description copied from interface: SimpleValue
        Returns the value as a float.
        Specified by:
        getFloatValue in interface SimpleValue
      • getDoubleValue

        public double getDoubleValue()
        Description copied from interface: SimpleValue
        Returns the value as a double.
        Specified by:
        getDoubleValue in interface SimpleValue
      • getByteValue

        public byte getByteValue()
        Description copied from interface: SimpleValue
        Returns the value as a byte.
        Specified by:
        getByteValue in interface SimpleValue
      • getShortValue

        public short getShortValue()
        Description copied from interface: SimpleValue
        Returns the value as a short.
        Specified by:
        getShortValue in interface SimpleValue
      • getIntValue

        public int getIntValue()
        Description copied from interface: SimpleValue
        Returns the value as an int.
        Specified by:
        getIntValue in interface SimpleValue
      • getLongValue

        public long getLongValue()
        Description copied from interface: SimpleValue
        Returns the value as a long.
        Specified by:
        getLongValue in interface SimpleValue
      • toString

        public final String toString()
        Description copied from interface: XmlObject
        The string is pretty-printed. If you want a non-pretty-printed string, or if you want to control options precisely, use the xmlText() methods.

        Note that when producing XML any object other than very root of the document, then you are guaranteed to be looking at only a fragment of XML, i.e., just the contents of an element or attribute, and and we will produce a string that starts with an <xml-fragment> tag. The XmlOptions.setSaveOuter() option on xmlText can be used to produce the actual element name above the object if you wish.

        Specified by:
        toString in interface XmlObject
        Overrides:
        toString in class Object
        Returns:
        a XML string for this XML object.
      • xmlText

        public String xmlText()
        Description copied from interface: XmlTokenSource
        Returns standard XML text.

        The text returned represents the document contents starting at the current begin-tag or begin-document and ending at the matching end-tag or end-document. This is same content as newReader, but it is returned as a single string.

        Throws an IllegalStateException if the XmlTokenSource is not positioned at begin-tag or begin-document (e.g., if it is at an attribute).

        Note that this method does not produce XML with the XML declaration, including the encoding information. To save the XML declaration with the XML, see XmlTokenSource.save(OutputStream) or XmlTokenSource.save(OutputStream, XmlOptions).

        Specified by:
        xmlText in interface XmlTokenSource
      • listValue

        public List listValue()
        Deprecated.
        replaced with getListValue()
        Description copied from interface: SimpleValue
        Returns the value as a List of friendly Java objects (String, Integer, Byte, Short, Long, BigInteger, Decimal, Float, Double, byte[], Calendar, GDuration). *
        Specified by:
        listValue in interface SimpleValue
      • objectValue

        public Object objectValue()
        Deprecated.
        replaced with getObjectValue()
        Description copied from interface: SimpleValue
        Returns a union value as a its natural friendly Java object (String, Integer, Byte, Short, Long, BigInteger, Decimal, Float, Double, byte[], Calendar, GDuration). *
        Specified by:
        objectValue in interface SimpleValue
      • getByteArrayValue

        public byte[] getByteArrayValue()
        Description copied from interface: SimpleValue
        Returns the value as a byte array.
        Specified by:
        getByteArrayValue in interface SimpleValue
      • getBooleanValue

        public boolean getBooleanValue()
        Description copied from interface: SimpleValue
        Returns the value as a boolean.
        Specified by:
        getBooleanValue in interface SimpleValue
      • getListValue

        public List getListValue()
        Description copied from interface: SimpleValue
        Returns the value as a List of friendly Java objects (String, Integer, Byte, Short, Long, BigInteger, Decimal, Float, Double, byte[], Calendar, GDuration).
        Specified by:
        getListValue in interface SimpleValue
      • getObjectValue

        public Object getObjectValue()
        Description copied from interface: SimpleValue
        Returns a union value as a its natural friendly Java object (String, Integer, Byte, Short, Long, BigInteger, Decimal, Float, Double, byte[], Calendar, GDuration).
        Specified by:
        getObjectValue in interface SimpleValue
      • setBooleanValue

        public final void setBooleanValue​(boolean v)
        Description copied from interface: SimpleValue
        Sets the value as a boolean.
        Specified by:
        setBooleanValue in interface SimpleValue
      • setByteValue

        public final void setByteValue​(byte v)
        Description copied from interface: SimpleValue
        Sets the value as a byte.
        Specified by:
        setByteValue in interface SimpleValue
      • setShortValue

        public final void setShortValue​(short v)
        Description copied from interface: SimpleValue
        Sets the value as a short.
        Specified by:
        setShortValue in interface SimpleValue
      • setIntValue

        public final void setIntValue​(int v)
        Description copied from interface: SimpleValue
        Sets the value as an int.
        Specified by:
        setIntValue in interface SimpleValue
      • setLongValue

        public final void setLongValue​(long v)
        Description copied from interface: SimpleValue
        Sets the value as a long.
        Specified by:
        setLongValue in interface SimpleValue
      • setFloatValue

        public final void setFloatValue​(float v)
        Description copied from interface: SimpleValue
        Sets the value as a float.
        Specified by:
        setFloatValue in interface SimpleValue
      • setDoubleValue

        public final void setDoubleValue​(double v)
        Description copied from interface: SimpleValue
        Sets the value as a double.
        Specified by:
        setDoubleValue in interface SimpleValue
      • setByteArrayValue

        public final void setByteArrayValue​(byte[] obj)
        Description copied from interface: SimpleValue
        Sets the value as a byte array.
        Specified by:
        setByteArrayValue in interface SimpleValue
      • set_newValue

        public final void set_newValue​(XmlObject obj)
      • set

        public final XmlObject set​(XmlObject src)
        Description copied from interface: XmlObject
        Set the value/type of this XmlObject to be a copy of the source XmlObject. Because the type of the source may be different than this target, this XmlObject may become defunct. In this case the new XmlObject is returned. If no type change happens, the same this will be returned.
        Specified by:
        set in interface XmlObject
      • generatedSetterHelperImpl

        public final XmlObject generatedSetterHelperImpl​(XmlObject src,
                                                         QName propName,
                                                         int index,
                                                         short kindSetterHelper)
      • _set

        public final XmlObject _set​(XmlObject src)
        Same as set() but unsynchronized. Warning: Using this method in mutithreaded environment can cause invalid states.
      • valueEquals

        public final boolean valueEquals​(XmlObject xmlobj)
        Description copied from interface: XmlObject
        True if the xml values are equal. Two different objects (which are distinguished by equals(obj) == false) may of course have equal values (valueEquals(obj) == true).

        Usually this method can be treated as an ordinary equvalence relation, but actually it is not is not transitive. Here is a precise specification:

        There are two categories of XML object: objects with a known instance type, and objects whose only known type is one of the ur-types (either AnyType or AnySimpleType). The first category is compared in terms of logical value spaces, and the second category is compared lexically.

        Within each of these two categories, valueEquals is a well-behaved equivalence relation. However, when comparing an object of known type with an object with ur-type, the comparison is done by attempting to convert the lexical form of the ur-typed object into the other type, and then comparing the results. Ur-typed objects are therefore treated as lexical wildcards and may be equal to objects in different value spaces, even though the objects in different value spaces are not equal to each other.

        For example, the anySimpleType value "1" will compare as an equalValue to the string "1", the float value "1.0", the double value "1.0", the decimal "1", and the GYear "1", even though all these objects will compare unequal to each other since they lie in different value spaces. Note: as of XMLBeans 2.2.1 only implemented for simple type values.

        Specified by:
        valueEquals in interface XmlObject
      • compareTo

        public final int compareTo​(Object obj)
        Implements Comparable. This compareTo is inconsistent with equals unless isImmutable() is true.
        Specified by:
        compareTo in interface XmlObject
      • compareValue

        public final int compareValue​(XmlObject xmlobj)
        Description copied from interface: XmlObject
        This comparison method is similar to compareTo, but rather than throwing a ClassCastException when two values are incomparable, it returns the number 2. The result codes are -1 if this object is less than obj, 1 if this object is greater than obj, zero if the objects are equal, and 2 if the objects are incomparable.
        Specified by:
        compareValue in interface XmlObject
      • isInstanceOf

        public boolean isInstanceOf​(SchemaType type)
      • equals

        public final boolean equals​(Object obj)
        Overrides:
        equals in class Object
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class Object
      • selectChildren

        public XmlObject[] selectChildren​(QName elementName)
        Selects the contents of the children elements with the given name.
        Specified by:
        selectChildren in interface XmlObject
        Parameters:
        elementName - The name of the elements to be selected.
        Returns:
        Returns the contents of the selected elements.
      • selectChildren

        public XmlObject[] selectChildren​(String elementUri,
                                          String elementLocalName)
        Selects the contents of the children elements with the given name.
        Specified by:
        selectChildren in interface XmlObject
        Parameters:
        elementUri - The URI of the elements to be selected.
        elementLocalName - The local name of the elements to be selected.
        Returns:
        Returns the contents of the selected elements.
      • selectAttribute

        public XmlObject selectAttribute​(QName attributeName)
        Selects the content of the attribute with the given name.
        Specified by:
        selectAttribute in interface XmlObject
        Parameters:
        attributeName - The name of the attribute to be selected.
        Returns:
        Returns the contents of the selected attribute.
      • selectAttribute

        public XmlObject selectAttribute​(String attributeUri,
                                         String attributeLocalName)
        Selects the content of the attribute with the given name.
        Specified by:
        selectAttribute in interface XmlObject
        Parameters:
        attributeUri - The URI of the attribute to be selected.
        attributeLocalName - The local name of the attribute to be selected.
        Returns:
        Returns the content of the selected attribute.
      • writeReplace

        public Object writeReplace()
        This method can writeReplace either an unwrapped XmlObjectBase or an XBean proxy. A "true" argument means unwrapped. The serialization strategy for XmlObjects is this: (1) Only the root XmlObject for a document actually gets fully serialized; it is serialized as a SerializedRootObject, which simply saves itself as XML text. (2) Interior XmlObjects get serialized as a reference to the root XmlObject for their document, plus an integer which indicates the position of the XmlObject within the owner document. This pair is stored as a SerializedInteriorObject. Both objects can be maked as wrapped or unwrapped. If wrapped, then the proxy is returned when deserializing; if unwrapped, then the proxy is stripped when deserializing.