Class ValueHandler
java.lang.Object
com.x2j.converter.mgr.handlers.impl.ValueHandler
- All Implemented Interfaces:
X2JStringHandler
The handler for the X2JStringHandler interface for the VALUE keyword.
As part of this:
- If the XPath defined in the schema is for an XML attribute, this will have the same behavior as that of XPathHandler i.e. return the attribute's value.
- If the XPATH defined in the schema is for an XML element, then,
- This checks whether there is a text component for the element or not. For
example,
<ElementName>TextValue</Element>
- If present, it returns the text value.
- Otherwise, if there are one or multiple child elements, this will return the all of the child element in an encoded String format.
- For everything else, it will return a blank String
- This checks whether there is a text component for the element or not. For
example,
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionhandleString
(String rawValueString, Element rootElement) Returns the value of the XPath which can be either the text component or child element(s) in String form.
-
Constructor Details
-
ValueHandler
public ValueHandler()
-
-
Method Details
-
handleString
Returns the value of the XPath which can be either the text component or child element(s) in String form.- Specified by:
handleString
in interfaceX2JStringHandler
- Parameters:
rawValueString
- the JSON value stringrootElement
- the root element in the input XML- Returns:
- the value of the XPath defined in the schema
- Throws:
X2JException
- X2JException
-