public class XMLNode
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,java.lang.String> |
attributes
The attributes.
|
protected java.util.List<XMLNode> |
children
The children nodes.
|
protected java.lang.String |
name
The node name.
|
protected XMLNode |
nodeParent
The node parent.
|
Constructor and Description |
---|
XMLNode(java.lang.String nodeName)
Create the Node.
|
XMLNode(XMLNode parent,
java.lang.String nodeName)
Create a Node.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(java.lang.String attrName,
boolean value)
Add an attribute for this Node.
|
void |
addAttribute(java.lang.String attrName,
float value)
Add an attribute for this Node.
|
void |
addAttribute(java.lang.String attrName,
int value)
Add an attribute for this Node.
|
void |
addAttribute(java.lang.String attrName,
java.lang.String value)
Add an attribute for this Node.
|
void |
addChild(XMLNode child)
Add a child to this Node.
|
int |
countAttributes()
Return the number of attributes of the Node.
|
int |
countChildren()
Return the number of children of the Node.
|
boolean |
equals(java.lang.Object obj) |
java.util.Map<java.lang.String,java.lang.String> |
getAttributes()
Return the Map of attributes for this node.
|
java.lang.String |
getAttributeValue(java.lang.String attrName)
Return the value of an attribute of a specified name.
|
boolean |
getAttributeValueAsBoolean(java.lang.String attrName)
Return the value of an attribute of a specified name as a boolean.
|
boolean |
getAttributeValueAsBoolean(java.lang.String attrName,
boolean defaultValue)
Return the value of an attribute of a specified name as a boolean.
|
float |
getAttributeValueAsFloat(java.lang.String attrName)
Return the value of an attribute of a specified name as a float.
|
float |
getAttributeValueAsFloat(java.lang.String attrName,
float defaultValue)
Return the value of an attribute of a specified name as a float.
|
int |
getAttributeValueAsInt(java.lang.String attrName)
Return the value of an attribute of a specified name as an int.
|
int |
getAttributeValueAsInt(java.lang.String attrName,
int defaultValue)
Return the value of an attribute of a specified name as an int.
|
java.lang.String |
getCDATA()
Return the CDATA content for the node.
|
java.util.List<XMLNode> |
getChildren()
Return the ordered list of children of this Node.
|
double |
getDoubleValue(java.lang.String attrName)
Return the value of an attribute of a specified name as a double.
|
double |
getDoubleValue(java.lang.String attrName,
double defaultValue)
Return the value of an attribute of a specified name as a double.
|
XMLNode |
getFirstChild()
Return the first child of the Node.
|
XMLNode |
getLastChild()
Return the last child of the Node.
|
double |
getLengthValue(java.lang.String attrName,
boolean isWidth,
javafx.geometry.Bounds bounds,
Viewport viewport)
Return the value of an attribute of a specified name as a double.
|
double |
getLengthValue(java.lang.String attrName,
boolean isWidth,
javafx.geometry.Bounds bounds,
Viewport viewport,
double defaultValue)
Return the value of a length attribute of a specified name as a double.
|
double |
getLengthValue(java.lang.String attrName,
boolean isWidth,
Viewport viewport)
Return the value of an attribute of a specified name as a double.
|
double |
getLengthValue(java.lang.String attrName,
Viewport viewport)
Return the value of an attribute of a specified name as a double.
|
double |
getLengthValue(java.lang.String attrName,
Viewport viewport,
double defaultValue)
Return the value of an attribute of a specified name as a double.
|
double |
getLineWidthValue(java.lang.String attrName,
Viewport viewport,
double defaultValue)
Return the value of an lirn width of a specified name as a double.
|
java.lang.String |
getName()
Return the Node name.
|
XMLNode |
getNextSibling()
Return the next sibling of the Node.
|
XMLNode |
getParent()
Return the Node parent (or null if the Node is the root of the XML File).
|
double |
getPositionValue(java.lang.String attrName,
boolean isWidth,
javafx.geometry.Bounds bounds,
Viewport viewport)
Return the value of an attribute of a specified name as a double.
|
double |
getPositionValue(java.lang.String attrName,
boolean isWidth,
javafx.geometry.Bounds bounds,
Viewport viewport,
double defaultValue)
Return the value of a position attribute of a specified name as a double.
|
double |
getPositionValue(java.lang.String attrName,
boolean isWidth,
Viewport viewport)
Return the value of an attribute of a specified name as a double.
|
XMLNode |
getPreviousSibling()
Return the previous sibling of the Node.
|
boolean |
hasAttribute(java.lang.String attrName)
Return true if the Node has an attribute of a specified name.
|
boolean |
hasCDATA()
Return true if there is a the CDATA content for the node.
|
boolean |
hasChildren()
Return true if this Node has children.
|
int |
hashCode() |
void |
setCDATA(java.lang.String cData)
Set the CDATA content for the node.
|
java.lang.String |
toString() |
protected java.lang.String name
protected XMLNode nodeParent
protected final java.util.List<XMLNode> children
protected final java.util.Map<java.lang.String,java.lang.String> attributes
public XMLNode(java.lang.String nodeName)
nodeName
- the Node namepublic XMLNode(XMLNode parent, java.lang.String nodeName)
parent
- the Node parentnodeName
- the Node namepublic XMLNode getParent()
public java.lang.String getName()
public java.util.List<XMLNode> getChildren()
public XMLNode getFirstChild()
public XMLNode getLastChild()
public XMLNode getNextSibling()
public XMLNode getPreviousSibling()
public void addChild(XMLNode child)
child
- the Node childpublic boolean hasChildren()
public int countChildren()
public int countAttributes()
public java.util.Map<java.lang.String,java.lang.String> getAttributes()
public java.lang.String getAttributeValue(java.lang.String attrName)
attrName
- the attribute namepublic boolean getAttributeValueAsBoolean(java.lang.String attrName)
attrName
- the attribute namepublic boolean getAttributeValueAsBoolean(java.lang.String attrName, boolean defaultValue)
attrName
- the attribute namedefaultValue
- the default valuepublic float getAttributeValueAsFloat(java.lang.String attrName)
attrName
- the attribute namepublic float getAttributeValueAsFloat(java.lang.String attrName, float defaultValue)
attrName
- the attribute namedefaultValue
- the default valuepublic double getDoubleValue(java.lang.String attrName)
attrName
- the attribute namepublic double getDoubleValue(java.lang.String attrName, double defaultValue)
attrName
- the attribute namedefaultValue
- the default valuepublic double getLengthValue(java.lang.String attrName, Viewport viewport)
attrName
- the attribute nameviewport
- the viewportpublic double getPositionValue(java.lang.String attrName, boolean isWidth, Viewport viewport)
attrName
- the attribute nameisWidth
- true for a width lengthviewport
- the viewportpublic double getPositionValue(java.lang.String attrName, boolean isWidth, javafx.geometry.Bounds bounds, Viewport viewport)
attrName
- the attribute nameisWidth
- true for a width lengthbounds
- the optional bounds of the figure for which it is relative toviewport
- the viewportpublic double getLengthValue(java.lang.String attrName, boolean isWidth, Viewport viewport)
attrName
- the attribute nameisWidth
- true for a width lengthviewport
- the viewportpublic double getLengthValue(java.lang.String attrName, boolean isWidth, javafx.geometry.Bounds bounds, Viewport viewport)
attrName
- the attribute nameisWidth
- true for a width lengthbounds
- the optional bounds of the figure for which it is relative toviewport
- the viewportpublic double getLengthValue(java.lang.String attrName, Viewport viewport, double defaultValue)
attrName
- the attribute nameviewport
- the viewportdefaultValue
- the default valuepublic double getLineWidthValue(java.lang.String attrName, Viewport viewport, double defaultValue)
attrName
- the attribute nameviewport
- the viewportdefaultValue
- the default valuepublic double getLengthValue(java.lang.String attrName, boolean isWidth, javafx.geometry.Bounds bounds, Viewport viewport, double defaultValue)
attrName
- the attribute nameisWidth
- true for a width lengthbounds
- the optional bounds of the figure for which it is relative toviewport
- the viewportdefaultValue
- the default valuepublic double getPositionValue(java.lang.String attrName, boolean isWidth, javafx.geometry.Bounds bounds, Viewport viewport, double defaultValue)
attrName
- the attribute nameisWidth
- true for a width lengthbounds
- the Bounds
of the objectBoundingBox or nullviewport
- the viewportdefaultValue
- the default valuepublic int getAttributeValueAsInt(java.lang.String attrName)
attrName
- the attribute namepublic int getAttributeValueAsInt(java.lang.String attrName, int defaultValue)
attrName
- the attribute namedefaultValue
- the default valuepublic void addAttribute(java.lang.String attrName, int value)
attrName
- the attribute namevalue
- the attribute valuepublic void addAttribute(java.lang.String attrName, java.lang.String value)
attrName
- the attribute namevalue
- the attribute valuepublic void addAttribute(java.lang.String attrName, float value)
attrName
- the attribute namevalue
- the attribute valuepublic void addAttribute(java.lang.String attrName, boolean value)
attrName
- the attribute namevalue
- the attribute valuepublic void setCDATA(java.lang.String cData)
cData
- the CDATA contentpublic java.lang.String getCDATA()
public boolean hasCDATA()
public boolean hasAttribute(java.lang.String attrName)
attrName
- the attribute namepublic java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Copyright © 2021, 2022, 2025 Herve Girod. All Rights Reserved. Documentation and source under the BSD 3-Clause licence