public class ParserHelper extends Object implements ParserConstants
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
logger |
ABSTRACT, ALIAS, BEAN, BEAN_PROPERTY_PREFIX, BEAN_PROPERTY_REF_SUFFIX, CLASS, CONSTRUCTOR_ARGS, DESTROY_METHOD, ENTRY, FACTORY_BEAN, FACTORY_METHOD, ID, IDREF, INDEX, INIT_METHOD, KEY, KEY_REF, LIST, LOCAL, MAP, NAME, NULL, PARENT, PROP, PROPS, PROTOTYPE, REF, RESOURCE, SCOPE, SET, SINGLETON, TYPE, VALUE, VALUE_REF, XML_NAMESPACE_DEF, XML_NAMESPACE_DELIMITER, XPATH_BEAN, XPATH_BEANS_NODE, XPATH_IMPORT, XPATH_PROPERTY| Constructor and Description |
|---|
ParserHelper() |
| Modifier and Type | Method and Description |
|---|---|
static Property |
buildContructorArgument(int index,
String value,
String ref) |
static Boolean |
extractAttributeValueAsBoolean(String attributeName,
NamedNodeMap attributes,
Boolean defaultValue)
Extract an attribute value as Boolean
|
static String |
extractAttributeValueAsString(String attributeName,
NamedNodeMap attributes,
String defaultValue)
Extract an attribute value as text
|
static org.apache.commons.lang3.tuple.Pair<String,String> |
extractBeanId(Node beanNode)
Extract the name and id attributes of a node a resolve it as an
|
static String |
extractFirstChildValue(Node node)
Extract text value for nodes like
|
static Node |
extractFirstNodeByName(NodeList nodes,
String name,
String namespacePrefix)
Go through a node list a extract the first matching node given its name
|
static Map<String,String> |
extractNamespacePrefix(NodeList nodes)
Parse a NodeList for XML namespace declaration attributes and build a mapping associating each namespace with its prefix
|
static Collection<Node> |
extractNodesByName(NodeList nodes,
String name,
String namespacePrefix)
Go through a node list a extract the first matching node given its name
|
static Property |
getRef(String propertyName,
String ref)
Builds a ref property
|
static Property |
getVal(String propertyName,
String value)
Builds a value property
|
static Property |
handleValueRefAttributes(String propName,
Node node)
Handle value, ref and idref attribute of an XML node and builds the corresponding property
|
static boolean |
match(String expectedName,
String nodeName,
String prefix)
Check whether a node has the expected name after prefix resolution
|
static String |
prefixedName(String prefix,
String name)
Build full name of an element given the prefix of its namespace
|
public static Property getVal(String propertyName, String value)
propertyName - name of the Property to buildvalue - of the Property to buildpublic static Property getRef(String propertyName, String ref)
propertyName - name of the Property to buildref - of the Property to buildpublic static Property handleValueRefAttributes(String propName, Node node)
propName - name of the Property to buildnode - to analyzepublic static Property buildContructorArgument(int index, String value, String ref)
index - of the constructor argumentvalue - of the argumentref - (for ref argument)public static org.apache.commons.lang3.tuple.Pair<String,String> extractBeanId(Node beanNode)
beanNode - to parsepublic static String extractAttributeValueAsString(String attributeName, NamedNodeMap attributes, String defaultValue)
attributeName - name of the attribute to extractattributes - Map of the nodepublic static Boolean extractAttributeValueAsBoolean(String attributeName, NamedNodeMap attributes, Boolean defaultValue)
attributeName - name of the attribute to extractattributes - Map of the nodepublic static String extractFirstChildValue(Node node)
node - public static Node extractFirstNodeByName(NodeList nodes, String name, String namespacePrefix)
nodes - name - public static Collection<Node> extractNodesByName(NodeList nodes, String name, String namespacePrefix)
nodes - name - public static Map<String,String> extractNamespacePrefix(NodeList nodes)
nodes - to analyzepublic static String prefixedName(String prefix, String name)
prefix - of the namespace the element belongs toname - of the elementpublic static boolean match(String expectedName, String nodeName, String prefix)
expectedName - unprefixed expected namenodeName - full name of the element to compareprefix - of the namespace the expected element belongs toCopyright © 2012-2013 Static IOC OSS project. All Rights Reserved.