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.
-
-
Field Summary
Fields Modifier and Type Field Description private Tokentokenprivate XMLTokenizer.Typetypeprivate java.lang.Stringvalue
-
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 BasicNodecopy()Simulate clone()BasicNodecopy(Node orig)Copy all data fromorigintothisBasicNodecreateClone()Simulate clone()intgetEndOffset()intgetStartOffset()The start offset of the node in the XML source or -1TokengetToken()Get the token (mainly for error handling)XMLTokenizer.TypegetType()Get the node typejava.lang.StringgetValue()protected voidsetType(XMLTokenizer.Type type)voidsetValue(java.lang.String value)java.lang.StringtoString()java.lang.StringtoXML()Convert this node to a string.static java.lang.StringtoXML(Node n)Helper method forString toXML()to handle theIOExceptionthatStringWriterwill never throw.BasicNodetoXML(XMLWriter writer)Append the content of this node towriter
-
-
-
Field Detail
-
token
private Token token
-
type
private XMLTokenizer.Type type
-
value
private java.lang.String value
-
-
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:NodeGet 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:
toStringin classjava.lang.Object
-
toXML
public static java.lang.String toXML(Node n)
Helper method forString toXML()to handle theIOExceptionthatStringWriterwill never throw.
-
createClone
public BasicNode createClone()
Description copied from interface:NodeSimulate clone()- Specified by:
createClonein interfaceNode
-
copy
public BasicNode copy(Node orig)
Description copied from interface:NodeCopy all data fromorigintothis
-
-