|
Collaboration API Documentation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.xml.sax.helpers.DefaultHandler | +--com.filenet.bso.api.util.BsoXMLUnmarshal
The BsoXMLUnmarshal
class supports the unmarshaling of XML content into Java classes.
A Java class that is generated via unmarshaling XML content must be subclassed from this class.
BsoGenericSAXHandler
,
BsoXMLBinder
,
BsoXMLMarshal
,
BsoXMLWriter
,
BsoXPathDef
Field Summary | |
protected BsoXMLUnmarshal |
parent
A BsoXMLUnmarshal object that holds the parent element
for the current XML element. |
protected java.util.Map |
xmlElements
A Map object that contains the elements and attributes
extracted from XML content. |
protected BsoXPathDef |
xPathDef
A BsoXPathDef object that holds the XPath definitions,
which specify the XML elements to be unmarshaled and the classes that
are created for the various elements in the XML. |
Constructor Summary | |
BsoXMLUnmarshal()
|
|
BsoXMLUnmarshal(BsoXMLUnmarshal parent)
|
Method Summary | |
static java.lang.String |
decode(java.lang.String value)
Decodes an encoded text element string. |
static java.lang.String |
encode(java.lang.String value)
Encodes a text element string that contains prohibited characters. |
void |
endElement(java.lang.String uri,
java.lang.String name,
java.lang.String qName)
Override this method to provide class specific handling of the SAX DefaultHandler class's endElement method. |
protected boolean |
getBooleanValue(java.lang.String key)
Returns the value of a text element or an attribute as a boolean . |
protected java.util.List |
getCollection(java.lang.String key)
Returns a collection of objects unmarshaled from a homogenous sequence of XML elements. |
protected java.lang.Integer |
getIntValue(java.lang.String key)
Returns an integer value from the text element or attribute. |
java.lang.Object |
getObject(java.lang.String name)
Returns a Java Object , generated from the XML element, based
on the given name. |
protected java.lang.Object |
getObjectValue(java.lang.String key,
java.lang.Class objectClass)
Returns an Object value that has been stored in the map, and
validates the class of that object against the class that is passed in
via the objectClass parameter. |
java.lang.String |
getString(java.lang.String name)
Returns the string value of the element or attribute based on the given name. |
protected java.lang.String |
getStringValue(java.lang.String key)
Returns an attribute or the raw value of a specified text element. |
protected java.lang.String |
getTextElement(java.lang.String key)
Retrieves the text element value, decodes it if necessary, and returns the value as a String . |
BsoXPathDef |
getXPathDef()
Returns the BsoXPathDef object that provides unmarshaling
information for this class. |
static boolean |
isEncoded(java.lang.String value)
Returns a boolean that indicates if the parameter string is encoded. |
static boolean |
isEncodingRequired(java.lang.String value)
Returns a boolean that indicates if the parameter string contains
prohibited characters and must be encoded. |
protected void |
remove(java.lang.String name)
Removes the specified element from the map. |
void |
setObject(java.lang.String name,
java.lang.Object value)
Sets the object value of an element or attribute based on the given name. |
void |
setString(java.lang.String name,
java.lang.String value)
Sets the string value of an element or attribute based on the given name. |
protected void |
setTextElement(java.lang.String key,
java.lang.String value)
Sets the value of the text element, encoding the value if necessary. |
protected void |
setValue(java.lang.String key,
boolean value)
Sets a text element's or attribute's value after converting the value from a boolean into its XML representation. |
protected void |
setValue(java.lang.String key,
java.lang.Integer value)
Sets an integer value for a text element or an attribute. |
protected void |
setValue(java.lang.String key,
java.lang.Object value)
Sets an Object value for a text element or an attribute. |
protected void |
setValue(java.lang.String key,
java.lang.String value)
Sets a String value for a text element or an attribute. |
void |
startElement(java.lang.String uri,
java.lang.String name,
java.lang.String qName,
org.xml.sax.Attributes atts)
Override this method to provide class specific handling of the SAX DefaultHandler class's startElement method. |
protected void |
unmarshallAttributes(org.xml.sax.Attributes atts)
Unmarshals the specified attributes from the XML content and places the name and value of each attribute into the map. |
void |
validate()
Validates the XML state. |
protected void |
validateThis(java.lang.String element,
java.lang.String fieldName,
java.lang.Object fieldValue)
Validates that this text element or attribute has a value. |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
characters, endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.Map xmlElements
Map
object that contains the elements and attributes
extracted from XML content.protected BsoXMLUnmarshal parent
BsoXMLUnmarshal
object that holds the parent element
for the current XML element.protected BsoXPathDef xPathDef
BsoXPathDef
object that holds the XPath definitions,
which specify the XML elements to be unmarshaled and the classes that
are created for the various elements in the XML.Constructor Detail |
public BsoXMLUnmarshal()
public BsoXMLUnmarshal(BsoXMLUnmarshal parent)
Method Detail |
public static java.lang.String encode(java.lang.String value)
value
- A text element string to encode.
isEncoded(String)
public static boolean isEncoded(java.lang.String value)
boolean
that indicates if the parameter string is encoded.
value
- A text element string.
true
if the string is encoded; otherwise, returns false
.public static boolean isEncodingRequired(java.lang.String value)
boolean
that indicates if the parameter string contains
prohibited characters and must be encoded.
value
- A text element string.
true
if the string must be encoded; otherwise, returns false
.public static java.lang.String decode(java.lang.String value)
value
- A text element string to decode.
public BsoXPathDef getXPathDef()
BsoXPathDef
object that provides unmarshaling
information for this class.
BsoXPathDef
object.public void validate()
BsoGenericSAXHandler
class during parsing of XML content to validate the XML state that was
used to generate this class. The default implementation of this method does nothing.
Derived classes should override this method to perform validation of the
state of the object after unmarshaling.public java.lang.String getString(java.lang.String name)
name
- A String
containing the name of the element or attribute.
String
containing the value of the element or attribute.public void setString(java.lang.String name, java.lang.String value)
name
- The name of the element or attribute.
value
- The value of the element or attribute.public java.lang.Object getObject(java.lang.String name)
Object
, generated from the XML element, based
on the given name.
name
- The name of the XML-based Java object.
Object
.public void setObject(java.lang.String name, java.lang.Object value)
name
- The name of the XML-based object.
value
- An XML-based Object
.public void startElement(java.lang.String uri, java.lang.String name, java.lang.String qName, org.xml.sax.Attributes atts)
startElement
method.
This method is called by the BsoGenericSAXHandler
class.
startElement
in class org.xml.sax.helpers.DefaultHandler
uri
- The URI (Universal Resource Identifier) for the namespace of this
element.
name
- The element type name.
qName
- The qualified name of this element or an empty string if
qualified names are not present. A qualified name will include the
prefix plus the localName.
atts
- The specified or default attributes.public void endElement(java.lang.String uri, java.lang.String name, java.lang.String qName) throws org.xml.sax.SAXException
endElement
method.
This method is called by the BsoGenericSAXHandler
class.
endElement
in class org.xml.sax.helpers.DefaultHandler
uri
- The URI (Universal Resource Identifier) for the namespace of this
element.
name
- The element type name.
qName
- The qualified name of this element or an empty string if
qualified names are not present. A qualified name will include the
prefix plus the localName.
org.xml.sax.SAXException
- Any SAXException.protected void remove(java.lang.String name)
name
- A String
containing the name of the element to
remove from the map.protected void unmarshallAttributes(org.xml.sax.Attributes atts)
atts
- A collection of attributes to be unmarshaled.protected java.lang.String getTextElement(java.lang.String key)
String
.
key
- A String
that contains the key for the text
element to be retrieved.
String
that represents the value of the text element.protected void setTextElement(java.lang.String key, java.lang.String value)
key
- A String
that contains the key for the text
element to be set.
value
- A String
that contains the value to be set
for the specified text element.protected java.lang.String getStringValue(java.lang.String key)
key
- A String
that contains the name of the text
element or attribute.
String
that represents the value of the text
element or attribute.protected boolean getBooleanValue(java.lang.String key)
boolean
.
This method evaluates the value for "true" or "1", or "false" or "0",
converts the value to a boolean
, and returns it. If the value
is not one of the four above, this method presents a validation error.
key
- A String
that contains the name of the text element or attribute.
true
if the value of the text element or attribute is
"true" or "1"; returns false
if the value is "false" or "0".protected void setValue(java.lang.String key, boolean value)
boolean
into its XML representation. For example, an input
value of true
is converted to "true".
key
- A String
that contains the name of the text element or attribute.
value
- true
or false
.protected void setValue(java.lang.String key, java.lang.String value)
String
value for a text element or an attribute. This
method performs no encoding on the input value.
key
- A String
that contains the name of the text element or attribute.
value
- A String
that contains the value to be set.protected void setValue(java.lang.String key, java.lang.Integer value)
integer
value for a text element or an attribute.
key
- A String
that contains the name of the text element or attribute.
value
- The integer
value to be set.protected java.lang.Integer getIntValue(java.lang.String key)
integer
value from the text element or attribute.
key
- A String
that contains the name of the text element or attribute.
INT_VALUE_NOT_PRESENT
) if the element or attribute has no assigned value.protected java.util.List getCollection(java.lang.String key)
key
- A String
that contains the name used as a
lookup into the map.
List
of objects.protected void setValue(java.lang.String key, java.lang.Object value)
Object
value for a text element or an attribute.
key
- A String
that contains the name of the text element or attribute.
value
- The Object
to which the value is set.protected java.lang.Object getObjectValue(java.lang.String key, java.lang.Class objectClass)
Object
value that has been stored in the map, and
validates the class of that object against the class that is passed in
via the objectClass
parameter. This method throws a
BsoRuntimeException
if the classes do not match.
key
- A String
that contains the name used as a
lookup into the map.
objectClass
- The Java Class
to validate against.
protected void validateThis(java.lang.String element, java.lang.String fieldName, java.lang.Object fieldValue)
validate()
method in classes that derive from BsoXMLUnmarshal
.
This method throws a BsoRuntimeException
if the text element's
or attribute's value is invalid is null
.
element
- A String
containing the name of the text element or attribute.
fieldname
- A String
containing the field name to validate against.
fieldValue
- A Java Object
that represents the value
of the field to validate.
|
Collaboration API Documentation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |