public class DomTools extends Object
| Modifier and Type | Field and Description |
|---|---|
static Date |
BIGBANG |
static String |
DBNULL |
static Date |
OBLIVIAN |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
boolAttr(Node n,
String aname) |
static boolean |
boolAttr(Node n,
String aname,
boolean defval) |
static Boolean |
booleanNode(Node rootnode,
String name)
Finds the child node with the name specified, and returns it as a
boolean value.
|
static boolean |
boolNode(Node rootnode,
String name)
Finds the child node with the name specified, and returns it as a
boolean value.
|
static Date |
dateDecode(String s)
Decodes a date and converts it to the local time.
|
static String |
dateEncode(Date dt)
Encodes a date-only field to some readable form.
|
static Date |
dateNode(Node rn,
String name) |
static Date |
dateNode(Node rn,
String name,
Date dflt) |
static boolean |
decodeBoolStr(String nt,
String name) |
static double |
doubleNode(Node rootnode,
String name,
double val) |
static String |
fileNameNode(Node rootnode,
String name)
Checks if there's a file node with the spec'd name in the node.
|
static String |
findChildNodeValue(Node rootnode,
String name)
Deprecated.
|
static Document |
getDocument(File inf,
boolean nsaware)
Creates a DOM parser, parses the document, and returns the DOM
associated with the thing.
|
static Document |
getDocument(File inf,
ErrorHandler eh,
boolean nsaware)
Creates a DOM parser, parses the document, and returns the DOM
associated with the thing.
|
static Document |
getDocument(InputStream is,
String ident,
boolean nsaware)
Creates a DOM parser, parses the document, and returns the DOM
associated with the thing.
|
static Document |
getDocument(InputStream is,
String ident,
ErrorHandler eh,
boolean nsaware)
Creates a DOM parser, parses the document, and returns the DOM
associated with the thing.
|
static Document |
getDocument(Reader is,
String ident,
boolean nsaware)
Creates a DOM parser, parses the document, and returns the DOM
associated with the thing.
|
static Document |
getDocument(Reader is,
String ident,
ErrorHandler eh,
boolean nsaware)
Creates a DOM parser, parses the document, and returns the DOM
associated with the thing.
|
static Document |
getDocumentFromZIP(File zipfile,
String name,
ErrorHandler eh,
boolean nsaware) |
static Node |
getDocumentRoot(String txt,
String ident,
boolean nsaware) |
static Node |
getDocumentRoot(String txt,
String ident,
ErrorHandler eh,
boolean nsaware) |
static int |
getNodeAttribute(Node n,
String aname,
int defval)
Get the named attribute from a node.
|
static String |
getNodeAttribute(Node n,
String aname,
String defval)
Get the named attribute from a node.
|
static Node |
getRootElement(Document doc) |
static XMLInputFactory |
getStreamFactory()
Get a stream reader that does not ^&*^(^$ connect to the Internet while fscking reading xml 8-(
|
static String[] |
getStringList(Node inn,
String itemname) |
static List<String> |
getStringList(Node inn,
String listname,
String itemname) |
static int |
intAttr(Node n,
String aname) |
static int |
intAttr(Node n,
String aname,
int defval) |
static int |
intNode(Node rootnode,
String name) |
static int |
intNode(Node rootnode,
String name,
int val) |
static boolean |
isBigBang(Date dt) |
static boolean |
isOblivian(Date dt) |
static boolean |
isTextOnly(Node inn) |
static long |
longAttr(Node n,
String aname) |
static Long |
longAttrWrapped(Node n,
String aname) |
static long |
longNode(Node rootnode,
String name) |
static long |
longNode(Node rootnode,
String name,
long val) |
static Long |
longWrapperNode(Node rootnode,
String name) |
static Node |
nodeFind(Node rn,
String name)
Finds a single element with the name spec'd in the node.
|
static Node |
nodeFindXpath(Node node,
String xpathQuery)
Finds a child node, via the xpath query route.
|
static List<Node> |
nodesFind(Node rn,
String name)
Searches for child Nodes in the specified Node which have the specified
name and returns the result as a Set.
|
static void |
saveDocument(File of,
Document doc) |
static void |
saveDocument(Writer of,
Document doc) |
static void |
setAttr(Node elem,
String name,
String value) |
static String |
strAttr(Node n,
String aname) |
static String |
strAttr(Node n,
String aname,
String def) |
static String |
stringNode_untrimmed(Node rootnode,
String name)
Finds the child node with the name specified, and returns it's text
value.
|
static String |
stringNode_untrimmed(Node rootnode,
String name,
String deflt)
Finds the child node with the name specified, and returns it's text
value.
|
static String |
stringNode(Node rootnode,
String name)
Finds the child node with the name specified, and returns it's text
value.
|
static String |
stringNode(Node rootnode,
String name,
int trunclen)
Finds the child node with the name specified, and returns it's text
value.
|
static String |
stringNode(Node rootnode,
String name,
String deflt)
Finds the child node with the name specified, and returns it's text
value.
|
static String |
textFrom_untrimmed(Node n)
Gets the text part contained in a node...
|
static String |
textFrom(Node n)
Gets the text part contained in a node...
|
static int |
timeNode(Node rn,
String name,
int dflt)
Scans a node as a hh:mm:ss time (or hh:mm).
|
public static final Date OBLIVIAN
public static final Date BIGBANG
public static final String DBNULL
public static Document getDocument(InputStream is, String ident, ErrorHandler eh, boolean nsaware) throws Exception
Exceptionpublic static Node getDocumentRoot(String txt, String ident, ErrorHandler eh, boolean nsaware) throws Exception
Exceptionpublic static Node getDocumentRoot(String txt, String ident, boolean nsaware) throws Exception
Exceptionpublic static Document getDocument(Reader is, String ident, ErrorHandler eh, boolean nsaware) throws Exception
Exceptionpublic static Document getDocument(File inf, ErrorHandler eh, boolean nsaware) throws Exception
Exception@Nonnull public static Document getDocument(@Nonnull File inf, boolean nsaware) throws Exception
Exceptionpublic static Document getDocument(InputStream is, String ident, boolean nsaware) throws Exception
Exceptionpublic static Document getDocument(Reader is, String ident, boolean nsaware) throws Exception
Exceptionpublic static Document getDocumentFromZIP(File zipfile, String name, ErrorHandler eh, boolean nsaware) throws Exception
Exceptionpublic static Node nodeFind(Node rn, String name) throws Exception
Exceptionpublic static List<Node> nodesFind(Node rn, String name)
rn, - the Node which is queried.name, - the name of the childNodes we are searching.public static String textFrom_untrimmed(Node n)
@Nullable public static String textFrom(@Nonnull Node n)
@Deprecated public static String findChildNodeValue(Node rootnode, String name) throws Exception
ExceptionstringNode(Node, String)public static String stringNode(Node rootnode, String name) throws Exception
Exceptionpublic static String stringNode(Node rootnode, String name, int trunclen) throws Exception
Exceptionpublic static String stringNode(Node rootnode, String name, String deflt) throws Exception
Exceptionpublic static String stringNode_untrimmed(Node rootnode, String name) throws Exception
Exceptionpublic static String stringNode_untrimmed(Node rootnode, String name, String deflt) throws Exception
Exceptionpublic static Date dateNode(Node rn, String name, Date dflt) throws Exception
Exceptionpublic static int timeNode(Node rn, String name, int dflt) throws Exception
rn - name - dflt - Exceptionpublic static int intNode(Node rootnode, String name, int val) throws Exception
Exceptionpublic static Long longWrapperNode(Node rootnode, String name) throws Exception
Exceptionpublic static long longNode(Node rootnode, String name, long val) throws Exception
Exceptionpublic static double doubleNode(Node rootnode, String name, double val) throws Exception
Exceptionpublic static String fileNameNode(Node rootnode, String name) throws Exception
rootnode - name - Exceptionpublic static boolean boolNode(Node rootnode, String name) throws Exception
Exceptionpublic static Boolean booleanNode(Node rootnode, String name) throws Exception
Exceptionpublic static String getNodeAttribute(@Nonnull Node n, @Nonnull String aname, @Nullable String defval)
n - the node to containing the attribute.aname - the name of the attribute.defval - the value to return if the attribute is not present,public static int intAttr(Node n, String aname, int defval) throws Exception
Exceptionpublic static Long longAttrWrapped(Node n, String aname) throws Exception
Exceptionpublic static boolean boolAttr(Node n, String aname, boolean defval) throws Exception
Exceptionpublic static int getNodeAttribute(Node n, String aname, int defval) throws Exception
n - the node to containing the attribute.aname - the name of the attribute.defval - the value to return if the attribute is not present,Exceptionpublic static String dateEncode(Date dt)
dt - the date to encode.public static Date dateDecode(String s)
Format: 0123456789012345678901234567 2001-12-24 18:10:52.0012 (timezone)
s - public static final boolean isOblivian(Date dt)
public static final boolean isBigBang(Date dt)
public static final String[] getStringList(Node inn, String itemname) throws Exception
Exceptionpublic static final List<String> getStringList(Node inn, String listname, String itemname) throws Exception
Exceptionpublic static boolean isTextOnly(Node inn)
public static void saveDocument(File of, Document doc) throws Exception
Exceptionpublic static void saveDocument(Writer of, Document doc) throws Exception
Exceptionpublic static Node nodeFindXpath(Node node, String xpathQuery) throws Exception
node - the node to searchxpathQuery - path to the child nodeException@Nonnull public static XMLInputFactory getStreamFactory()
Copyright © 2017 etc.to. All rights reserved.