John W. Campbell
This object is used to store a document in structured (tree) form based on
XML type element nodes. Each node may contain a list of text strings and/or
other child JdlDocObject objects. The object is used internally within
the JdlDocument object and is returned from the parseXML(..) method of
a JdlSelectiveXMLParser object.
Class, fields, constructor and methods:
Class Details
Accessible Fields
Constructor
Methods
- Package:
- Jdl.JdlLib;
- Class name:
- JdlDocObject
- Class definition:
- public class JdlDocObject
- Extends:
- Object
- Implements:
- none
- Actions:
- none
The following accessible fields have been defined:
- public String el_name
- Element name. The value of this field is set via the constructor.
- public String token
- Full 'start of element' token. The value of this field is set via the
constructor.
- public JdlDocObject parent
- Parent JdlDocObject. The value of this field is set via the constructor.
- public Vector<Object> contents
- List of processed String objects and child DocObject objects. The
elements of this Vector are set via the addContents(..) method.
- public int level
- Nested level. The value of this field may be set via the constructor or
via the addContents(..) method.
- Vector<Object> passed_elements
- List of elements 'passed on' when parsing the document. The value of this
field will be set by the addContents(..) method.
- public int list_position
- List position as a position count (starting from 1) for documents with
this element name in the its parent's contents list. The value of this
field will be set by the addContents(..) method.
A single constructor is available.
Constructor:
Standard constructor
Constructs a JdlDocObject object which can form a node in a tree of
such JdlDocObject objects.
- Constructor Definition:
- public JdlDocObject(String nam, String token, JdlDocObject par, int lev)
- Parameters List:
- nam
- The element name for this JdlDocObject object.
- token
- The start of element token string in full.
- lev
- The nesting level of this JdlDocObject object. If required this
value can automatically reset to its parent level plus 1 when added to
an existing JdlDocObject object.
This section contains methods adding child JdlDocObject objects or text when
constructing a document structure and for listing the contents of
a JdlDocObject tree.
Methods:
Add JdlDocObject or string - addContents
List contents - listContents
This methods adds either text as a String Variable or a child JdlDocObject
object to the contents list of a parent JdlDocObject object (or the
special case of a passed element name). The list_position field will be
automatically set by this method.
- Method Definition:
- public void addContents(Object obj, boolean passed, boolean reset_lev)
- Parameters List:
- obj
- The JdlDocObject or String object to be added.
- passed
- Set this to true if the object being added is the element name
of a 'passed on' element as used described for a JdlSelectiveXMLParser
object.
- reset_lev
- If true (and if the object being added is a JdlDocObject
object) the nesting level for this object will be set to its parent level + 1;
if false the value of the level will remain at that specified when the
object was created.
This method lists (recursively) the contents of a JdlDocObject tree
structure (or the single object if it has no JdlDocObject children).
Its intended use is as a diagnostic aid.
- Method Definition:
- public void listContents()
- Parameters List:
- none
⇑ Up 2
⇑ Up 1
⇑ Top of this