Class PathUtils
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.artifactModel.xml.PathUtils
-
public class PathUtils extends java.lang.ObjectNormalizes a path into an XML document.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringSEPARATORThe separator between element names.
-
Constructor Summary
Constructors Constructor Description PathUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Stringnormalize(java.lang.String path)Normalizes the given path (removes superfluousseparators).(package private) static Set<XmlElement>selectByPath(IXmlContainer container, java.lang.String path)Selects XML elements fromcontaineraccording to a given path.static Set<XmlElement>selectByXPath(java.lang.String path, java.lang.Object root, IXmlContainer container)Selects XML elements based on a given XPath expression.
-
-
-
Field Detail
-
SEPARATOR
public static final java.lang.String SEPARATOR
The separator between element names.- See Also:
- Constant Field Values
-
-
Method Detail
-
normalize
public static java.lang.String normalize(java.lang.String path)
Normalizes the given path (removes superfluousseparators).- Parameters:
path- the path to be normalized- Returns:
- the normalized path
-
selectByPath
static Set<XmlElement> selectByPath(IXmlContainer container, java.lang.String path) throws VilException
Selects XML elements fromcontaineraccording to a given path. We may go for XPath expressions in future.- Parameters:
container- the container to select frompath- the normalized (!) path to the elements (usenormalize(String)before calling)- Returns:
- the matching elements (may be empty)
- Throws:
VilException- in case invalid XmlElements are used.
-
selectByXPath
public static Set<XmlElement> selectByXPath(java.lang.String path, java.lang.Object root, IXmlContainer container) throws VilException
Selects XML elements based on a given XPath expression.- Parameters:
path- the XPath expressionroot- the XML element to start evaluating the XPath expression atcontainer- the XML container- Returns:
- the resulting elements
- Throws:
VilException- in case invalid XmlElements are used orpathis invalid.
-
-