Package de.pdark.decentxml
Class BasicNode
- java.lang.Object
-
- de.pdark.decentxml.BasicNode
-
- All Implemented Interfaces:
Node
- Direct Known Subclasses:
Attribute
,Comment
,DocType
,DocTypeAttributeList
,DocTypeElement
,DocTypeEntity
,DocTypeNotation
,DocTypeText
,Entity
,ProcessingInstruction
,Text
public class BasicNode extends java.lang.Object implements Node
The parent class for all nodes in the XML document.- Author:
- digulla
-
-
Constructor Summary
Constructors Constructor Description BasicNode(Token token)
BasicNode(XMLTokenizer.Type type, java.lang.String text)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BasicNode
copy()
Simulate clone()BasicNode
copy(Node orig)
Copy all data fromorig
intothis
BasicNode
createClone()
Simulate clone()int
getEndOffset()
int
getStartOffset()
The start offset of the node in the XML source or -1Token
getToken()
Get the token (mainly for error handling)XMLTokenizer.Type
getType()
Get the node typejava.lang.String
getValue()
protected void
setType(XMLTokenizer.Type type)
void
setValue(java.lang.String value)
java.lang.String
toString()
java.lang.String
toXML()
Convert this node to a string.static java.lang.String
toXML(Node n)
Helper method forString toXML()
to handle theIOException
thatStringWriter
will never throw.BasicNode
toXML(XMLWriter writer)
Append the content of this node towriter
-
-
-
Constructor Detail
-
BasicNode
public BasicNode(Token token)
-
BasicNode
public BasicNode(XMLTokenizer.Type type, java.lang.String text)
-
-
Method Detail
-
setType
protected void setType(XMLTokenizer.Type type)
-
getType
public XMLTokenizer.Type getType()
Description copied from interface:Node
Get the node type
-
getToken
public Token getToken()
Get the token (mainly for error handling)
-
getStartOffset
public int getStartOffset()
The start offset of the node in the XML source or -1
-
getEndOffset
public int getEndOffset()
-
getValue
public java.lang.String getValue()
-
setValue
public void setValue(java.lang.String value)
-
toXML
public BasicNode toXML(XMLWriter writer) throws java.io.IOException
Append the content of this node towriter
-
toXML
public java.lang.String toXML()
Convert this node to a string.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toXML
public static java.lang.String toXML(Node n)
Helper method forString toXML()
to handle theIOException
thatStringWriter
will never throw.
-
createClone
public BasicNode createClone()
Description copied from interface:Node
Simulate clone()- Specified by:
createClone
in interfaceNode
-
copy
public BasicNode copy(Node orig)
Description copied from interface:Node
Copy all data fromorig
intothis
-
-