public class PsXmlSrc
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
PsXmlSrc()
Constructor with no action.
|
Modifier and Type | Method and Description |
---|---|
static PsXmlNode |
assureChild(PsXmlNode parent,
java.lang.String type)
Assure existence of a child node of given element type, and create it if necessary.
|
java.lang.String |
getDocName()
Get name of root element of associated DTD, or null.
|
java.lang.String |
getDocType()
Get url of associated DTD, or null.
|
java.lang.String |
getParameter(java.lang.String name)
Get a parameter given by hierarchical name.
|
PsXmlNode |
getRootNode()
Get root node of resource tree.
|
static java.lang.String |
getRsrc(PsXmlNode rsrcNode,
java.lang.String type)
Get content of node in resource tree with given element type by searching from given node.
|
static boolean |
getRsrcAsBoolean(PsXmlNode rsrcNode,
java.lang.String type)
Get content of node in resource tree with given element type by searching from given node.
|
static double |
getRsrcAsDouble(PsXmlNode rsrcNode,
java.lang.String type)
Get content of node in resource tree with given element type by searching from given node.
|
static int |
getRsrcAsInteger(PsXmlNode rsrcNode,
java.lang.String type)
Get content of node in resource tree with given element type by searching from given node.
|
java.lang.String |
getRsrcFile()
Get resource file name.
|
static PsXmlNode |
getRsrcNode(PsXmlNode rsrcNode,
java.lang.String type)
Get descendant node in resource tree with given element type.
|
static PsXmlNode[] |
getRsrcNodes(PsXmlNode rsrcNode)
Get children nodes of a given element.
|
static PsXmlNode[] |
getRsrcNodes(PsXmlNode rsrcNode,
java.lang.String type)
Get nodes in resource tree with given element type by searching from given node.
|
void |
setDocName(java.lang.String name)
Set name of root element of associated DTD, or null.
|
void |
setDocType(java.lang.String type)
Set url of associated DTD, or null.
|
void |
setRootNode(PsXmlNode root)
Set root node of resource tree.
|
void |
setRsrcFile(java.lang.String rsrcFile)
Set name of resource name.
|
static java.lang.String |
write(PsXmlSrc src)
Writes an XML tree into a string.
|
static boolean |
write(java.io.Writer writer,
PsXmlSrc src)
Writes an XML tree into a writer.
|
public static java.lang.String write(PsXmlSrc src)
src
- an XML source with XML treepublic static boolean write(java.io.Writer writer, PsXmlSrc src) throws java.io.IOException
writer
- Write all data to this streamsrc
- an XML source with XML treetrue
on success.java.io.IOException
public java.lang.String getParameter(java.lang.String name)
name
- (incomplete) hierarchical name of an element or attribute.public java.lang.String getRsrcFile()
setRsrcFile(String)
.public void setRsrcFile(java.lang.String rsrcFile)
rsrcFile
- name of a XML filepublic java.lang.String getDocName()
public void setDocName(java.lang.String name)
public java.lang.String getDocType()
public void setDocType(java.lang.String type)
public PsXmlNode getRootNode()
public void setRootNode(PsXmlNode root)
root
- new root nodepublic static PsXmlNode assureChild(PsXmlNode parent, java.lang.String type)
parent
- to be checked whether it has a decendent node of given element type.type
- element type of node to be assuredpublic static PsXmlNode getRsrcNode(PsXmlNode rsrcNode, java.lang.String type)
rsrcNode
- node whose descendants are searched including itselftype
- element type of node to be searchednull
public static PsXmlNode[] getRsrcNodes(PsXmlNode rsrcNode, java.lang.String type)
rsrcNode
- node whose descendants are searched including itselftype
- element type of node to be searchedpublic static PsXmlNode[] getRsrcNodes(PsXmlNode rsrcNode)
rsrcNode
- node whose descendants are searched including itselfpublic static java.lang.String getRsrc(PsXmlNode rsrcNode, java.lang.String type)
rsrcNode
- node whose descendants are searched including itselftype
- element type of node to be searchednull
.public static double getRsrcAsDouble(PsXmlNode rsrcNode, java.lang.String type)
rsrcNode
- node whose descendants are searched including itselftype
- element type of node to be searchedpublic static int getRsrcAsInteger(PsXmlNode rsrcNode, java.lang.String type)
rsrcNode
- node whose descendants are searched including itselftype
- element type of node to be searchedpublic static boolean getRsrcAsBoolean(PsXmlNode rsrcNode, java.lang.String type)
rsrcNode
- node whose descendants are searched including itselftype
- element type of node to be searchedfalse
."