SMILA 1.0 API documentation

org.eclipse.smila.datamodel.xml
Class DOMRecordReader

java.lang.Object
  extended by org.eclipse.smila.datamodel.xml.DOMRecordReader

public class DOMRecordReader
extends java.lang.Object

Utility class for creating SMILA records from DOM elements.

Author:
jschumacher

Constructor Summary
DOMRecordReader()
          Create parser using default factories for records and IDs.
DOMRecordReader(DataFactory dataFactory)
          Create parser with custom data factoriy.
 
Method Summary
 AnyMap parseMap(org.w3c.dom.Element mapElement)
          parse AnyMap from given Map element and return it.
 Record parseRecordFrom(org.w3c.dom.Element recordElement)
          create a record from a Record element.
 Record parseRecordIn(org.w3c.dom.Element parentElement)
          find the first child Record element the specified parent element and create a record from it.
 java.util.List<Record> parseRecordsIn(org.w3c.dom.Element parentElement)
          Find all child Record elements that are child of this specified element and parse the record it describes.
 java.util.List<Record> parseRecordsIn(org.w3c.dom.Element parentElement, int childIndex)
          Parse only the specified (by childIndex) child Record elements of the given element and parse the record it describes.
 AnySeq parseSeq(org.w3c.dom.Element seqElement)
          parse AnySeq from given Seq element and attach to given metadata any.
 Value parseValue(org.w3c.dom.Element valueElement)
          parse a value from the given Val element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMRecordReader

public DOMRecordReader()
Create parser using default factories for records and IDs.


DOMRecordReader

public DOMRecordReader(DataFactory dataFactory)
Create parser with custom data factoriy.

Parameters:
dataFactory - custom data factory.
Method Detail

parseRecordIn

public Record parseRecordIn(org.w3c.dom.Element parentElement)
find the first child Record element the specified parent element and create a record from it.

Parameters:
parentElement - parent element of rec:Record
Returns:
the record described by the first rec:Record element under the parent.

parseRecordsIn

public java.util.List<Record> parseRecordsIn(org.w3c.dom.Element parentElement)
Find all child Record elements that are child of this specified element and parse the record it describes. If no record element is found, an empty list is returned.

Parameters:
parentElement - the element under which to search for records
Returns:
all records found under the parentElement.

parseRecordsIn

public java.util.List<Record> parseRecordsIn(org.w3c.dom.Element parentElement,
                                             int childIndex)
Parse only the specified (by childIndex) child Record elements of the given element and parse the record it describes. If no record element is found, or the index is not valid, an empty list is returned.

Parameters:
parentElement - the element under which to search for records
Returns:
all records found under the parentElement.

parseRecordFrom

public Record parseRecordFrom(org.w3c.dom.Element recordElement)
create a record from a Record element.

Parameters:
recordElement - a Record element.
Returns:
the record described by this element.

parseMap

public AnyMap parseMap(org.w3c.dom.Element mapElement)
parse AnyMap from given Map element and return it.

Parameters:
mapElement - Map element to parse.
Returns:
parsed AnyMap

parseSeq

public AnySeq parseSeq(org.w3c.dom.Element seqElement)
parse AnySeq from given Seq element and attach to given metadata any.

Parameters:
seqElement - Seq element to parse.
Returns:
parsed AnySeq

parseValue

public Value parseValue(org.w3c.dom.Element valueElement)
parse a value from the given Val element.

Parameters:
valueElement - Val element
Returns:
the value parsed from this element

SMILA 1.0 API documentation