public class XMLUtils extends Object
Constructor and Description |
---|
XMLUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
beginDocument(org.xmlpull.v1.XmlPullParser parser,
String firstElementName) |
static boolean |
convertValueToBoolean(CharSequence value,
boolean defaultValue) |
static int |
convertValueToInt(CharSequence charSeq,
int defaultValue) |
static int |
convertValueToList(CharSequence value,
String[] options,
int defaultValue) |
static int |
convertValueToUnsignedInt(String value,
int defaultValue) |
static void |
nextElement(org.xmlpull.v1.XmlPullParser parser) |
static int |
parseUnsignedIntAttribute(CharSequence charSeq) |
static ArrayList |
readListXml(InputStream in)
Read an ArrayList from an InputStream containing XML.
|
static Map<String,Object> |
readMapXml(InputStream in)
Read a HashMap from an InputStream containing XML.
|
static int[] |
readThisIntArrayXml(org.xmlpull.v1.XmlPullParser parser,
String endTag,
String[] name)
Read an int[] object from an XmlPullParser.
|
static ArrayList |
readThisListXml(org.xmlpull.v1.XmlPullParser parser,
String endTag,
String[] name)
Read an ArrayList object from an XmlPullParser.
|
static HashMap |
readThisMapXml(org.xmlpull.v1.XmlPullParser parser,
String endTag,
String[] name)
Read a HashMap object from an XmlPullParser.
|
static Object |
readValueXml(org.xmlpull.v1.XmlPullParser parser,
String[] name)
Read a flattened object from an XmlPullParser.
|
static void |
skipCurrentTag(org.xmlpull.v1.XmlPullParser parser) |
static void |
writeByteArrayXml(byte[] val,
String name,
org.xmlpull.v1.XmlSerializer out)
Flatten a byte[] into an XmlSerializer.
|
static void |
writeIntArrayXml(int[] val,
String name,
org.xmlpull.v1.XmlSerializer out)
Flatten an int[] into an XmlSerializer.
|
static void |
writeListXml(List val,
OutputStream out)
Flatten a List into an output stream as XML.
|
static void |
writeListXml(List val,
String name,
org.xmlpull.v1.XmlSerializer out)
Flatten a List into an XmlSerializer.
|
static void |
writeMapXml(Map val,
OutputStream out)
Flatten a Map into an output stream as XML.
|
static void |
writeMapXml(Map val,
String name,
org.xmlpull.v1.XmlSerializer out)
Flatten a Map into an XmlSerializer.
|
static void |
writeValueXml(Object v,
String name,
org.xmlpull.v1.XmlSerializer out)
Flatten an object's value into an XmlSerializer.
|
public static void skipCurrentTag(org.xmlpull.v1.XmlPullParser parser) throws org.xmlpull.v1.XmlPullParserException, IOException
org.xmlpull.v1.XmlPullParserException
IOException
public static final int convertValueToList(CharSequence value, String[] options, int defaultValue)
public static final boolean convertValueToBoolean(CharSequence value, boolean defaultValue)
public static final int convertValueToInt(CharSequence charSeq, int defaultValue)
public static final int convertValueToUnsignedInt(String value, int defaultValue)
public static final int parseUnsignedIntAttribute(CharSequence charSeq)
public static final void writeMapXml(Map val, OutputStream out) throws org.xmlpull.v1.XmlPullParserException, IOException
val
- The map to be flattened.out
- Where to write the XML data.org.xmlpull.v1.XmlPullParserException
IOException
writeMapXml(java.util.Map, String, XmlSerializer)
,
writeListXml(java.util.List, java.io.OutputStream)
,
writeValueXml(java.lang.Object, java.lang.String, org.xmlpull.v1.XmlSerializer)
,
readMapXml(java.io.InputStream)
public static final void writeListXml(List val, OutputStream out) throws org.xmlpull.v1.XmlPullParserException, IOException
val
- The list to be flattened.out
- Where to write the XML data.org.xmlpull.v1.XmlPullParserException
IOException
writeListXml(java.util.List, String, XmlSerializer)
,
writeMapXml(java.util.Map, java.io.OutputStream)
,
writeValueXml(java.lang.Object, java.lang.String, org.xmlpull.v1.XmlSerializer)
,
readListXml(java.io.InputStream)
public static final void writeMapXml(Map val, String name, org.xmlpull.v1.XmlSerializer out) throws org.xmlpull.v1.XmlPullParserException, IOException
val
- The map to be flattened.name
- Name attribute to include with this list's tag, or null for
none.out
- XmlSerializer to write the map into.org.xmlpull.v1.XmlPullParserException
IOException
writeMapXml(java.util.Map, java.io.OutputStream)
,
writeListXml(java.util.List, java.io.OutputStream)
,
writeValueXml(java.lang.Object, java.lang.String, org.xmlpull.v1.XmlSerializer)
,
readMapXml(java.io.InputStream)
public static final void writeListXml(List val, String name, org.xmlpull.v1.XmlSerializer out) throws org.xmlpull.v1.XmlPullParserException, IOException
val
- The list to be flattened.name
- Name attribute to include with this list's tag, or null for
none.out
- XmlSerializer to write the list into.org.xmlpull.v1.XmlPullParserException
IOException
writeListXml(java.util.List, java.io.OutputStream)
,
writeMapXml(java.util.Map, java.io.OutputStream)
,
writeValueXml(java.lang.Object, java.lang.String, org.xmlpull.v1.XmlSerializer)
,
readListXml(java.io.InputStream)
public static final void writeByteArrayXml(byte[] val, String name, org.xmlpull.v1.XmlSerializer out) throws org.xmlpull.v1.XmlPullParserException, IOException
val
- The byte array to be flattened.name
- Name attribute to include with this array's tag, or null for
none.out
- XmlSerializer to write the array into.org.xmlpull.v1.XmlPullParserException
IOException
writeMapXml(java.util.Map, java.io.OutputStream)
,
writeValueXml(java.lang.Object, java.lang.String, org.xmlpull.v1.XmlSerializer)
public static final void writeIntArrayXml(int[] val, String name, org.xmlpull.v1.XmlSerializer out) throws org.xmlpull.v1.XmlPullParserException, IOException
val
- The int array to be flattened.name
- Name attribute to include with this array's tag, or null for
none.out
- XmlSerializer to write the array into.org.xmlpull.v1.XmlPullParserException
IOException
writeMapXml(java.util.Map, java.io.OutputStream)
,
writeValueXml(java.lang.Object, java.lang.String, org.xmlpull.v1.XmlSerializer)
,
readThisIntArrayXml(org.xmlpull.v1.XmlPullParser, java.lang.String, java.lang.String[])
public static final void writeValueXml(Object v, String name, org.xmlpull.v1.XmlSerializer out) throws org.xmlpull.v1.XmlPullParserException, IOException
v
- The object to be flattened.name
- Name attribute to include with this value's tag, or null
for none.out
- XmlSerializer to write the object into.org.xmlpull.v1.XmlPullParserException
IOException
writeMapXml(java.util.Map, java.io.OutputStream)
,
writeListXml(java.util.List, java.io.OutputStream)
,
readValueXml(org.xmlpull.v1.XmlPullParser, java.lang.String[])
public static final Map<String,Object> readMapXml(InputStream in) throws org.xmlpull.v1.XmlPullParserException, IOException
in
- The InputStream from which to read.org.xmlpull.v1.XmlPullParserException
IOException
readListXml(java.io.InputStream)
,
readValueXml(org.xmlpull.v1.XmlPullParser, java.lang.String[])
,
#see #writeMapXml
public static final ArrayList readListXml(InputStream in) throws org.xmlpull.v1.XmlPullParserException, IOException
in
- The InputStream from which to read.org.xmlpull.v1.XmlPullParserException
IOException
readMapXml(java.io.InputStream)
,
readValueXml(org.xmlpull.v1.XmlPullParser, java.lang.String[])
,
readThisListXml(org.xmlpull.v1.XmlPullParser, java.lang.String, java.lang.String[])
,
writeListXml(java.util.List, java.io.OutputStream)
public static final HashMap readThisMapXml(org.xmlpull.v1.XmlPullParser parser, String endTag, String[] name) throws org.xmlpull.v1.XmlPullParserException, IOException
parser
- The XmlPullParser from which to read the map data.endTag
- Name of the tag that will end the map, usually "map".name
- An array of one string, used to return the name attribute
of the map's tag.org.xmlpull.v1.XmlPullParserException
IOException
readMapXml(java.io.InputStream)
public static final ArrayList readThisListXml(org.xmlpull.v1.XmlPullParser parser, String endTag, String[] name) throws org.xmlpull.v1.XmlPullParserException, IOException
parser
- The XmlPullParser from which to read the list data.endTag
- Name of the tag that will end the list, usually "list".name
- An array of one string, used to return the name attribute
of the list's tag.org.xmlpull.v1.XmlPullParserException
IOException
readListXml(java.io.InputStream)
public static final int[] readThisIntArrayXml(org.xmlpull.v1.XmlPullParser parser, String endTag, String[] name) throws org.xmlpull.v1.XmlPullParserException, IOException
parser
- The XmlPullParser from which to read the list data.endTag
- Name of the tag that will end the list, usually "list".name
- An array of one string, used to return the name attribute
of the list's tag.org.xmlpull.v1.XmlPullParserException
IOException
readListXml(java.io.InputStream)
public static final Object readValueXml(org.xmlpull.v1.XmlPullParser parser, String[] name) throws org.xmlpull.v1.XmlPullParserException, IOException
parser
- The XmlPullParser from which to read the object.name
- An array of one string, used to return the name attribute
of the value's tag.org.xmlpull.v1.XmlPullParserException
IOException
readMapXml(java.io.InputStream)
,
readListXml(java.io.InputStream)
,
writeValueXml(java.lang.Object, java.lang.String, org.xmlpull.v1.XmlSerializer)
public static final void beginDocument(org.xmlpull.v1.XmlPullParser parser, String firstElementName) throws org.xmlpull.v1.XmlPullParserException, IOException
org.xmlpull.v1.XmlPullParserException
IOException
public static final void nextElement(org.xmlpull.v1.XmlPullParser parser) throws org.xmlpull.v1.XmlPullParserException, IOException
org.xmlpull.v1.XmlPullParserException
IOException
Copyright © 2012-2013 ADELE Research Group. All Rights Reserved.