public class OwStandardXMLUtil extends Object implements OwXMLUtil
Implements OwXMLUtil utility class for structured configuration data access.
Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.
For licensing information read the license.txt file or
go to: http://wiki.alfresco.com
Modifier and Type | Field and Description |
---|---|
static String |
DEPTH_FIRST_PREORDER
Defines a search order based on the order in which the searched nodes are
encountered in a pre-order traversal of the Document tree.
|
static String |
WIDTH_FIRST_LEVEL_ORDER
Defines a search order based on the order in which the searched nodes are
encountered in level-first-order traversal of the Document tree.
|
Constructor and Description |
---|
OwStandardXMLUtil()
construct an empty configuration
|
OwStandardXMLUtil(InputStream inputStream_p,
String strRootNodeName_p)
Construct the utility class, wrap around the given first root node.
|
OwStandardXMLUtil(InputStream inputStream_p,
String strRootNodeName_p,
String rootSearchMode_p)
Construct the utility class, wrap around the given first root node.
|
OwStandardXMLUtil(Node node_p)
construct the utility class, wrap around the given node
|
Modifier and Type | Method and Description |
---|---|
String |
getFileEncoding() |
protected String |
getKeyName(Node node_p)
(overridable) get the name the node is keyed in the lookup map
|
String |
getName()
Return the name (tag-name) of this instance
|
Node |
getNode()
return the wrapped DOM Node reference
|
boolean |
getSafeBooleanAttributeValue(String strAttributeName_p,
boolean fDefault_p)
get the value of a boolean attribute [true | false], catch exception
|
boolean |
getSafeBooleanValue(String strNodeName_p,
boolean fDefault_p)
get the value of a sub boolean node [true | false], catch exception
|
List |
getSafeCDATAList()
retrieve a CDATA strings list in the node
|
List |
getSafeCDATAList(String strNodeName_p)
retrieve a CDATA string list in a subnode
|
int |
getSafeIntegerAttributeValue(String strAttributeName_p,
int iDefault_p)
get the value of a string attribute, catch exception
|
int |
getSafeIntegerValue(String strNodeName_p,
int fDefault_p)
get the value of a sub Integer node, catch exception
|
List |
getSafeNodeList()
retrieve a node list in a subnode
|
List |
getSafeNodeList(String strNodeName_p)
retrieve a node list in a subnode
|
String |
getSafeStringAttributeValue(String strAttributeName_p,
String strDefault_p)
get the value of a string attribute, catch exception
|
List |
getSafeStringList()
retrieve a string list in the node
|
List |
getSafeStringList(String strNodeName_p)
retrieve a string list in a subnode
|
Set |
getSafeStringSet(String strNodeName_p)
retrieve a string list in a subnode
|
String |
getSafeTextValue(String strDefault_p)
get the value of THE node, catch exception
|
String |
getSafeTextValue(String strNodeName_p,
String strDefault_p)
get the value of a sub text node, catch exception
|
List |
getSafeUtilList(String itemName_p)
get a list with OwXMLUtil's
|
List |
getSafeUtilList(String nodeName_p,
String itemName_p)
get a list with OwXMLUtil's with the given subname
|
Node |
getSubNode(String strNodeName_p)
get the subnode with the given tag name
|
OwXMLUtil |
getSubUtil(String strName_p)
get a sub util node with the given name
|
URL |
getURLFromNode(String nodeName_p)
Helper method to create an URL from given configuration node.
|
void |
setFileEncoding(String mFileEncoding_p) |
protected void |
setNode(Node node_p) |
String |
toString() |
void |
writeHtmlDump(Writer w_p)
write configuration as HTML to a writer object
|
void |
writeHtmlDumpFiltered(Writer htmlWriter_p,
Map<String,String> hiddenTags)
write configuration as HTML to a writer object and filter xml tags
|
public static final String DEPTH_FIRST_PREORDER
public static final String WIDTH_FIRST_LEVEL_ORDER
public OwStandardXMLUtil() throws Exception
Exception
public OwStandardXMLUtil(Node node_p) throws Exception
node_p
- DOM NodeException
public OwStandardXMLUtil(InputStream inputStream_p, String strRootNodeName_p) throws Exception
DEPTH_FIRST_PREORDER
.inputStream_p
- Input Stream with XML ContentstrRootNodeName_p
- Name of the root node to be wrapped by the utility class. The
root node is searched in the order in which nodes are
encountered in a pre-order traversal of the Document tree (see
DEPTH_FIRST_PREORDER
).Exception
public OwStandardXMLUtil(InputStream inputStream_p, String strRootNodeName_p, String rootSearchMode_p) throws Exception
inputStream_p
- Input Stream with XML ContentstrRootNodeName_p
- Name of the root node to be wrapped by the utility class. The
root node is searched in the order given by
rootSearchMode_p
parameter.rootSearchMode_p
- Defines the search order for the root node search. Must be one
of DEPTH_FIRST_PREORDER
or
WIDTH_FIRST_LEVEL_ORDER
.Exception
protected String getKeyName(Node node_p)
node_p
- public List getSafeStringList()
getSafeStringList
in interface OwXMLUtil
public List getSafeCDATAList()
getSafeCDATAList
in interface OwXMLUtil
public List getSafeCDATAList(String strNodeName_p)
getSafeCDATAList
in interface OwXMLUtil
public List getSafeStringList(String strNodeName_p)
getSafeStringList
in interface OwXMLUtil
strNodeName_p
- String name of the subnode with the string listpublic Set getSafeStringSet(String strNodeName_p)
getSafeStringSet
in interface OwXMLUtil
strNodeName_p
- String name of the subnode with the string listpublic String getSafeStringAttributeValue(String strAttributeName_p, String strDefault_p)
getSafeStringAttributeValue
in interface OwXMLUtil
strAttributeName_p
- name of the String attributestrDefault_p
- Default string in case the attribute could not be foundpublic int getSafeIntegerAttributeValue(String strAttributeName_p, int iDefault_p)
getSafeIntegerAttributeValue
in interface OwXMLUtil
strAttributeName_p
- name of the String attributeiDefault_p
- Default int in case the attribute could not be foundpublic boolean getSafeBooleanAttributeValue(String strAttributeName_p, boolean fDefault_p)
getSafeBooleanAttributeValue
in interface OwXMLUtil
strAttributeName_p
- name of the String attributefDefault_p
- Default string in case the attribute could not be foundpublic boolean getSafeBooleanValue(String strNodeName_p, boolean fDefault_p)
getSafeBooleanValue
in interface OwXMLUtil
strNodeName_p
- name of the subnodefDefault_p
- Default value in case the node could not be foundpublic URL getURLFromNode(String nodeName_p) throws MalformedURLException
getURLFromNode
in interface OwXMLUtil
nodeName_p
- String name of child node, where to extract the URLMalformedURLException
- if the extracted text is not URL conform stringpublic int getSafeIntegerValue(String strNodeName_p, int fDefault_p)
getSafeIntegerValue
in interface OwXMLUtil
strNodeName_p
- name of the subnodefDefault_p
- Default value in case the node could not be foundpublic String getSafeTextValue(String strNodeName_p, String strDefault_p)
getSafeTextValue
in interface OwXMLUtil
strNodeName_p
- name of the text subnodestrDefault_p
- Default string in case the node could not be foundpublic String getSafeTextValue(String strDefault_p)
getSafeTextValue
in interface OwXMLUtil
strDefault_p
- Default string in case the node could not be foundpublic Node getNode()
protected void setNode(Node node_p)
public Node getSubNode(String strNodeName_p) throws Exception
getSubNode
in interface OwXMLUtil
strNodeName_p
- tag name of requested nodeException
public List getSafeNodeList()
getSafeNodeList
in interface OwXMLUtil
public List getSafeNodeList(String strNodeName_p)
getSafeNodeList
in interface OwXMLUtil
strNodeName_p
- String name of the subnode with the node listpublic void writeHtmlDump(Writer w_p) throws Exception
writeHtmlDump
in interface OwXMLUtil
w_p
- a Writer
Exception
public List getSafeUtilList(String nodeName_p, String itemName_p)
OwXMLUtil
getSafeUtilList
in interface OwXMLUtil
nodeName_p
- the subnode nameitemName_p
- the name of the item's or null to retrieve all itemsList
public List getSafeUtilList(String itemName_p)
OwXMLUtil
getSafeUtilList
in interface OwXMLUtil
itemName_p
- the name of the item's or null to retrieve all itemsList
public OwXMLUtil getSubUtil(String strName_p) throws Exception
OwXMLUtil
getSubUtil
in interface OwXMLUtil
strName_p
- the subnode nameException
public String getFileEncoding()
public void setFileEncoding(String mFileEncoding_p)
public void writeHtmlDumpFiltered(Writer htmlWriter_p, Map<String,String> hiddenTags) throws Exception
OwXMLUtil
writeHtmlDumpFiltered
in interface OwXMLUtil
htmlWriter_p
- a Writer
hiddenTags
- Map
Exception
public String getName()
OwXMLUtil
Copyright © 2014 Alfresco Business Solutions. All Rights Reserved.