|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.activemath.omdocjdom.OJFactory
public class OJFactory
The responsible for creation the JDOM nodes populating the object-structure.
Such an object is important at least when parsing objects with the
OJSAXBuilder.
This class different than the
JDOMFactory as the variants for each node-type
all call the default (full) one.
Moreover, this class is the central place to provide the necessary subclasses
in parsed document, deciding which subclass to build depending the on the building
process and node-information.
Such an object should not be used by mutliple threads as the method
constructing attributes or elements use the last element created. Hence such
objects should be reset (using reset()) before re-using in a
different context.
| Field Summary | |
|---|---|
static String |
CVS_ID
cvs id useful to see revisions: is @(#) $RCSfile: OJFactory.java,v $ $Revision: 1.21 $ $Date: 2009/09/07 04:26:10 $ $Name: $ |
static boolean |
DEBUG
|
protected boolean |
isBusy
|
protected org.jdom.Element |
lastElementBuilt
A single buffer of the last element built, to be used by the constructSpecialEltSubclass(java.lang.String, org.jdom.Namespace) and constructSpecialAttSubclass(java.lang.String, java.lang.String, int, org.jdom.Namespace). |
protected OJSAXBuilder.LocationProvider |
locationProvider
|
| Constructor Summary | |
|---|---|
OJFactory()
Builds the factory... doing nothing. |
|
| Method Summary | |
|---|---|
void |
addContent(org.jdom.Parent parent,
org.jdom.Content content)
|
void |
addNamespaceDeclaration(org.jdom.Element element,
org.jdom.Namespace additional)
|
org.jdom.Attribute |
attribute(String name,
String value)
Relays to attribute(String,String,int,Namespace) using
Namespace.NO_NAMESPACE and the type Attribute.CDATA_TYPE. |
org.jdom.Attribute |
attribute(String name,
String value,
int type)
Relays to attribute(String,String,int,Namespace) using
the Namespace.NO_NAMESPACE. |
org.jdom.Attribute |
attribute(String name,
String value,
int type,
org.jdom.Namespace namespace)
Builds an instance of Attribute class. |
org.jdom.Attribute |
attribute(String name,
String value,
org.jdom.Namespace namespace)
Relays to attribute(String,String,int,Namespace) using
the type Attribute.CDATA_TYPE. |
org.jdom.CDATA |
cdata(String text)
|
org.jdom.Comment |
comment(String text)
|
protected org.jdom.Attribute |
constructSpecialAttSubclass(String name,
String value,
int type,
org.jdom.Namespace namespace)
This class is responsible to build the appropriate subclass of Attribute or returns null if there is none to make. |
protected OJDocument |
constructSpecialDocumentSubclass(org.jdom.Element rootElement,
org.jdom.DocType docType)
To be used by subclasses, currently always returns null. |
OJElement |
constructSpecialEltSubclass(String name,
org.jdom.Namespace namespace)
This method is responsible to build the appropriate subclass of OJElement or returns null if there is none to make. |
protected OJText |
constructSpecialTextSubclass(String value)
This class is responsible to build the appropriate subclass of Text class if one is wished or null otherwise. |
org.jdom.DocType |
docType(String elementName)
Relays to the corresponding DocType. |
org.jdom.DocType |
docType(String elementName,
String systemID)
Relays to the corresponding DocType constructor. |
org.jdom.DocType |
docType(String elementName,
String publicID,
String systemID)
Generic constructor for a doctype... all faithful. |
org.jdom.Document |
document(org.jdom.Element rootElement)
Builds a OJDocument without doctype
calling document(Element,DocType) with a null DocType. |
org.jdom.Document |
document(org.jdom.Element rootElement,
org.jdom.DocType docType)
Constructs a OJDocument with the given docType
always calls constructSpecialDocumentSubclass(org.jdom.Element, org.jdom.DocType) returning
its result if it is non-null. |
org.jdom.Document |
document(org.jdom.Element rootElement,
org.jdom.DocType docType,
String baseURI)
|
org.jdom.Element |
element(String name)
Relays to element(String,Namespace) using Namespace.NO_NAMESPACE. |
org.jdom.Element |
element(String name,
org.jdom.Namespace namespace)
Returns an OJElement subclass according to the name and namespace
given. |
org.jdom.Element |
element(String name,
String uri)
Relays to element(String,Namespace) using Namespace.getNamespace(java.lang.String, java.lang.String). |
org.jdom.Element |
element(String name,
String prefix,
String uri)
Relays to element(String,Namespace) using Namespace.getNamespace(java.lang.String, java.lang.String)
if uri is not null otherwise to element(String). |
org.jdom.EntityRef |
entityRef(String name)
|
org.jdom.EntityRef |
entityRef(String name,
String systemID)
|
org.jdom.EntityRef |
entityRef(String name,
String publicID,
String systemID)
|
org.jdom.ProcessingInstruction |
processingInstruction(String target,
Map data)
|
org.jdom.ProcessingInstruction |
processingInstruction(String target,
String data)
|
void |
reset()
Reverts the internal state of the factory to a blank state. |
void |
setAttribute(org.jdom.Element element,
org.jdom.Attribute a)
|
void |
setLocationProvider(OJSAXBuilder.LocationProvider p)
|
org.jdom.Text |
text(String content)
Returns an appropriate subclass instance of Text,
calling constructSpecialTextSubclass(java.lang.String). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String CVS_ID
@(#) $RCSfile: OJFactory.java,v $ $Revision: 1.21 $ $Date: 2009/09/07 04:26:10 $ $Name: $
public static final boolean DEBUG
protected org.jdom.Element lastElementBuilt
constructSpecialEltSubclass(java.lang.String, org.jdom.Namespace) and constructSpecialAttSubclass(java.lang.String, java.lang.String, int, org.jdom.Namespace).
This member is the reason that this factory is single threaded.
protected OJSAXBuilder.LocationProvider locationProvider
protected boolean isBusy
| Constructor Detail |
|---|
public OJFactory()
| Method Detail |
|---|
public void setLocationProvider(OJSAXBuilder.LocationProvider p)
public void reset()
public org.jdom.CDATA cdata(String text)
cdata in interface org.jdom.JDOMFactorypublic org.jdom.Comment comment(String text)
comment in interface org.jdom.JDOMFactory
public org.jdom.DocType docType(String elementName,
String publicID,
String systemID)
docType in interface org.jdom.JDOMFactoryelementName - The root element namepublicID - The pubicID of the DTDsystemID - The systemID (i.e. URL) of the DTD
public org.jdom.DocType docType(String elementName,
String systemID)
docType in interface org.jdom.JDOMFactoryelementName - The root element-namesystemID - The URL of the DTD
public org.jdom.DocType docType(String elementName)
docType in interface org.jdom.JDOMFactoryelementName - the root element-name
public org.jdom.Document document(org.jdom.Element rootElement,
org.jdom.DocType docType)
OJDocument with the given docType
always calls constructSpecialDocumentSubclass(org.jdom.Element, org.jdom.DocType) returning
its result if it is non-null.
document in interface org.jdom.JDOMFactoryrootElement - The root element of the documentdocType - The chosen doctype
public org.jdom.Document document(org.jdom.Element rootElement,
org.jdom.DocType docType,
String baseURI)
document in interface org.jdom.JDOMFactorypublic org.jdom.Document document(org.jdom.Element rootElement)
OJDocument without doctype
calling document(Element,DocType) with a null DocType.
document in interface org.jdom.JDOMFactoryrootElement - The root element of the document
protected OJDocument constructSpecialDocumentSubclass(org.jdom.Element rootElement,
org.jdom.DocType docType)
document(Element,DocType)
and document(Element).
public org.jdom.Element element(String name,
org.jdom.Namespace namespace)
OJElement subclass according to the name and namespace
given.
Calls the constructSpecialEltSubclass(java.lang.String, org.jdom.Namespace) and, if this
returns null simply creates an OJElement
with the corresponding parameters.
First tries to find the same name in the OJConstants.eltNames so as to be sure it is pinpointed.
element in interface org.jdom.JDOMFactoryname - The element-name wishednamespace - The wished namespace.
Can be null
OJElement subclass constructed accordinglypublic org.jdom.Element element(String name)
element(String,Namespace) using Namespace.NO_NAMESPACE.
element in interface org.jdom.JDOMFactoryname - The element-name wished
OJElement subclass constructed accordingly.
public org.jdom.Element element(String name,
String uri)
element(String,Namespace) using Namespace.getNamespace(java.lang.String, java.lang.String).
element in interface org.jdom.JDOMFactoryname - The element-name wisheduri - The uri of the namespace
OJElement subclass constructed accordingly.
public org.jdom.Element element(String name,
String prefix,
String uri)
element(String,Namespace) using Namespace.getNamespace(java.lang.String, java.lang.String)
if uri is not null otherwise to element(String).
element in interface org.jdom.JDOMFactoryname - The name of the element wishedprefix - The prefix of the namespace to be useduri - The uri of the namespace to be used.
OJElement subclass constructed accordingly.
public org.jdom.Attribute attribute(String name,
String value,
int type,
org.jdom.Namespace namespace)
Attribute class.
Returns a OJReferenceAttribute if the element is supposed to be a
pointer or Attribute otherwise. Recognizes that using the
constructSpecialAttSubclass(java.lang.String, java.lang.String, int, org.jdom.Namespace) method.
The name is first internalized using OJConstants.internalizeAttName(java.lang.String).
attribute in interface org.jdom.JDOMFactoryname - The wished name of the attribute (will be internalized)value - The value of the attributetype - The type of the attribute (one of the constants of Attributenamespace - The namespace of the attribute (can be null in
which case the Namespace.NO_NAMESPACE is used).
Attribute.
public org.jdom.Attribute attribute(String name,
String value,
org.jdom.Namespace namespace)
attribute(String,String,int,Namespace) using
the type Attribute.CDATA_TYPE.
attribute in interface org.jdom.JDOMFactoryAttribute.
public org.jdom.Attribute attribute(String name,
String value,
int type)
attribute(String,String,int,Namespace) using
the Namespace.NO_NAMESPACE.
attribute in interface org.jdom.JDOMFactoryAttribute.
public org.jdom.Attribute attribute(String name,
String value)
attribute(String,String,int,Namespace) using
Namespace.NO_NAMESPACE and the type Attribute.CDATA_TYPE.
attribute in interface org.jdom.JDOMFactoryAttribute.public org.jdom.Text text(String content)
Text,
calling constructSpecialTextSubclass(java.lang.String).
Presumably, it would be meaningful that the saxhandler differentiates between ignoreable-whitespace and not, and that two text factory methods would be given.
text in interface org.jdom.JDOMFactorycontent - The content of the text element
Text elementText.append(java.lang.String)
public org.jdom.ProcessingInstruction processingInstruction(String target,
Map data)
processingInstruction in interface org.jdom.JDOMFactory
public org.jdom.ProcessingInstruction processingInstruction(String target,
String data)
processingInstruction in interface org.jdom.JDOMFactorypublic org.jdom.EntityRef entityRef(String name)
entityRef in interface org.jdom.JDOMFactory
public org.jdom.EntityRef entityRef(String name,
String publicID,
String systemID)
entityRef in interface org.jdom.JDOMFactory
public org.jdom.EntityRef entityRef(String name,
String systemID)
entityRef in interface org.jdom.JDOMFactory
public OJElement constructSpecialEltSubclass(String name,
org.jdom.Namespace namespace)
OJElement or returns null if there is none to make. This
method is designed to be subclassed by more specialized factories which can
then provide other subclasses calling this one to provide the ones of the
OmdocJdom package.
name - the name of the element, as internalized by OJConstants.internalizeEltName(java.lang.String).namespace - the namespace to be used as provided by Namespace.getNamespace(java.lang.String, java.lang.String)
protected org.jdom.Attribute constructSpecialAttSubclass(String name,
String value,
int type,
org.jdom.Namespace namespace)
Attribute or returns null if there is none to make. This
method is designed to be subclassed by more specialized factories which can
then provide other subclasses calling this one to provide the ones of the
OmdocJdom package.
name - the name of the attribute, as internalized by OJConstants.internalizeEltName(java.lang.String).value - the value of the attributetype - the type of the element, as encoded in Attribute
class.namespace - the namespace to be used as provided by Namespace.getNamespace(java.lang.String, java.lang.String)
protected OJText constructSpecialTextSubclass(String value)
Text class if one is wished or null otherwise.
public void addNamespaceDeclaration(org.jdom.Element element,
org.jdom.Namespace additional)
addNamespaceDeclaration in interface org.jdom.JDOMFactory
public void setAttribute(org.jdom.Element element,
org.jdom.Attribute a)
setAttribute in interface org.jdom.JDOMFactory
public void addContent(org.jdom.Parent parent,
org.jdom.Content content)
addContent in interface org.jdom.JDOMFactory
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||