SMILA (incubation) API documentation

org.eclipse.smila.datamodel.record.dom
Class RecordParser

java.lang.Object
  extended by org.eclipse.smila.datamodel.record.dom.RecordParser

public class RecordParser
extends java.lang.Object

Utility class for creating SMILA records from DOM elements.

Author:
jschumacher

Field Summary
static java.lang.String ATTRIBUTE_NAME
          attribute name of name attribute: "n".
static java.lang.String ATTRIBUTE_SEMANTICTYPE
          attribute name of semantic type attribute: "st".
static java.lang.String ATTRIBUTE_TYPE
          attribute name of type attribute: "type".
static java.lang.String ATTRIBUTE_VERSION
          attribute name of version attribute: "version".
static java.lang.String NAMESPACE_RECORD
          SMILA Record XML namespace URI, "http://www.eclipse.org/smila/record".
static java.lang.String TAG_ANNOTATION
          local name of Annotation element: "An".
static java.lang.String TAG_ATTACHMENT
          local name of Attachment element: "Attachment".
static java.lang.String TAG_ATTRIBUTE
          local name of Attribute element: "A".
static java.lang.String TAG_LITERAL
          local name of Value element: "L".
static java.lang.String TAG_OBJECT
          local name of Value element: "O".
static java.lang.String TAG_RECORD
          local name of Record element: "Record".
static java.lang.String TAG_RECORDLIST
          local name of RecordList element: "RecordList".
static java.lang.String TAG_VALUE
          local name of Value element: "V".
 
Constructor Summary
RecordParser()
          Create parser using default factories for records and IDs.
RecordParser(RecordFactory recordFactory, IdFactory idFactory)
          Create parser with custom factories for records and IDs.
 
Method Summary
 void parseAnnotation(Annotatable annotatable, org.w3c.dom.Element annotationElement)
          parse an rec:Annotation element and create an Annotation object.
 Record parseRecordFrom(org.w3c.dom.Element recordElement)
          create a record from a rec:Record element.
 Record parseRecordIn(org.w3c.dom.Element parentElement)
          find the first child rec: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 rec:Record elements that are child of this specified element and parse the record it describes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAMESPACE_RECORD

public static final java.lang.String NAMESPACE_RECORD
SMILA Record XML namespace URI, "http://www.eclipse.org/smila/record".

See Also:
Constant Field Values

TAG_RECORD

public static final java.lang.String TAG_RECORD
local name of Record element: "Record".

See Also:
Constant Field Values

TAG_RECORDLIST

public static final java.lang.String TAG_RECORDLIST
local name of RecordList element: "RecordList".

See Also:
Constant Field Values

TAG_ATTRIBUTE

public static final java.lang.String TAG_ATTRIBUTE
local name of Attribute element: "A".

See Also:
Constant Field Values

TAG_ANNOTATION

public static final java.lang.String TAG_ANNOTATION
local name of Annotation element: "An".

See Also:
Constant Field Values

TAG_LITERAL

public static final java.lang.String TAG_LITERAL
local name of Value element: "L".

See Also:
Constant Field Values

TAG_OBJECT

public static final java.lang.String TAG_OBJECT
local name of Value element: "O".

See Also:
Constant Field Values

TAG_VALUE

public static final java.lang.String TAG_VALUE
local name of Value element: "V".

See Also:
Constant Field Values

TAG_ATTACHMENT

public static final java.lang.String TAG_ATTACHMENT
local name of Attachment element: "Attachment".

See Also:
Constant Field Values

ATTRIBUTE_VERSION

public static final java.lang.String ATTRIBUTE_VERSION
attribute name of version attribute: "version".

See Also:
Constant Field Values

ATTRIBUTE_NAME

public static final java.lang.String ATTRIBUTE_NAME
attribute name of name attribute: "n".

See Also:
Constant Field Values

ATTRIBUTE_TYPE

public static final java.lang.String ATTRIBUTE_TYPE
attribute name of type attribute: "type".

See Also:
Constant Field Values

ATTRIBUTE_SEMANTICTYPE

public static final java.lang.String ATTRIBUTE_SEMANTICTYPE
attribute name of semantic type attribute: "st".

See Also:
Constant Field Values
Constructor Detail

RecordParser

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


RecordParser

public RecordParser(RecordFactory recordFactory,
                    IdFactory idFactory)
Create parser with custom factories for records and IDs.

Parameters:
recordFactory - custom record factory.
idFactory - custom id factory.
Method Detail

parseRecordIn

public Record parseRecordIn(org.w3c.dom.Element parentElement)
find the first child rec: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 rec:Record elements that are child of this specified element and parse the record it describes. If no record element is found, null is returned.

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

parseRecordFrom

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

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

parseAnnotation

public void parseAnnotation(Annotatable annotatable,
                            org.w3c.dom.Element annotationElement)
parse an rec:Annotation element and create an Annotation object.

Parameters:
annotatable - object to annotate.
annotationElement - the element to parse

SMILA (incubation) API documentation