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 -
Method Summary
Modifier and TypeMethodDescriptionbuild()compareIncludingNamespaceURI(boolean b) Compare with namespace URI and local name, or just with the tag name.Shortcut to exclude the document Node from the resulting outputexcludeDocumentNode(boolean b) Determine to include or exclude the document node in the resulting path.forceUseIndex(boolean b) Enable or disable the force of an index.Shortcut to include the document Node in the resulting outputSet the optional namespace context to be used for emitting prefixes.The node to get the path from.Shortcut to enable the usage of a one based index.separator(char c) Set the separator to be used.Set the separator to be used.trailingSeparator(boolean b) Enable or disable the usage of a trailing separator.Shortcut to enable the usage of a zero based index.zeroBasedIndex(boolean b) Determine whether a 0-based index or a 1-based index should be used.
-
Constructor Details
-
PathToNodeBuilder
public PathToNodeBuilder()
-
-
Method Details
-
node
The node to get the path from.- Parameters:
a- Node to be used. Should not benull.- Returns:
- this for chaining
-
separator
Set the separator to be used.- Parameters:
c- The separator char- Returns:
- this for chaining
-
separator
Set the separator to be used.- Parameters:
s- The separator string. Should not benull.- Returns:
- this for chaining
-
excludeDocumentNode
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
Shortcut to exclude the document Node from the resulting output- Returns:
- this for chaining
- See Also:
-
includeDocumentNode
Shortcut to include the document Node in the resulting output- Returns:
- this for chaining
- See Also:
-
zeroBasedIndex
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
Shortcut to enable the usage of a zero based index.- Returns:
- this for chaining
- See Also:
-
oneBasedIndex
Shortcut to enable the usage of a one based index.- Returns:
- this for chaining
- See Also:
-
forceUseIndex
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
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
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
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
-
build
- Specified by:
buildin interfacecom.helger.commons.builder.IBuilder<String>
-