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 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, 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 typeString
getValue()
protected void
setType(XMLTokenizer.Type type)
void
setValue(String value)
String
toString()
String
toXML()
Convert this node to a string.static 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, 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 String getValue()
-
setValue
public void setValue(String value)
-
toXML
public BasicNode toXML(XMLWriter writer) throws IOException
Append the content of this node towriter
- Specified by:
toXML
in interfaceNode
- Throws:
IOException
-
toXML
public static 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
-
-