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 classXml.ArrayTrueprivate static classXml.Documentstatic classXml.FromTypeprivate static classXml.MyEntityResolverstatic classXml.XmlArraystatic classXml.XmlObjectstatic classXml.XmlStringBuilderstatic classXml.XmlStringBuilderTextstatic classXml.XmlStringBuilderWithoutHeaderstatic classXml.XmlStringBuilderWithoutRootstatic classXml.XmlValue
-
Field Summary
Fields Modifier and Type Field Description private static StringARRAYprivate static StringARRAY_TRUEprivate static PatternATTRSprivate static StringBOOLEANprivate static StringCDATAprivate static StringCLOSED_ELEMENTprivate static StringCOMMENTprivate static StringDOCTYPE_HEADERprivate static StringDOCTYPE_TEXTprivate static DocumentDOCUMENTprivate static StringELEMENTprivate static StringELEMENT_TEXTprivate static StringEMPTY_ARRAYprivate static StringEMPTY_ELEMENTprivate static StringENCODINGprivate static StringNULLprivate static StringNULL_ATTRprivate static StringNULL_ELEMENTprivate static StringNULL_TRUEprivate static StringNUMBERprivate static StringNUMBER_TEXTprivate static StringNUMBER_TRUEprivate static StringOMITXMLDECLARATIONprivate static StringQUOTprivate static StringROOTprivate static StringSELF_CLOSINGprivate static StringSTANDALONEprivate static StringSTRINGprivate static StringTEXTprivate static StringTRUEprivate static StringXML_HEADERprivate static Map<String,String>XML_UNESCAPEprivate static StringYES
-
Constructor Summary
Constructors Modifier Constructor Description privateXml()
-
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
-
ATTRS
private static final Pattern ATTRS
-
DOCUMENT
private static final Document DOCUMENT
-
-
Method Detail
-
toXml
public static String toXml(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)
-
-