|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.qtitools.qti.node.AbstractNode
public abstract class AbstractNode
Parent of all xml nodes.
| Field Summary |
|---|
| Fields inherited from interface org.qtitools.qti.node.XmlNode |
|---|
INDENT, NEW_LINE, SIMPLE_NAME_INNER_SEPARATOR, SIMPLE_NAMES_SEPARATOR |
| Constructor Summary | |
|---|---|
AbstractNode(XmlNode parent)
Constructs node. |
|
| Method Summary | |
|---|---|
protected java.lang.String |
attrToXmlString(int depth,
boolean printDefaultAttributes)
Prints attributes of this node into xml string. |
protected java.lang.String |
bodyToXmlString(int depth,
boolean printDefaultAttributes)
Prints body (children and/or text content) of this node into xml string. |
AttributeList |
getAttributes()
Gets list (container) of all attributes. |
abstract java.lang.String |
getClassTag()
Gets QTI class name of this node. |
java.lang.String |
getFullName()
Gets full name of this node. |
static java.lang.String |
getIndent(int depth)
Prints indent into xml string. |
static org.w3c.dom.Node |
getNode(java.io.File file)
Gets node from given source file. |
static org.w3c.dom.Node |
getNode(java.lang.String string)
Gets node from given source string. |
static org.w3c.dom.Node |
getNode(java.net.URL url)
Gets node from given source url. |
NodeGroupList |
getNodeGroups()
Gets list (container) of all child groups. |
XmlNode |
getParent()
Gets parent of this node or null (if node is root; for example AssessmentTest). |
XmlNode |
getParentRoot()
Gets root of this node or node itself (if node is root; for example AssessmentTest). |
java.lang.String |
getSimpleName()
Gets simple name of this node. |
java.io.File |
getSourceFile()
Gets source file of this node. |
org.w3c.dom.Node |
getSourceNode()
Gets source node (DOM) of this node. |
java.lang.String |
getSourceString()
Gets source string of this node. |
java.net.URL |
getSourceUrl()
Gets source url of this node. |
boolean |
hasChildNodes()
This is A convenience method to allow easy determination of whether A node has any children. |
void |
load(java.io.File sourceFile)
Loads this node from given source file. |
void |
load(org.w3c.dom.Node sourceNode)
Loads this node from given source node (DOM). |
void |
load(java.lang.String sourceString)
Loads this node from given source string. |
void |
load(java.net.URL sourceUrl)
Loads this node from given source url. |
protected void |
loadAttributes(org.w3c.dom.Node node)
Loads all attributes from given xml source. |
protected void |
readChild(org.w3c.dom.Node node)
Reads one child from given xml source. |
protected void |
readChildren(org.w3c.dom.Node node)
Reads all children nodes and/or content from given xml source. |
protected void |
setParent(XmlNode parent)
Sets new parent of this node. |
void |
setSourceFile(java.io.File sourceFile)
Sets new source file of this node. |
void |
setSourceNode(org.w3c.dom.Node sourceNode)
Sets new source node (DOM) of this node. |
void |
setSourceString(java.lang.String sourceString)
Sets new source string of this node. |
void |
setSourceUrl(java.net.URL sourceUrl)
Sets new source url of this node. |
java.lang.String |
toXmlString()
Prints this node and all its children into string. |
java.lang.String |
toXmlString(int depth,
boolean printDefaultAttributes)
Prints this node and all its children into string. |
ValidationResult |
validate()
Validates this object. |
protected ValidationResult |
validateAttributes()
Validates attributes of this node. |
protected ValidationResult |
validateChildren()
Validates children (body) of this node. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractNode(XmlNode parent)
parent - parent of constructed node (can be null for root nodes)| Method Detail |
|---|
public XmlNode getParent()
XmlNodeWhile testing some nodes (for example expressions) don't have properly set parent, but it is usable only for testing. (Some nodes cannot exists without parent even for testing).
getParent in interface XmlNodeprotected void setParent(XmlNode parent)
parent - new parent of this nodegetParent()public XmlNode getParentRoot()
XmlNodeWhile testing some nodes (for example expressions) don't have properly set parent, but it is usable only for testing. (Some nodes cannot exists without parent even for testing).
getParentRoot in interface XmlNodepublic AttributeList getAttributes()
XmlNode
getAttributes in interface XmlNodepublic NodeGroupList getNodeGroups()
XmlNodeFor example AssessmentTest contains (one) testPart group. And this (one) group contains all testParts.
Group approach is useful for defining some rules to all testParts (for example required number of testParts in AssessmentTest).
getNodeGroups in interface XmlNodepublic void load(java.net.URL sourceUrl)
XmlNode
load in interface XmlNodesourceUrl - source url for this nodepublic java.net.URL getSourceUrl()
XmlNode
getSourceUrl in interface XmlNodeXmlNode.setSourceUrl(java.net.URL)public void setSourceUrl(java.net.URL sourceUrl)
XmlNode
setSourceUrl in interface XmlNodesourceUrl - new source url of this nodeXmlNode.getSourceUrl()public void load(java.io.File sourceFile)
XmlNode
load in interface XmlNodesourceFile - source file for this nodepublic java.io.File getSourceFile()
XmlNode
getSourceFile in interface XmlNodeXmlNode.setSourceFile(java.io.File)public void setSourceFile(java.io.File sourceFile)
XmlNode
setSourceFile in interface XmlNodesourceFile - new source file of this nodeXmlNode.getSourceFile()public void load(java.lang.String sourceString)
XmlNode
load in interface XmlNodesourceString - source string for this nodepublic java.lang.String getSourceString()
XmlNode
getSourceString in interface XmlNodeXmlNode.setSourceString(java.lang.String)public void setSourceString(java.lang.String sourceString)
XmlNode
setSourceString in interface XmlNodesourceString - new source string of this nodeXmlNode.getSourceString()public void load(org.w3c.dom.Node sourceNode)
XmlNode
load in interface XmlNodesourceNode - source node (DOM) for this nodepublic org.w3c.dom.Node getSourceNode()
XmlNode
getSourceNode in interface XmlNodeXmlNode.setSourceNode(org.w3c.dom.Node)public void setSourceNode(org.w3c.dom.Node sourceNode)
XmlNode
setSourceNode in interface XmlNodesourceNode - new source node (DOM) of this nodeXmlNode.getSourceNode()protected void loadAttributes(org.w3c.dom.Node node)
node - xml sourceprotected void readChildren(org.w3c.dom.Node node)
node - xml sourceprotected void readChild(org.w3c.dom.Node node)
node - xml sourcepublic java.lang.String toXmlString()
XmlNodeCalls toXmlString(0, false).
toXmlString in interface XmlNodeXmlNode.toXmlString(int, boolean)
public java.lang.String toXmlString(int depth,
boolean printDefaultAttributes)
XmlNode
toXmlString in interface XmlNodedepth - indent (0 = no indent)printDefaultAttributes - whether print attribute's default values
XmlNode.toXmlString()public abstract java.lang.String getClassTag()
XmlNodeQTI class name has very important role during loading/saving nodes.
For example: Java class name is AssessmentTest; QTI class name is assessmentTest.
getClassTag in interface XmlNode
protected java.lang.String attrToXmlString(int depth,
boolean printDefaultAttributes)
depth - depth in xml tree (root = 0)printDefaultAttributes - whether print attributes with default values
protected java.lang.String bodyToXmlString(int depth,
boolean printDefaultAttributes)
depth - depth in xml tree (root = 0)printDefaultAttributes - whether print attributes with default values
public java.lang.String getSimpleName()
XmlNodeSimple name is not so important like QTI class name. It servers mostly for displaying informations and in messages.
For example: simple name can be assessmentTest:Test (QTI class name (assessmentTest) + identifier (Test)).
getSimpleName in interface XmlNodeXmlNode.getFullName()public java.lang.String getFullName()
XmlNodeFull name is not so important like QTI class name. It serves mostly for displaying informations and in messages.
For example: assessmentTest:Test->testPart:Part3->assessmentSection:SectionB->assessmnetItemRef:Item05.
getFullName in interface XmlNodeXmlNode.getSimpleName()public ValidationResult validate()
Validatable
validate in interface Validatableprotected ValidationResult validateAttributes()
protected ValidationResult validateChildren()
public static org.w3c.dom.Node getNode(java.net.URL url)
url - source url
public static org.w3c.dom.Node getNode(java.io.File file)
file - source file
public static org.w3c.dom.Node getNode(java.lang.String string)
string - source string
public static java.lang.String getIndent(int depth)
depth - depth in xml tree (root = 0)
public boolean hasChildNodes()
XmlNode
hasChildNodes in interface XmlNode
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||