SMILA (incubation) API documentation

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

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

public class RecordBuilder
extends java.lang.Object

A utility class to create DOM representations of SMILA records.

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 ATTRIBUTE_XMLNSREC
          attribute "xmlns:rec" for specification if SMILA Id XML namespace URI.
static java.lang.String NAMESPACE_RECORD
          SMILA Recird XML namespace URI, "http://www.eclipse.org/smila/record".
static java.lang.String PREFIX_REC
          namespace prefix "rec:" for Id XML elements.
static java.lang.String SCHEMA_VERSION_RECORD
          version of Record XMLs created by this builder: "1.0".
static java.lang.String TAG_ANNOTATION
          qualified name of Annotation element: "rec:An".
static java.lang.String TAG_ATTACHMENT
          qualified name of Attachment element: "rec:Attachment".
static java.lang.String TAG_ATTRIBUTE
          qualified name of Attribute element: "rec:A".
static java.lang.String TAG_LITERAL
          qualified name of Value element: "rec:L".
static java.lang.String TAG_OBJECT
          qualified name of Value element: "rec:O".
static java.lang.String TAG_RECORD
          qualified name of Record element: "rec:Record".
static java.lang.String TAG_RECORDLIST
          qualified name of RecordList element: "rec:RecordList".
static java.lang.String TAG_VALUE
          qualified name of Value element: "rec:V".
 
Constructor Summary
RecordBuilder()
          create new RecordBuilder.
RecordBuilder(boolean printPretty)
          create new RecordBuilder with custom printPretty flag.
 
Method Summary
 org.w3c.dom.Element appendRecord(org.w3c.dom.Element parent, Record record)
          Append a rec:Record element describing the given record to the given parent element.
 org.w3c.dom.Element appendRecordList(org.w3c.dom.Element parent, java.lang.Iterable<Record> records)
          Append a rec:RecordList element describing the given record list to the given parent element.
 org.w3c.dom.Element appendRecordList(org.w3c.dom.Element parent, Record[] records)
          Append a rec:RecordList element describing the given record list to the given parent element.
 org.w3c.dom.Element buildRecord(org.w3c.dom.Document factory, Record record)
          build rec:Record element without namespace declaration.
 void buildRecordAsDocumentElement(org.w3c.dom.Document factory, Record record)
          Builds the record as document element.
protected static java.lang.String cleanText(java.lang.String text)
           
 
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 Recird XML namespace URI, "http://www.eclipse.org/smila/record".

See Also:
Constant Field Values

ATTRIBUTE_XMLNSREC

public static final java.lang.String ATTRIBUTE_XMLNSREC
attribute "xmlns:rec" for specification if SMILA Id XML namespace URI.

See Also:
Constant Field Values

PREFIX_REC

public static final java.lang.String PREFIX_REC
namespace prefix "rec:" for Id XML elements.

See Also:
Constant Field Values

TAG_RECORD

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

See Also:
Constant Field Values

TAG_RECORDLIST

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

See Also:
Constant Field Values

TAG_ATTRIBUTE

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

See Also:
Constant Field Values

TAG_ANNOTATION

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

See Also:
Constant Field Values

TAG_VALUE

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

See Also:
Constant Field Values

TAG_LITERAL

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

See Also:
Constant Field Values

TAG_OBJECT

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

See Also:
Constant Field Values

TAG_ATTACHMENT

public static final java.lang.String TAG_ATTACHMENT
qualified name of Attachment element: "rec: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

SCHEMA_VERSION_RECORD

public static final java.lang.String SCHEMA_VERSION_RECORD
version of Record XMLs created by this builder: "1.0".

See Also:
Constant Field Values
Constructor Detail

RecordBuilder

public RecordBuilder()
create new RecordBuilder.


RecordBuilder

public RecordBuilder(boolean printPretty)
create new RecordBuilder with custom printPretty flag.

Parameters:
printPretty - printPretty flag
Method Detail

appendRecord

public org.w3c.dom.Element appendRecord(org.w3c.dom.Element parent,
                                        Record record)
Append a rec:Record element describing the given record to the given parent element. The record element is appended as a new last child to the parent element. The element contains a namespace declaration for "xmlns:rec".

Parameters:
parent - the parent element to append to.
record - the record to transform.
Returns:
the appended element

appendRecordList

public org.w3c.dom.Element appendRecordList(org.w3c.dom.Element parent,
                                            java.lang.Iterable<Record> records)
Append a rec:RecordList element describing the given record list to the given parent element. The record list element is appended as a new last child to the parent element. The element contains a namespace declaration for "xmlns:rec".

Parameters:
parent - the parent element to append to.
records - the record list to transform.
Returns:
the appended element

appendRecordList

public org.w3c.dom.Element appendRecordList(org.w3c.dom.Element parent,
                                            Record[] records)
Append a rec:RecordList element describing the given record list to the given parent element. The record list element is appended as a new last child to the parent element. The element contains a namespace declaration for "xmlns:rec".

Parameters:
parent - the parent element to append to.
records - the record list to transform.
Returns:
the appended element

buildRecord

public org.w3c.dom.Element buildRecord(org.w3c.dom.Document factory,
                                       Record record)
build rec:Record element without namespace declaration.

Parameters:
factory - factory for creating DOM elements
record - the record to transform
Returns:
the created element.

buildRecordAsDocumentElement

public void buildRecordAsDocumentElement(org.w3c.dom.Document factory,
                                         Record record)
Builds the record as document element.

Parameters:
factory - the factory
record - the record

cleanText

protected static java.lang.String cleanText(java.lang.String text)
Parameters:
text - input text (XML)
Returns:
XML text cleaned from characters forbidden in XML 1.1 specification

SMILA (incubation) API documentation