Package com.github.underscore
Class Xml
- java.lang.Object
-
- com.github.underscore.Xml
-
public final class Xml extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Xml.ArrayTrue
protected static class
Xml.Document
static class
Xml.FromType
private static class
Xml.MyEntityResolver
static class
Xml.XmlArray
static class
Xml.XmlObject
static class
Xml.XmlStringBuilder
static class
Xml.XmlStringBuilderText
static class
Xml.XmlStringBuilderWithoutHeader
static class
Xml.XmlStringBuilderWithoutRoot
static class
Xml.XmlValue
-
Field Summary
Fields Modifier and Type Field Description private static String
ARRAY
private static String
ARRAY_TRUE
private static String
BOOLEAN
private static String
CDATA
private static String
CLOSED_ELEMENT
private static String
COMMENT
private static String
DOCTYPE_HEADER
private static String
DOCTYPE_TEXT
private static Document
DOCUMENT
private static String
ELEMENT
private static String
ELEMENT_TEXT
private static String
EMPTY_ARRAY
private static String
EMPTY_ELEMENT
private static String
ENCODING
private static String
NULL
private static String
NULL_ATTR
private static String
NULL_ELEMENT
private static String
NULL_TRUE
private static String
NUMBER
private static String
NUMBER_TEXT
private static String
NUMBER_TRUE
private static String
OMITXMLDECLARATION
private static String
QUOT
private static String
ROOT
private static String
SELF_CLOSING
private static Set<Character>
SKIPPED_CHARS
private static String
STANDALONE
private static String
STRING
private static String
TEXT
private static String
TRUE
private static String
XML_HEADER
private static Map<String,String>
XML_UNESCAPE
private static String
YES
-
Constructor Summary
Constructors Modifier Constructor Description private
Xml()
-
Method Summary
-
-
-
Field Detail
-
NULL
private static final String NULL
- See Also:
- Constant Field Values
-
ELEMENT_TEXT
private static final String ELEMENT_TEXT
- See Also:
- Constant Field Values
-
CDATA
private static final String CDATA
- See Also:
- Constant Field Values
-
COMMENT
private static final String COMMENT
- See Also:
- Constant Field Values
-
ENCODING
private static final String ENCODING
- See Also:
- Constant Field Values
-
STANDALONE
private static final String STANDALONE
- See Also:
- Constant Field Values
-
OMITXMLDECLARATION
private static final String OMITXMLDECLARATION
- See Also:
- Constant Field Values
-
YES
private static final String YES
- See Also:
- Constant Field Values
-
TEXT
private static final String TEXT
- See Also:
- Constant Field Values
-
NUMBER
private static final String NUMBER
- See Also:
- Constant Field Values
-
ELEMENT
private static final String ELEMENT
- See Also:
- Constant Field Values
-
CLOSED_ELEMENT
private static final String CLOSED_ELEMENT
- See Also:
- Constant Field Values
-
EMPTY_ELEMENT
private static final String EMPTY_ELEMENT
- See Also:
- Constant Field Values
-
NULL_TRUE
private static final String NULL_TRUE
- See Also:
- Constant Field Values
-
NUMBER_TEXT
private static final String NUMBER_TEXT
- See Also:
- Constant Field Values
-
NUMBER_TRUE
private static final String NUMBER_TRUE
- See Also:
- Constant Field Values
-
ARRAY
private static final String ARRAY
- See Also:
- Constant Field Values
-
ARRAY_TRUE
private static final String ARRAY_TRUE
- See Also:
- Constant Field Values
-
NULL_ELEMENT
private static final String NULL_ELEMENT
- See Also:
- Constant Field Values
-
BOOLEAN
private static final String BOOLEAN
- See Also:
- Constant Field Values
-
TRUE
private static final String TRUE
- See Also:
- Constant Field Values
-
SELF_CLOSING
private static final String SELF_CLOSING
- See Also:
- Constant Field Values
-
STRING
private static final String STRING
- See Also:
- Constant Field Values
-
NULL_ATTR
private static final String NULL_ATTR
- See Also:
- Constant Field Values
-
EMPTY_ARRAY
private static final String EMPTY_ARRAY
- See Also:
- Constant Field Values
-
QUOT
private static final String QUOT
- See Also:
- Constant Field Values
-
XML_HEADER
private static final String XML_HEADER
- See Also:
- Constant Field Values
-
DOCTYPE_TEXT
private static final String DOCTYPE_TEXT
- See Also:
- Constant Field Values
-
ROOT
private static final String ROOT
- See Also:
- Constant Field Values
-
DOCTYPE_HEADER
private static final String DOCTYPE_HEADER
- See Also:
- Constant Field Values
-
DOCUMENT
private static final Document DOCUMENT
-
-
Method Detail
-
toXml
public static String toXml(Collection collection, Xml.XmlStringBuilder.Step identStep)
-
toXmlWithoutRoot
public static String toXmlWithoutRoot(Collection collection, Xml.XmlStringBuilder.Step identStep)
-
toXml
public static String toXml(Collection collection)
-
toXml
public static String toXml(Map map, Xml.XmlStringBuilder.Step identStep)
-
toXml
public static String toXml(Map map, Xml.XmlStringBuilder.Step identStep, String newRootName)
-
toXml
public static String toXml(Map map, Xml.XmlStringBuilder.Step identStep, String newRootName, Xml.ArrayTrue arrayTrue)
-
checkLocalMap
private static void checkLocalMap(Xml.XmlStringBuilder builder, Map localMap, String newRootName, String arrayTrue)
-
writeArray
private static void writeArray(Collection collection, Xml.XmlStringBuilder builder, String arrayTrue)
-
checkStandalone
private static Xml.XmlStringBuilder checkStandalone(String encoding, Xml.XmlStringBuilder.Step identStep, Map localMap)
-
getValue
private static Object getValue(String name, Object value, Xml.FromType fromType)
-
createMap
private static Object createMap(Node node, BiFunction<Object,Set<String>,String> elementMapper, Function<Object,Object> nodeMapper, Map<String,Object> attrMap, int[] uniqueIds, String source, int[] sourceIndex, Set<String> namespaces, Xml.FromType fromType)
-
checkNumberAndBoolean
private static Object checkNumberAndBoolean(Map<String,Object> map, String name)
-
addElement
private static Object addElement(int[] sourceIndex, String source, BiFunction<Object,Set<String>,String> elementMapper, Function<Object,Object> nodeMapper, int[] uniqueIds, Node currentNode, Set<String> namespaces, Xml.FromType fromType)
-
addNodeValue
private static void addNodeValue(Map<String,Object> map, String name, Object value, BiFunction<Object,Set<String>,String> elementMapper, Function<Object,Object> nodeMapper, int[] uniqueIds, Set<String> namespaces, Xml.FromType fromType)
-
addText
private static void addText(Map<String,Object> map, String name, List<Object> objects, Object value, Xml.FromType fromType)
-
fromXml
public static Object fromXml(String xml, Xml.FromType fromType)
-
checkResult
private static boolean checkResult(String xml, Document document, Object result, Xml.FromType fromType)
-
fromXmlWithElementMapper
public static Object fromXmlWithElementMapper(String xml, BiFunction<Object,Set<String>,String> elementMapper)
-
fromXmlWithoutNamespacesAndAttributes
public static Object fromXmlWithoutNamespacesAndAttributes(String xml)
-
formatXml
public static String formatXml(String xml, Xml.XmlStringBuilder.Step identStep)
-
changeXmlEncoding
public static String changeXmlEncoding(String xml, Xml.XmlStringBuilder.Step identStep, String encoding)
-
-