public class PersistorToXMLString extends PersistorToHierarchialString
<Response classname="org.safs.rest.Response">
<StatusCode>200</StatusCode>
<Headers>{Date=Tue, 13 Dec 2016 03:29:27 GMT, Content-Length=4574, Connection=keep-alive, Content-Type=application/xml}</Headers>
<EntityBody><![CDATA[<?xml version="1.0"?><CUSTOMERList xmlns:xlink="http://www.w3.org/1999/xlink">
<CUSTOMER xlink:href="http://www.thomas-bayer.com/sqlrest/CUSTOMER/0/">0</CUSTOMER>
<CUSTOMER xlink:href="http://www.thomas-bayer.com/sqlrest/CUSTOMER/49/">49</CUSTOMER>
</CUSTOMERList>]]></EntityBody>
<Request classname="org.safs.rest.Request">
<Method>GET</Method>
<Headers>
Content-Type:application/octet-stream, Accept:application/octet-stream
</Headers>
</Request>
</Response>
NOTE: Be careful with the value starting with <?xml, which should be wrapped
as <![CDATA[...]]>, as shown in the example above. For other special symbols to be escaped, please
refer to Constants.XMLConstants.SYMBOL_TO_ESCAPE.| Modifier and Type | Class and Description |
|---|---|
protected class |
PersistorToXMLString.UnpickleHandler |
| Modifier and Type | Field and Description |
|---|---|
protected org.xml.sax.InputSource |
inputSource |
protected javax.xml.parsers.SAXParser |
saxParser |
JSON_ARRAY_BRACKET_LEFT, JSON_ARRAY_BRACKET_RIGHT, JSON_ARRAY_COMMA_SEPignoredFieldsForUnpickle, stringFormat, stringFormatReader| Constructor and Description |
|---|
PersistorToXMLString() |
PersistorToXMLString(java.io.Reader stringFormatReader) |
PersistorToXMLString(java.lang.String stringFormat) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
beforeUnpickle()
Prepare the parser with the string format of a Persistable object.
|
protected Persistable |
doUnpickle()
Convert the string format of a Persistable object to Persistable object.
|
protected java.lang.String |
escape(java.lang.String value)
Wrap the string in "" if it contains special symbols
Constants.XMLConstants.SYMBOL_TO_ESCAPE,
please refer to #needEscape(String). |
protected java.lang.String |
getChildBegin(java.lang.String key,
java.lang.String value,
java.lang.String classname)
This is called inside
PersistorToHierarchialString.parse(Persistable, boolean) to write "key"
and "value" of a child. |
protected java.lang.String |
getContainerBegin(java.lang.String className,
boolean needLeadingName)
This is called inside
PersistorToHierarchialString.parse(Persistable, boolean) to write the begin
of a container such as:
<tagNam> for XML format
"tagName" : {\n for JSON format
|
protected java.lang.String |
getContainerEnd(java.lang.String className)
This is called inside
PersistorToHierarchialString.parse(Persistable, boolean) to write the end
of a container such as:
</tagNam> for XML file
} for JSON file. |
getChildEnd, getTagName, parse, parseArrayField, parseFieldValuegetPersistenceName, getStringFormat, getStringFormatReader, getType, isIgnoredField, persist, setStringFormat, setStringFormatReader, stringNeedQuoted, unpersist, unpickle, write, writeHeader, writeTailervalidateprotected javax.xml.parsers.SAXParser saxParser
protected org.xml.sax.InputSource inputSource
public PersistorToXMLString()
public PersistorToXMLString(java.lang.String stringFormat)
public PersistorToXMLString(java.io.Reader stringFormatReader)
protected java.lang.String getContainerBegin(java.lang.String className,
boolean needLeadingName)
PersistorToHierarchialStringPersistorToHierarchialString.parse(Persistable, boolean) to write the begin
of a container such as:
getContainerBegin in class PersistorToHierarchialStringclassName - String, the class name of a container. This is a full class-name, which may needs to
treated to get the simple class name as the tag-name.needLeadingName - boolean, if the leading tag name is needed. For example sometimes we don't need the "tagName" for JSON format.protected java.lang.String getChildBegin(java.lang.String key,
java.lang.String value,
java.lang.String classname)
PersistorToHierarchialStringPersistorToHierarchialString.parse(Persistable, boolean) to write "key"
and "value" of a child.getChildBegin in class PersistorToHierarchialStringkey - String, the key namevalue - String, the valueclassname - String, the class name of this value. It is not useful with JSON format, but it is useful for XML format.protected java.lang.String getContainerEnd(java.lang.String className)
PersistorToHierarchialStringPersistorToHierarchialString.parse(Persistable, boolean) to write the end
of a container such as:
getContainerEnd in class PersistorToHierarchialStringclassName - String, the tag name, it is normally a container. This is a full class-name, which may needs to
treated to get the simple class name as the tag-name.protected java.lang.String escape(java.lang.String value)
Constants.XMLConstants.SYMBOL_TO_ESCAPE,
please refer to #needEscape(String).escape in class PersistorToStringvalue - String, the value to be escaped if it contains special symbolsPersistorToString.stringNeedQuoted()protected void beforeUnpickle()
throws SAFSException
PersistorToStringbeforeUnpickle in class PersistorToStringSAFSExceptionprotected Persistable doUnpickle() throws SAFSException
PersistorToStringdoUnpickle in class PersistorToStringSAFSExceptionCopyright © SAS Institute. All Rights Reserved.