Package com.helger.xml
Class XMLHelper.PathToNodeBuilder
- java.lang.Object
-
- com.helger.xml.XMLHelper.PathToNodeBuilder
-
- All Implemented Interfaces:
com.helger.commons.builder.IBuilder<String>
- Enclosing class:
- XMLHelper
@NotThreadSafe public static class XMLHelper.PathToNodeBuilder extends Object implements com.helger.commons.builder.IBuilder<String>
Builder class for the different possibilities to get the path of a node- Since:
- 10.2.2
- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description PathToNodeBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringbuild()XMLHelper.PathToNodeBuildercompareIncludingNamespaceURI(boolean b)Compare with namespace URI and local name, or just with the tag name.XMLHelper.PathToNodeBuilderexcludeDocumentNode()Shortcut to exclude the document Node from the resulting outputXMLHelper.PathToNodeBuilderexcludeDocumentNode(boolean b)Determine to include or exclude the document node in the resulting path.XMLHelper.PathToNodeBuilderforceUseIndex(boolean b)Enable or disable the force of an index.XMLHelper.PathToNodeBuilderincludeDocumentNode()Shortcut to include the document Node in the resulting outputXMLHelper.PathToNodeBuildernamespaceContext(NamespaceContext a)Set the optional namespace context to be used for emitting prefixes.XMLHelper.PathToNodeBuildernode(Node a)The node to get the path from.XMLHelper.PathToNodeBuilderoneBasedIndex()Shortcut to enable the usage of a one based index.XMLHelper.PathToNodeBuilderseparator(char c)Set the separator to be used.XMLHelper.PathToNodeBuilderseparator(String s)Set the separator to be used.XMLHelper.PathToNodeBuildertrailingSeparator(boolean b)Enable or disable the usage of a trailing separator.XMLHelper.PathToNodeBuilderzeroBasedIndex()Shortcut to enable the usage of a zero based index.XMLHelper.PathToNodeBuilderzeroBasedIndex(boolean b)Determine whether a 0-based index or a 1-based index should be used.
-
-
-
Method Detail
-
node
@Nonnull public XMLHelper.PathToNodeBuilder node(@Nullable Node a)
The node to get the path from.- Parameters:
a- Node to be used. Should not benull.- Returns:
- this for chaining
-
separator
@Nonnull public XMLHelper.PathToNodeBuilder separator(char c)
Set the separator to be used.- Parameters:
c- The separator char- Returns:
- this for chaining
-
separator
@Nonnull public XMLHelper.PathToNodeBuilder separator(@Nullable String s)
Set the separator to be used.- Parameters:
s- The separator string. Should not benull.- Returns:
- this for chaining
-
excludeDocumentNode
@Nonnull public XMLHelper.PathToNodeBuilder excludeDocumentNode(boolean b)
Determine to include or exclude the document node in the resulting path.- Parameters:
b-trueto exclude it,falseto include it- Returns:
- this for chaining
-
excludeDocumentNode
@Nonnull public XMLHelper.PathToNodeBuilder excludeDocumentNode()
Shortcut to exclude the document Node from the resulting output- Returns:
- this for chaining
- See Also:
excludeDocumentNode(boolean)
-
includeDocumentNode
@Nonnull public XMLHelper.PathToNodeBuilder includeDocumentNode()
Shortcut to include the document Node in the resulting output- Returns:
- this for chaining
- See Also:
excludeDocumentNode(boolean)
-
zeroBasedIndex
@Nonnull public XMLHelper.PathToNodeBuilder zeroBasedIndex(boolean b)
Determine whether a 0-based index or a 1-based index should be used. For XPath usage etc. a 1-based index should be used. For a 0-based index the first element uses[0]and for a 1-based index this is[1].- Parameters:
b-trueto use a 0-based index,false- Returns:
- this for chaining.
-
zeroBasedIndex
@Nonnull public XMLHelper.PathToNodeBuilder zeroBasedIndex()
Shortcut to enable the usage of a zero based index.- Returns:
- this for chaining
- See Also:
zeroBasedIndex(boolean)
-
oneBasedIndex
@Nonnull public XMLHelper.PathToNodeBuilder oneBasedIndex()
Shortcut to enable the usage of a one based index.- Returns:
- this for chaining
- See Also:
zeroBasedIndex(boolean)
-
forceUseIndex
@Nonnull public XMLHelper.PathToNodeBuilder forceUseIndex(boolean b)
Enable or disable the force of an index. If the index is forced, the[0]or[1], depending onzeroBasedIndex(boolean)is always emitted, even if only one element exists. If this is disabled and only element exists, the index is not emitted.- Parameters:
b-trueto force the index,falseto omit it if possible.- Returns:
- this for chaining
-
trailingSeparator
@Nonnull public XMLHelper.PathToNodeBuilder trailingSeparator(boolean b)
Enable or disable the usage of a trailing separator. If enabled, the output is e.g.element/compared to the outputelementif the trailing separator is disabled.- Parameters:
b-trueto use a trailing separator,falseto omit it.- Returns:
- this for chaining
-
compareIncludingNamespaceURI
@Nonnull public XMLHelper.PathToNodeBuilder compareIncludingNamespaceURI(boolean b)
Compare with namespace URI and local name, or just with the tag name.- Parameters:
b-trueto compare with namespace URI,falseto compare without namespace URI- Returns:
- this for chaining
-
namespaceContext
@Nonnull public XMLHelper.PathToNodeBuilder namespaceContext(@Nullable NamespaceContext a)
Set the optional namespace context to be used for emitting prefixes. This is optional.- Parameters:
a- The namespace context to be used. May benull.- Returns:
- this for chaining
-
-