org.apache.xmlbeans
Class FilterXmlObject

java.lang.Object
  extended byorg.apache.xmlbeans.FilterXmlObject
All Implemented Interfaces:
DelegateXmlObject, SimpleValue, XmlObject, XmlTokenSource

public abstract class FilterXmlObject
extends Object
implements XmlObject, SimpleValue, DelegateXmlObject

A FilterXmlObject delegates to some other XmlObject, which it can use as its basic source of data, possibly transforming the data along the way or providing additional functionality. The class FilterXmlObject itself simply overrides all methods of XmlObject with versions that pass all requests to the underlying XmlObject. Subclasses of FilterXmlObject may further override some of these methods and may also provide additional methods and fields.

Note: it is important that FilterXmlObject has no storage (i.e., no non-transient fields), because subclasses may be serializable and adding storage would break the serialization format.


Nested Class Summary
 
Nested classes inherited from class org.apache.xmlbeans.XmlObject
XmlObject.Factory
 
Field Summary
 
Fields inherited from interface org.apache.xmlbeans.XmlObject
EQUAL, GREATER_THAN, LESS_THAN, NOT_EQUAL, type
 
Constructor Summary
FilterXmlObject()
           
 
Method Summary
 BigDecimal bigDecimalValue()
          Returns the value as a BigDecimal.
 BigInteger bigIntegerValue()
          Returns the value as a BigInteger.
 boolean booleanValue()
          Returns the value as a boolean.
 byte[] byteArrayValue()
          Returns the value as a byte array.
 byte byteValue()
          Returns the value as a byte.
 Calendar calendarValue()
          Returns the value as a Calendar.
 XmlObject changeType(SchemaType newType)
          Changes the schema type associated with this data and returns a new XmlObject instance whose schemaType is the new type.
 int compareTo(Object obj)
          Impelements the Comparable interface by comparing two simple xml values based on their standard XML schema ordering.
 int compareValue(XmlObject obj)
          This comparison method is similar to compareTo, but rather than throwing a ClassCastException when two values are incomparable, it returns the number 2.
 XmlObject copy()
          Returns a deep copy of this XmlObject.
 Date dateValue()
          Returns the value as a Date.
 XmlDocumentProperties documentProperties()
          Returns the XmlDocumentProperties object for the document this token source is associated with.
 double doubleValue()
          Returns the value as a double.
 StringEnumAbstractBase enumValue()
          Returns the value as a StringEnumAbstractBase.
 XmlObject[] execQuery(String query)
          Executes a query.
 XmlObject[] execQuery(String query, XmlOptions options)
          Executes a query with options.
 float floatValue()
          Returns the value as a float.
 GDate gDateValue()
          Returns the value as a GDate.
 GDuration gDurationValue()
          Returns the value as a GDuration.
 BigDecimal getBigDecimalValue()
          Returns the value as a BigDecimal.
 BigInteger getBigIntegerValue()
          Returns the value as a BigInteger.
 boolean getBooleanValue()
          Returns the value as a boolean.
 byte[] getByteArrayValue()
          Returns the value as a byte array.
 byte getByteValue()
          Returns the value as a byte.
 Calendar getCalendarValue()
          Returns the value as a Calendar.
 Date getDateValue()
          Returns the value as a Date.
 Node getDomNode()
          Returns a W3C DOM Node containing the XML represented by this source.
 double getDoubleValue()
          Returns the value as a double.
 StringEnumAbstractBase getEnumValue()
          Returns the value as a StringEnumAbstractBase.
 float getFloatValue()
          Returns the value as a float.
 GDate getGDateValue()
          Returns the value as a GDate.
 GDuration getGDurationValue()
          Returns the value as a GDuration.
 int getIntValue()
          Returns the value as an int.
 List getListValue()
          Returns the value as a List of friendly Java objects (String, Integer, Byte, Short, Long, BigInteger, Decimal, Float, Double, byte[], Calendar, GDuration).
 long getLongValue()
          Returns the value as a long.
 Object getObjectValue()
          Returns a union value as a its natural friendly Java object (String, Integer, Byte, Short, Long, BigInteger, Decimal, Float, Double, byte[], Calendar, GDuration).
 QName getQNameValue()
          Returns the value as a QName.
 short getShortValue()
          Returns the value as a short.
 String getStringValue()
          Returns the value as a String.
 SchemaType instanceType()
          The same as getSchemaType unless this is a union instance or nil value.
 int intValue()
          Returns the value as an int.
 boolean isImmutable()
          True if the value is an immutable value.
 boolean isNil()
          True if the value is nil.
 List listValue()
          Returns the value as a List of friendly Java objects (String, Integer, Byte, Short, Long, BigInteger, Decimal, Float, Double, byte[], Calendar, GDuration).
 long longValue()
          Returns the value as a long.
 Object monitor()
          Returns the synchronization object for the document.
 XmlCursor newCursor()
          Returns a new XML cursor.
 Node newDomNode()
          Returns a W3C DOM Node containing the XML represented by this source.
 Node newDomNode(XmlOptions options)
          Just like newDomNode() but with options.
 InputStream newInputStream()
          Returns a new stream containing standard XML text, encoded according to the given encoding.
 InputStream newInputStream(XmlOptions options)
          Just like newInputStream(String encoding) but with options.
 Reader newReader()
          Returns a new character reader containing XML text.
 Reader newReader(XmlOptions options)
          Just like newReader() but with options.
 org.apache.xmlbeans.xml.stream.XMLInputStream newXMLInputStream()
          Returns a new XmlInputStream.
 org.apache.xmlbeans.xml.stream.XMLInputStream newXMLInputStream(XmlOptions options)
          Just like newXMLInputStream() but with any of a number of options.
 XMLStreamReader newXMLStreamReader()
          Returns a new XMLStreamReader.
 XMLStreamReader newXMLStreamReader(XmlOptions options)
          Just like newXMLInputStream() but with options.
 void objectSet(Object obj)
          Sets the value as an arbitrary Object.
 Object objectValue()
          Returns a union value as a its natural friendly Java object (String, Integer, Byte, Short, Long, BigInteger, Decimal, Float, Double, byte[], Calendar, GDuration).
 QName qNameValue()
          Returns the value as a QName.
 void save(ContentHandler ch, LexicalHandler lh)
          Writes the XML represented by this source to the given SAX content and lexical handlers.
 void save(ContentHandler ch, LexicalHandler lh, XmlOptions options)
          Writes the XML represented by this source to the given SAX content and lexical handlers.
 void save(File file)
          Writes the XML represented by this source to the given File.
 void save(File file, XmlOptions options)
          Writes the XML represented by this source to the given File.
 void save(OutputStream os)
          Writes the XML represented by this source to the given output stream.
 void save(OutputStream os, XmlOptions options)
          Writes the XML represented by this source to the given output stream.
 void save(Writer w)
          Writes the XML represented by this source to the given output.
 void save(Writer w, XmlOptions options)
          Writes the XML represented by this source to the given output.
 SchemaType schemaType()
          The schema type for this instance.
 XmlObject selectAttribute(QName attributeName)
          Selects the content of the attribute with the given name.
 XmlObject selectAttribute(String attributeUri, String attributeLocalName)
          Selects the content of the attribute with the given name.
 XmlObject[] selectAttributes(QNameSet attributeNameSet)
          Selects the contents of the attributes that are contained in the elementNameSet.
 XmlObject[] selectChildren(QName elementName)
          Selects the contents of the children elements with the given name.
 XmlObject[] selectChildren(QNameSet elementNameSet)
          Selects the contents of the children elements that are contained in the elementNameSet.
 XmlObject[] selectChildren(String elementUri, String elementLocalName)
          Selects the contents of the children elements with the given name.
 XmlObject[] selectPath(String path)
          Selects a path.
 XmlObject[] selectPath(String path, XmlOptions options)
          Selects a path, applying options.
 void set(BigDecimal obj)
          Sets the value as a BigDecimal
 void set(BigInteger obj)
          Sets the value as a BigInteger.
 void set(boolean v)
          Sets the value as a boolean.
 void set(byte v)
          Sets the value as a byte.
 void set(byte[] obj)
          Sets the value as a byte array.
 void set(Calendar obj)
          Sets the value as a Calendar.
 void set(Date obj)
          Sets the value as a Date.
 void set(double v)
          Sets the value as a double.
 void set(float v)
          Sets the value as a float.
 void set(GDateSpecification obj)
          Sets the value as a GDate.
 void set(GDurationSpecification obj)
          Sets the value as a GDuration.
 void set(int v)
          Sets the value as an int.
 void set(List obj)
          Sets the value as a List.
 void set(long v)
          Sets the value as a long.
 void set(QName obj)
          Sets the value as a QName.
 void set(short v)
          Sets the value as a short.
 void set(String obj)
          Sets the value as a String.
 void set(StringEnumAbstractBase obj)
          Sets the value as a StringEnumAbstractBase.
 XmlObject set(XmlObject srcObj)
          Set the value/type of this XmlObject to be a copy of the source XmlObject.
 void setBigDecimalValue(BigDecimal obj)
          Sets the value as a BigDecimal.
 void setBigIntegerValue(BigInteger obj)
          Sets the value as a BigInteger.
 void setBooleanValue(boolean v)
          Sets the value as a boolean.
 void setByteArrayValue(byte[] obj)
          Sets the value as a byte array.
 void setByteValue(byte v)
          Sets the value as a byte.
 void setCalendarValue(Calendar obj)
          Sets the value as a Calendar.
 void setDateValue(Date obj)
          Sets the value as a Date.
 void setDoubleValue(double v)
          Sets the value as a double.
 void setEnumValue(StringEnumAbstractBase obj)
          Sets the value as a StringEnumAbstractBase.
 void setFloatValue(float v)
          Sets the value as a float.
 void setGDateValue(GDate obj)
          Sets the value as a GDate.
 void setGDurationValue(GDuration obj)
          Sets the value as a GDuration.
 void setIntValue(int v)
          Sets the value as an int.
 void setListValue(List obj)
          Sets the value as a List.
 void setLongValue(long v)
          Sets the value as a long.
 void setNil()
          Sets the value to nil.
 void setObjectValue(Object obj)
          Sets the value as an arbitrary Object.
 void setQNameValue(QName obj)
          Sets the value as a QName.
 void setShortValue(short v)
          Sets the value as a short.
 void setStringValue(String obj)
          Sets the value as a String.
 short shortValue()
          Returns the value as a short.
 String stringValue()
          Returns the value as a String.
 boolean validate()
          Returns true if the contents of this object are valid accoring to schemaType().
 boolean validate(XmlOptions options)
          Just like validate(), but with options.
 boolean valueEquals(XmlObject obj)
          True if the xml values are equal.
 int valueHashCode()
           
 List xgetListValue()
          Returns the value as a List of XmlAnySimpleType objects.
 List xlistValue()
          Returns the value as a List of XmlAnySimpleType objects.
 String xmlText()
          Returns standard XML text.
 String xmlText(XmlOptions options)
          Just like xmlText() but with options.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.xmlbeans.XmlObject
substitute, toString
 
Methods inherited from interface org.apache.xmlbeans.XmlTokenSource
dump
 
Methods inherited from interface org.apache.xmlbeans.DelegateXmlObject
underlyingXmlObject
 

Constructor Detail

FilterXmlObject

public FilterXmlObject()
Method Detail

schemaType

public SchemaType schemaType()
Description copied from interface: XmlObject
The schema type for this instance. This is a permanent, unchanging property of the instance.

Specified by:
schemaType in interface XmlObject

validate

public boolean validate()
Description copied from interface: XmlObject
Returns true if the contents of this object are valid accoring to schemaType().

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

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.

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

selectPath

public XmlObject[] selectPath(String path,
                              XmlOptions options)
Description copied from interface: XmlObject
Selects a path, applying options.

Specified by:
selectPath in interface XmlObject
See Also:
XmlObject.selectPath(String)

execQuery

public XmlObject[] execQuery(String query)
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
See Also:
XmlObject.selectPath(String)

execQuery

public XmlObject[] execQuery(String query,
                             XmlOptions options)
Description copied from interface: XmlObject
Executes a query with options. Use the options parameter to specify the following:

To specify thisUse this method
The document type for the root element. XmlOptions.setDocumentType(org.apache.xmlbeans.SchemaType)
To replace the document element with the specified QName when constructing the resulting document. XmlOptions.setLoadReplaceDocumentElement(javax.xml.namespace.QName)
To strip all insignificant whitespace when constructing a document. XmlOptions.setLoadStripWhitespace()
To strip all comments when constructing a document. XmlOptions.setLoadStripComments()
To strip all processing instructions when constructing a document. XmlOptions.setLoadStripProcinsts()
A map of namespace URI substitutions to use when constructing a document. XmlOptions.setLoadSubstituteNamespaces(java.util.Map)
Additional namespace mappings to be added when constructing a document. XmlOptions.setLoadAdditionalNamespaces(java.util.Map)
To trim the underlying XML text buffer immediately after constructing a document, resulting in a smaller memory footprint. XmlOptions.setLoadTrimTextBuffer()
Whether value facets should be checked as they are set. XmlOptions.setValidateOnSet()

Specified by:
execQuery in interface XmlObject
Parameters:
query - The XQuery expression.
options - Options as described.
See Also:
XmlObject.execQuery(String)

changeType

public XmlObject changeType(SchemaType newType)
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

isNil

public boolean isNil()
Description copied from interface: XmlObject
True if the value is nil. Note that in order to be nil, the value must be in an element, and the element containing the value must be marked as nillable in the schema.

Specified by:
isNil in interface XmlObject

setNil

public void setNil()
Description copied from interface: XmlObject
Sets the value to nil. The element containing the value must be marked as nillable in the schema.

Specified by:
setNil in interface XmlObject

isImmutable

public boolean isImmutable()
Description copied from interface: XmlObject
True if the value is an immutable value. Immutable values do not have a position in a tree; rather, they are stand-alone simple type values. If the object is immutable, the equals() methods tests for value equality, and the object can be used as the key for a hash.

Specified by:
isImmutable in interface XmlObject

set

public XmlObject set(XmlObject srcObj)
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

copy

public 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.

Specified by:
copy in interface XmlObject

valueEquals

public boolean valueEquals(XmlObject obj)
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.

Specified by:
valueEquals in interface XmlObject

valueHashCode

public int valueHashCode()
Specified by:
valueHashCode in interface XmlObject

compareTo

public int compareTo(Object obj)
Description copied from interface: XmlObject
Impelements the Comparable interface by comparing two simple xml values based on their standard XML schema ordering. Throws a ClassCastException if no standard ordering applies, or if the two values are incomparable within a partial order.

Specified by:
compareTo in interface XmlObject

compareValue

public int compareValue(XmlObject obj)
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

monitor

public 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

documentProperties

public XmlDocumentProperties documentProperties()
Description copied from interface: XmlTokenSource
Returns the XmlDocumentProperties object for the document this token source is associated with.

Specified by:
documentProperties in interface XmlTokenSource

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

newXMLInputStream

public org.apache.xmlbeans.xml.stream.XMLInputStream newXMLInputStream()
Deprecated. 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

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

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

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

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

save

public void save(ContentHandler ch,
                 LexicalHandler lh)
          throws SAXException
Description copied from interface: XmlTokenSource
Writes the XML represented by this source to the given SAX content and lexical handlers. Note that this method does not save the XML declaration, including the encoding information. To save the XML declaration with the XML, see XmlTokenSource.save(OutputStream), XmlTokenSource.save(OutputStream, XmlOptions), XmlTokenSource.save(File) or XmlTokenSource.save(File, XmlOptions).

Specified by:
save in interface XmlTokenSource
Throws:
SAXException

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

save

public void save(Writer w)
          throws IOException
Description copied from interface: XmlTokenSource
Writes the XML represented by this source to the given output. Note that this method does not save the XML declaration, including the encoding information. To save the XML declaration with the XML, see XmlTokenSource.save(OutputStream), XmlTokenSource.save(OutputStream, XmlOptions), XmlTokenSource.save(File) or XmlTokenSource.save(File, XmlOptions).

Specified by:
save in interface XmlTokenSource
Throws:
IOException

newXMLInputStream

public org.apache.xmlbeans.xml.stream.XMLInputStream newXMLInputStream(XmlOptions options)
Deprecated. Deprecated by XMLStreamReader from STaX - jsr173 API.

Description copied from interface: XmlTokenSource

Just like newXMLInputStream() but with any of a number of options. Use the options parameter to specify the following:

To specify thisUse this method
The character encoding to use when converting the character data in the XML to bytess. XmlOptions.setCharacterEncoding(java.lang.String)
Prefix-to-namespace mappings that should be assumed when saving this XML. This is useful when the resulting XML will be part of a larger XML document, ensuring that this inner document will take advantage of namespaces defined in the outer document. XmlOptions.setSaveImplicitNamespaces(java.util.Map)
Suggested namespace prefixes to use when saving. Used only when a namespace attribute needs to be synthesized. XmlOptions.setSaveSuggestedPrefixes(java.util.Map)
That namespace attributes should occur first in elements when the XML is saved. By default, they occur last. XmlOptions.setSaveNamespacesFirst()
The XML should be pretty printed when saved. Note that this should only be used for debugging. XmlOptions.setSavePrettyPrint()
The number of spaces to use when indenting for pretty printing. The default is 2. XmlOptions.setSavePrettyPrintIndent(int)
The additional number of spaces indented from the left for pretty printed XML. XmlOptions.setSavePrettyPrintOffset(int)
To minimize the number of namespace attributes generated for the saved XML. Note that this can reduce performance significantly. XmlOptions.setSaveAggresiveNamespaces()
To reduce the size of the saved document by allowing the use of the default namespace. Note that this can potentially change the semantic meaning of the XML if unprefixed QNames are present as the value of an attribute or element. XmlOptions.setUseDefaultNamespace()
To filter out processing instructions with the specified target name. XmlOptions.setSaveFilterProcinst(java.lang.String)
Change the QName of the synthesized root element when saving. This replaces "xml-fragment" with "fragment" in the namespace http://www.openuri.org/fragment XmlOptions.setSaveUseOpenFrag()
Saving should begin on the element's contents. XmlOptions.setSaveInner()
Saving should begin on the element, rather than its contents. XmlOptions.setSaveOuter()
To rename the document element, or to specify the document element for this XML. XmlOptions.setSaveSyntheticDocumentElement(javax.xml.namespace.QName)

Specified by:
newXMLInputStream in interface XmlTokenSource
Parameters:
options - Any of the described options.
Returns:
A new validating XMLInputStream.
See Also:
XmlOptions

newXMLStreamReader

public XMLStreamReader newXMLStreamReader(XmlOptions options)
Description copied from interface: XmlTokenSource
Just like newXMLInputStream() but with options. Options map may be null.

Specified by:
newXMLStreamReader in interface XmlTokenSource
See Also:
XmlOptions

xmlText

public String xmlText(XmlOptions options)
Description copied from interface: XmlTokenSource
Just like xmlText() but with options. Options map may be null.

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
See Also:
XmlOptions

newInputStream

public InputStream newInputStream(XmlOptions options)
Description copied from interface: XmlTokenSource
Just like newInputStream(String encoding) but with options. Options map may be null.

Specified by:
newInputStream in interface XmlTokenSource
See Also:
XmlOptions

newReader

public Reader newReader(XmlOptions options)
Description copied from interface: XmlTokenSource
Just like newReader() but with options. Options map may be null.

Specified by:
newReader in interface XmlTokenSource
See Also:
XmlOptions

newDomNode

public Node newDomNode(XmlOptions options)
Description copied from interface: XmlTokenSource
Just like newDomNode() but with options. Options map may be null.

Specified by:
newDomNode in interface XmlTokenSource
See Also:
XmlOptions

save

public void save(ContentHandler ch,
                 LexicalHandler lh,
                 XmlOptions options)
          throws SAXException
Description copied from interface: XmlTokenSource
Writes the XML represented by this source to the given SAX content and lexical handlers. Note that this method does not save the XML declaration, including the encoding information. To save the XML declaration with the XML, see XmlTokenSource.save(OutputStream), XmlTokenSource.save(OutputStream, XmlOptions), XmlTokenSource.save(File) or XmlTokenSource.save(File, XmlOptions).

Specified by:
save in interface XmlTokenSource
Throws:
SAXException

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(OutputStream os,
                 XmlOptions options)
          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

save

public void save(Writer w,
                 XmlOptions options)
          throws IOException
Description copied from interface: XmlTokenSource
Writes the XML represented by this source to the given output. Note that this method does not save the XML declaration, including the encoding information. To save the XML declaration with the XML, see XmlTokenSource.save(OutputStream), XmlTokenSource.save(OutputStream, XmlOptions), XmlTokenSource.save(File) or XmlTokenSource.save(File, XmlOptions).

Specified by:
save in interface XmlTokenSource
Throws:
IOException

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

stringValue

public String stringValue()
Description copied from interface: SimpleValue
Returns the value as a String. *

Specified by:
stringValue in interface SimpleValue

booleanValue

public boolean booleanValue()
Description copied from interface: SimpleValue
Returns the value as a boolean. *

Specified by:
booleanValue in interface SimpleValue

byteValue

public byte byteValue()
Description copied from interface: SimpleValue
Returns the value as a byte. *

Specified by:
byteValue in interface SimpleValue

shortValue

public short shortValue()
Description copied from interface: SimpleValue
Returns the value as a short. *

Specified by:
shortValue in interface SimpleValue

intValue

public int intValue()
Description copied from interface: SimpleValue
Returns the value as an int. *

Specified by:
intValue in interface SimpleValue

longValue

public long longValue()
Description copied from interface: SimpleValue
Returns the value as a long. *

Specified by:
longValue in interface SimpleValue

bigIntegerValue

public BigInteger bigIntegerValue()
Description copied from interface: SimpleValue
Returns the value as a BigInteger. *

Specified by:
bigIntegerValue in interface SimpleValue

bigDecimalValue

public BigDecimal bigDecimalValue()
Description copied from interface: SimpleValue
Returns the value as a BigDecimal. *

Specified by:
bigDecimalValue in interface SimpleValue

floatValue

public float floatValue()
Description copied from interface: SimpleValue
Returns the value as a float. *

Specified by:
floatValue in interface SimpleValue

doubleValue

public double doubleValue()
Description copied from interface: SimpleValue
Returns the value as a double. *

Specified by:
doubleValue in interface SimpleValue

byteArrayValue

public byte[] byteArrayValue()
Description copied from interface: SimpleValue
Returns the value as a byte array. *

Specified by:
byteArrayValue in interface SimpleValue

enumValue

public StringEnumAbstractBase enumValue()
Description copied from interface: SimpleValue
Returns the value as a StringEnumAbstractBase. *

Specified by:
enumValue in interface SimpleValue

calendarValue

public Calendar calendarValue()
Description copied from interface: SimpleValue
Returns the value as a Calendar. *

Specified by:
calendarValue in interface SimpleValue

dateValue

public Date dateValue()
Description copied from interface: SimpleValue
Returns the value as a Date. *

Specified by:
dateValue in interface SimpleValue

gDateValue

public GDate gDateValue()
Description copied from interface: SimpleValue
Returns the value as a GDate. *

Specified by:
gDateValue in interface SimpleValue

gDurationValue

public GDuration gDurationValue()
Description copied from interface: SimpleValue
Returns the value as a GDuration. *

Specified by:
gDurationValue in interface SimpleValue

qNameValue

public QName qNameValue()
Description copied from interface: SimpleValue
Returns the value as a QName. *

Specified by:
qNameValue in interface SimpleValue

listValue

public List listValue()
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

xlistValue

public List xlistValue()
Description copied from interface: SimpleValue
Returns the value as a List of XmlAnySimpleType objects. *

Specified by:
xlistValue in interface SimpleValue

objectValue

public Object objectValue()
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

set

public void set(String obj)
Description copied from interface: SimpleValue
Sets the value as a String. *

Specified by:
set in interface SimpleValue

set

public void set(boolean v)
Description copied from interface: SimpleValue
Sets the value as a boolean. *

Specified by:
set in interface SimpleValue

set

public void set(byte v)
Description copied from interface: SimpleValue
Sets the value as a byte.

Specified by:
set in interface SimpleValue

set

public void set(short v)
Description copied from interface: SimpleValue
Sets the value as a short.

Specified by:
set in interface SimpleValue

set

public void set(int v)
Description copied from interface: SimpleValue
Sets the value as an int.

Specified by:
set in interface SimpleValue

set

public void set(long v)
Description copied from interface: SimpleValue
Sets the value as a long.

Specified by:
set in interface SimpleValue

set

public void set(BigInteger obj)
Description copied from interface: SimpleValue
Sets the value as a BigInteger.

Specified by:
set in interface SimpleValue

set

public void set(BigDecimal obj)
Description copied from interface: SimpleValue
Sets the value as a BigDecimal

Specified by:
set in interface SimpleValue

set

public void set(float v)
Description copied from interface: SimpleValue
Sets the value as a float.

Specified by:
set in interface SimpleValue

set

public void set(double v)
Description copied from interface: SimpleValue
Sets the value as a double.

Specified by:
set in interface SimpleValue

set

public void set(byte[] obj)
Description copied from interface: SimpleValue
Sets the value as a byte array.

Specified by:
set in interface SimpleValue

set

public void set(StringEnumAbstractBase obj)
Description copied from interface: SimpleValue
Sets the value as a StringEnumAbstractBase.

Specified by:
set in interface SimpleValue

set

public void set(Calendar obj)
Description copied from interface: SimpleValue
Sets the value as a Calendar.

Specified by:
set in interface SimpleValue

set

public void set(Date obj)
Description copied from interface: SimpleValue
Sets the value as a Date.

Specified by:
set in interface SimpleValue

set

public void set(GDateSpecification obj)
Description copied from interface: SimpleValue
Sets the value as a GDate.

Specified by:
set in interface SimpleValue

set

public void set(GDurationSpecification obj)
Description copied from interface: SimpleValue
Sets the value as a GDuration.

Specified by:
set in interface SimpleValue

set

public void set(QName obj)
Description copied from interface: SimpleValue
Sets the value as a QName.

Specified by:
set in interface SimpleValue

set

public void set(List obj)
Description copied from interface: SimpleValue
Sets the value as a List.

Specified by:
set in interface SimpleValue

getStringValue

public String getStringValue()
Description copied from interface: SimpleValue
Returns the value as a String.

Specified by:
getStringValue in interface SimpleValue

getBooleanValue

public boolean getBooleanValue()
Description copied from interface: SimpleValue
Returns the value as a boolean.

Specified by:
getBooleanValue 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

getBigIntegerValue

public BigInteger getBigIntegerValue()
Description copied from interface: SimpleValue
Returns the value as a BigInteger.

Specified by:
getBigIntegerValue in interface SimpleValue

getBigDecimalValue

public BigDecimal getBigDecimalValue()
Description copied from interface: SimpleValue
Returns the value as a BigDecimal.

Specified by:
getBigDecimalValue in interface SimpleValue

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

getByteArrayValue

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

Specified by:
getByteArrayValue in interface SimpleValue

getEnumValue

public StringEnumAbstractBase getEnumValue()
Description copied from interface: SimpleValue
Returns the value as a StringEnumAbstractBase.

Specified by:
getEnumValue in interface SimpleValue

getCalendarValue

public Calendar getCalendarValue()
Description copied from interface: SimpleValue
Returns the value as a Calendar.

Specified by:
getCalendarValue in interface SimpleValue

getDateValue

public Date getDateValue()
Description copied from interface: SimpleValue
Returns the value as a Date.

Specified by:
getDateValue in interface SimpleValue

getGDateValue

public GDate getGDateValue()
Description copied from interface: SimpleValue
Returns the value as a GDate.

Specified by:
getGDateValue in interface SimpleValue

getGDurationValue

public GDuration getGDurationValue()
Description copied from interface: SimpleValue
Returns the value as a GDuration.

Specified by:
getGDurationValue in interface SimpleValue

getQNameValue

public QName getQNameValue()
Description copied from interface: SimpleValue
Returns the value as a QName.

Specified by:
getQNameValue 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

xgetListValue

public List xgetListValue()
Description copied from interface: SimpleValue
Returns the value as a List of XmlAnySimpleType objects.

Specified by:
xgetListValue 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

setStringValue

public void setStringValue(String obj)
Description copied from interface: SimpleValue
Sets the value as a String.

Specified by:
setStringValue in interface SimpleValue

setBooleanValue

public void setBooleanValue(boolean v)
Description copied from interface: SimpleValue
Sets the value as a boolean.

Specified by:
setBooleanValue in interface SimpleValue

setByteValue

public void setByteValue(byte v)
Description copied from interface: SimpleValue
Sets the value as a byte.

Specified by:
setByteValue in interface SimpleValue

setShortValue

public void setShortValue(short v)
Description copied from interface: SimpleValue
Sets the value as a short.

Specified by:
setShortValue in interface SimpleValue

setIntValue

public void setIntValue(int v)
Description copied from interface: SimpleValue
Sets the value as an int.

Specified by:
setIntValue in interface SimpleValue

setLongValue

public void setLongValue(long v)
Description copied from interface: SimpleValue
Sets the value as a long.

Specified by:
setLongValue in interface SimpleValue

setBigIntegerValue

public void setBigIntegerValue(BigInteger obj)
Description copied from interface: SimpleValue
Sets the value as a BigInteger.

Specified by:
setBigIntegerValue in interface SimpleValue

setBigDecimalValue

public void setBigDecimalValue(BigDecimal obj)
Description copied from interface: SimpleValue
Sets the value as a BigDecimal.

Specified by:
setBigDecimalValue in interface SimpleValue

setFloatValue

public void setFloatValue(float v)
Description copied from interface: SimpleValue
Sets the value as a float.

Specified by:
setFloatValue in interface SimpleValue

setDoubleValue

public void setDoubleValue(double v)
Description copied from interface: SimpleValue
Sets the value as a double.

Specified by:
setDoubleValue in interface SimpleValue

setByteArrayValue

public void setByteArrayValue(byte[] obj)
Description copied from interface: SimpleValue
Sets the value as a byte array.

Specified by:
setByteArrayValue in interface SimpleValue

setEnumValue

public void setEnumValue(StringEnumAbstractBase obj)
Description copied from interface: SimpleValue
Sets the value as a StringEnumAbstractBase.

Specified by:
setEnumValue in interface SimpleValue

setCalendarValue

public void setCalendarValue(Calendar obj)
Description copied from interface: SimpleValue
Sets the value as a Calendar.

Specified by:
setCalendarValue in interface SimpleValue

setDateValue

public void setDateValue(Date obj)
Description copied from interface: SimpleValue
Sets the value as a Date.

Specified by:
setDateValue in interface SimpleValue

setGDateValue

public void setGDateValue(GDate obj)
Description copied from interface: SimpleValue
Sets the value as a GDate.

Specified by:
setGDateValue in interface SimpleValue

setGDurationValue

public void setGDurationValue(GDuration obj)
Description copied from interface: SimpleValue
Sets the value as a GDuration.

Specified by:
setGDurationValue in interface SimpleValue

setQNameValue

public void setQNameValue(QName obj)
Description copied from interface: SimpleValue
Sets the value as a QName.

Specified by:
setQNameValue in interface SimpleValue

setListValue

public void setListValue(List obj)
Description copied from interface: SimpleValue
Sets the value as a List.

Specified by:
setListValue in interface SimpleValue

setObjectValue

public void setObjectValue(Object obj)
Description copied from interface: SimpleValue
Sets the value as an arbitrary Object.

Specified by:
setObjectValue in interface SimpleValue

objectSet

public void objectSet(Object obj)
Description copied from interface: SimpleValue
Sets the value as an arbitrary Object.

Specified by:
objectSet in interface SimpleValue

selectChildren

public XmlObject[] selectChildren(QName elementName)
Description copied from interface: XmlObject
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)
Description copied from interface: XmlObject
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.

selectChildren

public XmlObject[] selectChildren(QNameSet elementNameSet)
Description copied from interface: XmlObject
Selects the contents of the children elements that are contained in the elementNameSet.

Specified by:
selectChildren in interface XmlObject
Parameters:
elementNameSet - Set of element names to be selected.
Returns:
Returns the contents of the selected elements.
See Also:
SchemaType.qnameSetForWildcardElements(), for creating sets of qnames

selectAttribute

public XmlObject selectAttribute(QName attributeName)
Description copied from interface: XmlObject
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)
Description copied from interface: XmlObject
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.

selectAttributes

public XmlObject[] selectAttributes(QNameSet attributeNameSet)
Description copied from interface: XmlObject
Selects the contents of the attributes that are contained in the elementNameSet.

Specified by:
selectAttributes in interface XmlObject
Parameters:
attributeNameSet - Set of attribute names to be selected.
Returns:
Returns the contents of the selected attributes.
See Also:
SchemaType.qnameSetForWildcardAttributes(), for creating sets of qnames