public class PersistorToXMLFile extends PersistorToHierarchialFile
<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 |
PersistorToXMLFile.UnpickleHandler |
Modifier and Type | Field and Description |
---|---|
protected org.xml.sax.InputSource |
inputSource |
protected javax.xml.parsers.SAXParser |
saxParser |
filename, ignoredFieldsForUnpickle, persistFile, reader, writer
runtime
Constructor and Description |
---|
PersistorToXMLFile(RuntimeDataInterface runtime,
java.lang.String filename) |
Modifier and Type | Method and Description |
---|---|
protected void |
beforeUnpickle() |
protected void |
childBegin(java.lang.String key,
java.lang.String value)
This is called inside
PersistorToHierarchialFile.write(Persistable) to write "key"
and "value" of a child. |
protected void |
containerBegin(java.lang.String className)
This is called inside
PersistorToHierarchialFile.write(Persistable) to write the begin
of a container such as:
<tagNam> for XML file
"tagName" : {\n for JSON file
|
protected void |
containerEnd(java.lang.String className)
This is called inside
PersistorToHierarchialFile.write(Persistable) to write the end
of a container such as:
</tagNam> for XML file
} for JSON file. |
protected Persistable |
doUnpickle() |
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) . |
childEnd, getTagName, parseFiledValue, write
equals, getPersistenceName, getType, isIgnoredFiled, persist, stringNeedQuoted, unpersist, unpickle, writeHeader, writeTailer
validate
protected javax.xml.parsers.SAXParser saxParser
protected org.xml.sax.InputSource inputSource
public PersistorToXMLFile(RuntimeDataInterface runtime, java.lang.String filename)
runtime
- filename
- protected void containerBegin(java.lang.String className) throws java.io.IOException
PersistorToHierarchialFile
PersistorToHierarchialFile.write(Persistable)
to write the begin
of a container such as:
containerBegin
in class PersistorToHierarchialFile
className
- 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.java.io.IOException
protected void childBegin(java.lang.String key, java.lang.String value) throws java.io.IOException
PersistorToHierarchialFile
PersistorToHierarchialFile.write(Persistable)
to write "key"
and "value" of a child.childBegin
in class PersistorToHierarchialFile
key
- String, the key namevalue
- String, the valuejava.io.IOException
protected void containerEnd(java.lang.String className) throws java.io.IOException
PersistorToHierarchialFile
PersistorToHierarchialFile.write(Persistable)
to write the end
of a container such as:
containerEnd
in class PersistorToHierarchialFile
className
- 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.java.io.IOException
protected java.lang.String escape(java.lang.String value)
Constants.XMLConstants.SYMBOL_TO_ESCAPE
,
please refer to needEscape(String)
.escape
in class PersistorToFile
value
- String, the value to be escaped if it contains special symbolsPersistorToFile.stringNeedQuoted()
protected void beforeUnpickle() throws SAFSException, java.io.IOException
beforeUnpickle
in class PersistorToFile
SAFSException
java.io.IOException
protected Persistable doUnpickle() throws SAFSException, java.io.IOException
doUnpickle
in class PersistorToFile
SAFSException
java.io.IOException
Copyright © SAS Institute. All Rights Reserved.