Object
SimpleValue, XmlObject
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.
Object
FilterXmlObject
SimpleValue, XmlObject, XmlTokenSource
Constructor Summary |
Method Summary |
public |
|
public |
|
public boolean |
|
public byte[] |
|
public byte |
|
public |
|
public |
|
public int | |
public int |
|
public |
|
public | |
public |
|
public double |
|
public |
|
public | |
public |
|
public float |
|
public |
|
public |
|
public |
|
public |
|
public boolean |
|
public byte[] |
|
public byte |
|
public |
|
public |
|
public double |
|
public |
|
public float |
|
public |
|
public |
|
public int |
|
public |
|
public long |
|
public |
|
public |
|
public short |
|
public |
|
public |
|
public int |
|
public boolean |
|
public boolean |
|
public | |
public long |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public void | |
public |
|
public |
|
public void |
|
public void | |
public void |
|
public void | |
public void |
|
public void |
|
public void |
|
public void |
|
public |
|
public |
|
public |
|
public | |
public void | |
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void | |
public void | |
public void |
|
public void |
|
public void | |
public void | |
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public void |
|
public short |
|
public |
|
public abstract |
|
public boolean |
|
public boolean |
|
public boolean |
|
public int | |
public |
|
public |
|
public |
|
public |
|
Methods from class java.lang. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods from interface com.bea.xml. |
|
Methods from interface com.bea.xml. |
|
Constructor Detail |
public FilterXmlObject()
Method Detail |
public BigDecimal bigDecimalValue()
Description copied from SimpleValue.bigDecimalValue()
BigDecimal. *
public BigInteger bigIntegerValue()
Description copied from SimpleValue.bigIntegerValue()
BigInteger. *
public boolean booleanValue()Description copied from
SimpleValue.booleanValue()
public byte[] byteArrayValue()Description copied from
SimpleValue.byteArrayValue()
public byte byteValue()Description copied from
SimpleValue.byteValue()
public Calendar calendarValue()
Description copied from SimpleValue.calendarValue()
Calendar. *
publicDescription copied fromXmlObjectchangeType(SchemaTypenewType)
XmlObject.changeType(SchemaType)
Returns null if the type change is not allowed. Certain type changes may be prohibited on 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 InvalidStateException 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.
public int compareTo(Object obj)
Description copied from XmlObject.compareTo(Object)
public int compareValue(XmlObject obj)
Description copied from XmlObject.compareValue(XmlObject)
public XmlObject copy()
Description copied from XmlObject.copy()
public Date dateValue()
Description copied from SimpleValue.dateValue()
Date. *
public XmlDocumentProperties documentProperties()
Description copied from XmlTokenSource.documentProperties()
public double doubleValue()Description copied from
SimpleValue.doubleValue()
public StringEnumAbstractBase enumValue()
Description copied from SimpleValue.enumValue()
StringEnumAbstractBase. *
publicDescription copied fromXmlObject[] execQuery(Stringquery)
XmlObject.execQuery(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.
publicDescription copied fromXmlObject[] execQuery(Stringquery,XmlOptionsoptions)
XmlObject.execQuery(String, XmlOptions)
| To specify this | Use this method |
|---|---|
| The document type for the root element. | XmlOptions.setDocumentType(SchemaType) |
| To replace the document element with the specified QName when constructing the resulting document. | XmlOptions.setLoadReplaceDocumentElement(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(Map) |
| Additional namespace mappings to be added when constructing a document. | XmlOptions.setLoadAdditionalNamespaces(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() |
public float floatValue()Description copied from
SimpleValue.floatValue()
public GDate gDateValue()
Description copied from SimpleValue.gDateValue()
GDate. *
public GDuration gDurationValue()
Description copied from SimpleValue.gDurationValue()
GDuration. *
public BigDecimal getBigDecimalValue()
Description copied from SimpleValue.getBigDecimalValue()
BigDecimal.
public BigInteger getBigIntegerValue()
Description copied from SimpleValue.getBigIntegerValue()
BigInteger.
public boolean getBooleanValue()Description copied from
SimpleValue.getBooleanValue()
public byte[] getByteArrayValue()Description copied from
SimpleValue.getByteArrayValue()
public byte getByteValue()Description copied from
SimpleValue.getByteValue()
public Calendar getCalendarValue()
Description copied from SimpleValue.getCalendarValue()
Calendar.
public Date getDateValue()
Description copied from SimpleValue.getDateValue()
Date.
public double getDoubleValue()Description copied from
SimpleValue.getDoubleValue()
public StringEnumAbstractBase getEnumValue()
Description copied from SimpleValue.getEnumValue()
StringEnumAbstractBase.
public float getFloatValue()Description copied from
SimpleValue.getFloatValue()
public GDate getGDateValue()
Description copied from SimpleValue.getGDateValue()
GDate.
public GDuration getGDurationValue()
Description copied from SimpleValue.getGDurationValue()
GDuration.
public int getIntValue()Description copied from
SimpleValue.getIntValue()
public List getListValue()
Description copied from SimpleValue.getListValue()
List of friendly Java objects (String, Integer, Byte, Short, Long, BigInteger, Decimal, Float, Double, byte[], Calendar, GDuration).
public long getLongValue()Description copied from
SimpleValue.getLongValue()
public Object getObjectValue()
Description copied from SimpleValue.getObjectValue()
public QName getQNameValue()
Description copied from SimpleValue.getQNameValue()
QName.
public short getShortValue()Description copied from
SimpleValue.getShortValue()
public String getStringValue()
Description copied from SimpleValue.getStringValue()
String.
public SchemaType instanceType()
Description copied from SimpleValue.instanceType()
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.
public int intValue()Description copied from
SimpleValue.intValue()
public boolean isImmutable()Description copied from
XmlObject.isImmutable()
public boolean isNil()Description copied from
XmlObject.isNil()
public List listValue()
Description copied from SimpleValue.listValue()
List of friendly Java objects (String, Integer, Byte, Short, Long, BigInteger, Decimal, Float, Double, byte[], Calendar, GDuration). *
public long longValue()Description copied from
SimpleValue.longValue()
public Object monitor()
Description copied from XmlTokenSource.monitor()
public XmlCursor newCursor()
Description copied from XmlTokenSource.newCursor()
public Node newDomNode()
Description copied from XmlTokenSource.newDomNode()
publicDescription copied fromNodenewDomNode(XmlOptionsoptions)
XmlTokenSource.newDomNode(XmlOptions)
public InputStream newInputStream()
Description copied from XmlTokenSource.newInputStream()
publicDescription copied fromInputStreamnewInputStream(XmlOptionsoptions)
XmlTokenSource.newInputStream(XmlOptions)
public Reader newReader()
Description copied from XmlTokenSource.newReader()
publicDescription copied fromReadernewReader(XmlOptionsoptions)
XmlTokenSource.newReader(XmlOptions)
DEPRECATED Superceded by JSR 173
public XMLInputStream newXMLInputStream()
Description copied from com.bea.xml.XmlTokenSource.newXMLInputStream()
DEPRECATED Superceded by JSR 173
publicDescription copied fromXMLInputStreamnewXMLInputStream(XmlOptionsoptions)
com.bea.xml.XmlTokenSource.newXMLInputStream(com.bea.xml.XmlOptions)
Just like newXMLInputStream() but with any of a number of options. Use the options parameter to specify the following:
| To specify this | Use this method |
|---|---|
| The character encoding to use when converting the character data in the XML to bytess. | XmlOptions.setCharacterEncoding(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(Map) |
| Suggested namespace prefixes to use when saving. Used only when a namespace attribute needs to be synthesized. | XmlOptions.setSaveSuggestedPrefixes(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(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(QName) |
public void objectSet(Object obj)
Description copied from SimpleValue.objectSet(Object)
Object.
public Object objectValue()
Description copied from SimpleValue.objectValue()
public QName qNameValue()
Description copied from SimpleValue.qNameValue()
QName. *
public void save(Description copied fromContentHandlerch,LexicalHandlerlh)
throwsSAXException
XmlTokenSource.save(ContentHandler, LexicalHandler)
SAXException
public void save(Description copied fromFilefile)
throwsIOException
XmlTokenSource.save(File)
IOException
public void save(Description copied fromOutputStreamos)
throwsIOException
XmlTokenSource.save(OutputStream)
IOException
public void save(Description copied fromWriterw)
throwsIOException
XmlTokenSource.save(Writer)
IOException
public void save(Description copied fromContentHandlerch,LexicalHandlerlh,XmlOptionsoptions)
throwsSAXException
XmlTokenSource.save(ContentHandler, LexicalHandler, XmlOptions)
SAXException
public void save(Description copied fromFilefile,XmlOptionsoptions)
throwsIOException
XmlTokenSource.save(File, XmlOptions)
IOException
public void save(Description copied fromOutputStreamos,XmlOptionsoptions)
throwsIOException
XmlTokenSource.save(OutputStream, XmlOptions)
IOException
public void save(Description copied fromWriterw,XmlOptionsoptions)
throwsIOException
XmlTokenSource.save(Writer, XmlOptions)
IOException
public SchemaType schemaType()
Description copied from XmlObject.schemaType()
publicDescription copied fromXmlObject[] selectPath(Stringpath)
XmlObject.selectPath(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 com.bea.xml.*;
[...]
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.
publicDescription copied fromXmlObject[] selectPath(Stringpath,XmlOptionsoptions)
XmlObject.selectPath(String, XmlOptions)
publicDescription copied fromXmlObjectset(XmlObjectsrcObj)
XmlObject.set(XmlObject)
public void set(String obj)
Description copied from SimpleValue.set(String)
String. *
public void set(boolean v)Description copied from
SimpleValue.set(boolean)
public void set(byte v)Description copied from
SimpleValue.set(byte)
public void set(short v)Description copied from
SimpleValue.set(short)
public void set(int v)Description copied from
SimpleValue.set(int)
public void set(long v)Description copied from
SimpleValue.set(long)
public void set(BigInteger obj)
Description copied from SimpleValue.set(BigInteger)
BigInteger.
public void set(BigDecimal obj)
Description copied from SimpleValue.set(BigDecimal)
BigDecimal
public void set(float v)Description copied from
SimpleValue.set(float)
public void set(double v)Description copied from
SimpleValue.set(double)
public void set(byte[] obj)Description copied from
SimpleValue.set(byte[])
public void set(StringEnumAbstractBase obj)
Description copied from SimpleValue.set(StringEnumAbstractBase)
StringEnumAbstractBase.
public void set(Calendar obj)
Description copied from SimpleValue.set(Calendar)
Calendar.
public void set(Date obj)
Description copied from SimpleValue.set(Date)
Date.
public void set(GDateSpecification obj)
Description copied from SimpleValue.set(GDateSpecification)
GDate.
public void set(GDurationSpecification obj)
Description copied from SimpleValue.set(GDurationSpecification)
GDuration.
public void set(QName obj)
Description copied from SimpleValue.set(QName)
QName.
public void set(List obj)
Description copied from SimpleValue.set(List)
List.
public void setBigDecimalValue(BigDecimal obj)
Description copied from SimpleValue.setBigDecimalValue(BigDecimal)
BigDecimal.
public void setBigIntegerValue(BigInteger obj)
Description copied from SimpleValue.setBigIntegerValue(BigInteger)
BigInteger.
public void setBooleanValue(boolean v)Description copied from
SimpleValue.setBooleanValue(boolean)
public void setByteArrayValue(byte[] obj)Description copied from
SimpleValue.setByteArrayValue(byte[])
public void setByteValue(byte v)Description copied from
SimpleValue.setByteValue(byte)
public void setCalendarValue(Calendar obj)
Description copied from SimpleValue.setCalendarValue(Calendar)
Calendar.
public void setDateValue(Date obj)
Description copied from SimpleValue.setDateValue(Date)
Date.
public void setDoubleValue(double v)Description copied from
SimpleValue.setDoubleValue(double)
public void setEnumValue(StringEnumAbstractBase obj)
Description copied from SimpleValue.setEnumValue(StringEnumAbstractBase)
StringEnumAbstractBase.
public void setFloatValue(float v)Description copied from
SimpleValue.setFloatValue(float)
public void setGDateValue(GDate obj)
Description copied from SimpleValue.setGDateValue(GDate)
GDate.
public void setGDurationValue(GDuration obj)
Description copied from SimpleValue.setGDurationValue(GDuration)
GDuration.
public void setIntValue(int v)Description copied from
SimpleValue.setIntValue(int)
public void setListValue(List obj)
Description copied from SimpleValue.setListValue(List)
List.
public void setLongValue(long v)Description copied from
SimpleValue.setLongValue(long)
public void setNil()Description copied from
XmlObject.setNil()
public void setObjectValue(Object obj)
Description copied from SimpleValue.setObjectValue(Object)
Object.
public void setQNameValue(QName obj)
Description copied from SimpleValue.setQNameValue(QName)
QName.
public void setShortValue(short v)Description copied from
SimpleValue.setShortValue(short)
public void setStringValue(String obj)
Description copied from SimpleValue.setStringValue(String)
String.
public short shortValue()Description copied from
SimpleValue.shortValue()
public String stringValue()
Description copied from SimpleValue.stringValue()
String. *
public abstract XmlObject underlyingXmlObject()
This abstract method is called to obtain the underlying XmlObject.
Override this method to supply or compute the wrapped object.
Every other method of this class delegates to the object returned from this method. It is assumed that the object implements all the methods of both XmlObject and SimpleValue.
public boolean validate()Description copied from
XmlObject.validate()
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.
public boolean validate(XmlOptions options)
Description copied from XmlObject.validate(XmlOptions)
Just like validate(), but with options.
If you wish to collect error messages and locations while validating,
use the XmlOptions.setErrorListener(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");
}
}
Collection interface.
public boolean valueEquals(XmlObject obj)
Description copied from XmlObject.valueEquals(XmlObject)
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.
public int valueHashCode()
public List xgetListValue()
Description copied from SimpleValue.xgetListValue()
List of XmlAnySimpleType objects.
public List xlistValue()
Description copied from SimpleValue.xlistValue()
List of XmlAnySimpleType objects. *
public String xmlText()
Description copied from XmlTokenSource.xmlText()
publicDescription copied fromStringxmlText(XmlOptionsoptions)
XmlTokenSource.xmlText(XmlOptions)