SMILA (incubation) API documentation

org.eclipse.smila.datamodel.id.dom
Class IdParser

java.lang.Object
  extended by org.eclipse.smila.datamodel.id.dom.IdParser

public class IdParser
extends java.lang.Object

Utility class for creating SMILA record Ids from DOM elements.

Author:
jschumacher

Field Summary
static java.lang.String ATTRIBUTE_NAME
          attribute name of key name attribtue: "name".
static java.lang.String ATTRIBUTE_VERSION
          attribute name of version attribtue: "version".
static java.lang.String NAMESPACE_ID
          SMILA Id XML namespace URI, "http://www.eclipse.org/smila/id".
static java.lang.String TAG_ELEMENT
          local tag name of container element elements: "Element".
static java.lang.String TAG_FRAGMENT
          local tag name of fragment elements: "Fragment".
static java.lang.String TAG_ID
          lcoal tag name of Id elements: "Id".
static java.lang.String TAG_IDLIST
          local tag name of Id list elements: "IdList".
static java.lang.String TAG_KEY
          local tag name of key elements: "Key".
static java.lang.String TAG_SOURCE
          local tag name of source elements: "Source".
 
Constructor Summary
IdParser()
          create IdParser with default Id factory.
IdParser(IdFactory customFactory)
          create IdParser with a given Id factory.
 
Method Summary
 Id parseIdFrom(org.w3c.dom.Element idElement)
          Expects a valid id:Id element and creates an Id object from it.
 Id parseIdFrom(java.lang.String xmlString)
          Creates an Id object by parsing an Id xml representation.
 Id parseIdIn(org.w3c.dom.Element parentElement)
          Find the first child Id element and parse the Id it describes.
 java.util.List<Id> parseIdsIn(org.w3c.dom.Element parentElement)
          Find all child Id elements and parse the Id it describes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAMESPACE_ID

public static final java.lang.String NAMESPACE_ID
SMILA Id XML namespace URI, "http://www.eclipse.org/smila/id".

See Also:
Constant Field Values

TAG_ID

public static final java.lang.String TAG_ID
lcoal tag name of Id elements: "Id".

See Also:
Constant Field Values

TAG_IDLIST

public static final java.lang.String TAG_IDLIST
local tag name of Id list elements: "IdList".

See Also:
Constant Field Values

TAG_SOURCE

public static final java.lang.String TAG_SOURCE
local tag name of source elements: "Source".

See Also:
Constant Field Values

TAG_KEY

public static final java.lang.String TAG_KEY
local tag name of key elements: "Key".

See Also:
Constant Field Values

TAG_ELEMENT

public static final java.lang.String TAG_ELEMENT
local tag name of container element elements: "Element".

See Also:
Constant Field Values

TAG_FRAGMENT

public static final java.lang.String TAG_FRAGMENT
local tag name of fragment elements: "Fragment".

See Also:
Constant Field Values

ATTRIBUTE_VERSION

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

See Also:
Constant Field Values

ATTRIBUTE_NAME

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

See Also:
Constant Field Values
Constructor Detail

IdParser

public IdParser()
create IdParser with default Id factory.


IdParser

public IdParser(IdFactory customFactory)
create IdParser with a given Id factory.

Parameters:
customFactory - the Id factory to use for creating the Id object.
Method Detail

parseIdIn

public Id parseIdIn(org.w3c.dom.Element parentElement)
Find the first child Id element and parse the Id it describes. If no Id element is found, null is returned.

Parameters:
parentElement - the element under which to search for Ids
Returns:
the first Id found under the parentElement.

parseIdsIn

public java.util.List<Id> parseIdsIn(org.w3c.dom.Element parentElement)
Find all child Id elements and parse the Id it describes. If no Id element is found, null is returned.

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

parseIdFrom

public Id parseIdFrom(org.w3c.dom.Element idElement)
Expects a valid id:Id element and creates an Id object from it.

Parameters:
idElement - an id:Id element to parse.
Returns:
the Id described by the given element

parseIdFrom

public Id parseIdFrom(java.lang.String xmlString)
               throws javax.xml.parsers.ParserConfigurationException,
                      java.io.IOException,
                      org.xml.sax.SAXException
Creates an Id object by parsing an Id xml representation.

Parameters:
xmlString - the xml string to parse
Returns:
and Id object
Throws:
javax.xml.parsers.ParserConfigurationException - if any error occurs while parsing
java.io.IOException - if any error occurs while parsing
org.xml.sax.SAXException - if any error occurs while parsing

SMILA (incubation) API documentation