Class com.ibm.xml.parser.DefaultElementFactory
java.lang.Object
|
+----com.ibm.xml.parser.DefaultElementFactory
- Subclasses:
- SAXDriver, TreeFactory
- public class DefaultElementFactory
- extends java.lang.Object
- implements ElementFactory, java.io.Serializable
The XML4J default factory implementation for creating and initializing the various
components of the Document Object Model (DOM) and XML4J.
Refer to the Element
interface for details on how to extend the
default factories.
- Version:
- Revision: 94 1.5 src/com/ibm/xml/parser/DefaultElementFactory.java, xml4jsrc, xml4j-jtcsv, xml4j_1_0_4
Method Summary
|
AttDef
|
createAttDef(java.lang.String name)
Create and initialize a AttDef instance using the supplied parameters.
|
Attlist
|
createAttlist(java.lang.String name)
Create and initialize a Attlist instance using the supplied parameters.
|
TXAttribute
|
createAttribute(java.lang.String name,
java.lang.String value)
Create and initialize a TXAttribute instance using the supplied parameters.
|
TXAttributeList
|
createAttributeList()
Create and initialize a TXAttributeList instance.
|
TXCDATASection
|
createCDATA(java.lang.String data)
Create and initialize a TXCDATASection instance using the supplied parameters.
|
TXComment
|
createComment(java.lang.String data)
Create and initialize a TXComment instance using the supplied parameters.
|
ContentModel
|
createContentModel(int type)
Create and initialize a ContentModel instance using the supplied parameters.
|
ContentModel
|
createContentModel(CMNode modelGroupNode)
Create and initialize a ContentModel instance using the supplied parameters.
|
TXDocument
|
createDocument()
Create and initialize a TXDocument instance.
|
DTD
|
createDTD()
Create and initialize a DTD instance.
|
DTD
|
createDTD(java.lang.String name,
ExternalID externalID)
Create and initialize a DTD instance using the supplied parameters.
|
TXElement
|
createElement(java.lang.String name)
Create and initialize a TXElement instance using the supplied parameters.
|
ElementDecl
|
createElementDecl(java.lang.String name,
ContentModel contentModel)
Create and initialize a ElementDecl instance using the supplied parameters.
|
Entity
|
createEntity(java.lang.String name,
java.lang.String value,
boolean isParameter)
Create and initialize a Entity instance using the supplied parameters.
|
Entity
|
createEntity(java.lang.String name,
ExternalID externalID,
boolean isParameter,
java.lang.String ndata)
Create and initialize a Entity instance using the supplied parameters.
|
GeneralReference
|
createGeneralReference(java.lang.String name)
Create and initialize a GeneralReference instance using the supplied parameters.
|
java.security.MessageDigest
|
createMessageDigest()
Returns a newly created MessageDigest instance if none currently exists,
or resets the existing digest.
|
NamespacePI
|
createNamespacePI(java.lang.String name,
java.lang.String data,
java.lang.String nsURI,
java.lang.String prefixName,
java.lang.String srcURI)
Create and initialize a NamespacePI instance using the supplied parameters.
|
TXNotation
|
createNotation(java.lang.String name,
ExternalID externalID)
Create and initialize a TXNotation instance using the supplied parameters.
|
TXPI
|
createPI(java.lang.String name,
java.lang.String data)
Create and initialize a TXPI instance using the supplied parameters.
|
StylesheetPI
|
createStylesheetPI(java.lang.String name,
java.lang.String data,
java.lang.String type,
java.lang.String hrefURI,
java.lang.String title)
Create and initialize a StylesheetPI instance using the supplied parameters.
|
TXText
|
createText(java.lang.String data)
Create and initialize a TXText instance using the supplied parameters.
|
TXText
|
createText(java.lang.String data,
boolean isIgnorableWhitespace)
Create and initialize a TXText instance using the supplied parameters.
|
TXText
|
createText(char[] charArray,
int offset,
int length,
boolean isIgnorableWhitespace)
Create and initialize a TXText instance using the supplied parameters.
|
static DefaultElementFactory
|
getInstance()
Returns the current DefaultElementFactory instance; if an instance
does not currently exist, it will be created.
|
void
|
setDigestAlgorithm(java.lang.String defDigestAlgorithm)
Sets the default message digest algorithm for use by createMessageDigest() .
|
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultElementFactory
public DefaultElementFactory()
- Constructor.
getInstance
public static DefaultElementFactory getInstance()
- Returns the current
DefaultElementFactory
instance; if an instance
does not currently exist, it will be created.
- Returns:
- The current default factory instance.
createElement
public TXElement createElement(java.lang.String name)
- Create and initialize a
TXElement
instance using the supplied parameters.
- Implements:
- createElement in interface ElementFactory
- Parameters:
name
- This Element's tag name (qualified name).
- Returns:
- Newly created TXElement.
createAttribute
public TXAttribute createAttribute(java.lang.String name,
java.lang.String value)
- Create and initialize a
TXAttribute
instance using the supplied parameters.
- Implements:
- createAttribute in interface ElementFactory
- Parameters:
name
- The name of this Attribute.
value
- The string value of this Attribute.
- Returns:
- Newly created TXAttribute.
createText
public TXText createText(java.lang.String data)
- Create and initialize a
TXText
instance using the supplied parameters.
- Implements:
- createText in interface ElementFactory
- Parameters:
data
- The actual content of the Text Node.
- Returns:
- Newly created TXText.
createText
public TXText createText(java.lang.String data,
boolean isIgnorableWhitespace)
- Create and initialize a
TXText
instance using the supplied parameters.
- Implements:
- createText in interface ElementFactory
- Parameters:
data
- The actual content of the Text Node.
isIgnorableWhitespace
- =true
space is to be preserved;
=false
space is to be ignored.
- Returns:
- Newly created TXText.
- See Also:
- setIsIgnorableWhitespace
createText
public TXText createText(char[] charArray,
int offset,
int length,
boolean isIgnorableWhitespace)
- Create and initialize a
TXText
instance using the supplied parameters.
- Implements:
- createText in interface ElementFactory
- Parameters:
charArray
- Existing character array to use as actual content of the Text Node.
offset
- Offset into charArray.
length
- Number of charArray characters to use.
isIgnorableWhitespace
- =true
space is to be preserved;
=false
space is to be ignored.
- Returns:
- Newly created TXText.
- See Also:
- setIsIgnorableWhitespace
createCDATA
public TXCDATASection createCDATA(java.lang.String data)
- Create and initialize a
TXCDATASection
instance using the supplied parameters.
- Implements:
- createCDATA in interface ElementFactory
- Parameters:
data
- The actual content of the CDATASection Node.
- Returns:
- Newly created TXCDATASection.
createComment
public TXComment createComment(java.lang.String data)
- Create and initialize a
TXComment
instance using the supplied parameters.
- Implements:
- createComment in interface ElementFactory
- Parameters:
data
- The actual content of the Comment Node.
- Returns:
- Newly created TXComment.
createPI
public TXPI createPI(java.lang.String name,
java.lang.String data)
- Create and initialize a
TXPI
instance using the supplied parameters.
- Implements:
- createPI in interface ElementFactory
- Parameters:
name
- The first token following the markup.
data
- From the character immediately after name to the
character immediately preceding the ?>
.
- Returns:
- Newly created TXPI.
createNamespacePI
public NamespacePI createNamespacePI(java.lang.String name,
java.lang.String data,
java.lang.String nsURI,
java.lang.String prefixName,
java.lang.String srcURI)
- Create and initialize a
NamespacePI
instance using the supplied parameters.
- Implements:
- createNamespacePI in interface ElementFactory
- Parameters:
name
- The first token following the markup (i.e. "xml:namespace").
data
- From the character immediately after the name to the character immediately preceding the ?>
.
nsURI
- The value of the ns=
attribute.
prefixName
- The value of the prefix=
attribute.
srcURI
- The value of the src=
attribute, or null.
- Returns:
- Newly created NamespacePI.
- See Also:
- Namespace
createStylesheetPI
public StylesheetPI createStylesheetPI(java.lang.String name,
java.lang.String data,
java.lang.String type,
java.lang.String hrefURI,
java.lang.String title)
- Create and initialize a
StylesheetPI
instance using the supplied parameters.
- Implements:
- createStylesheetPI in interface ElementFactory
- Parameters:
name
- The first token following the markup (e.g. "xml:stylesheet"
).
data
- From the character immediately after name to the character immediately preceding the ?>
.
type
- The value of the type=
attribute.
hrefURI
- The value of the href=
attribute.
title
- The value of the title=
attribute, or null.
- Returns:
- Newly created StylesheetPI.
createDocument
public TXDocument createDocument()
- Create and initialize a
TXDocument
instance.
- Implements:
- createDocument in interface ElementFactory
- Returns:
- Newly created TXDocument.
createDTD
public DTD createDTD()
- Create and initialize a
DTD
instance.
- Implements:
- createDTD in interface ElementFactory
- Returns:
- Newly created DTD.
createDTD
public DTD createDTD(java.lang.String name,
ExternalID externalID)
- Create and initialize a
DTD
instance using the supplied parameters.
- Implements:
- createDTD in interface ElementFactory
- Parameters:
name
- The name of this DTD. This value is also known as the DOCTYPE
and the root Element Name.
externalID
- The external ID associated with this DTD.
- Returns:
- Newly created DTD.
- See Also:
- ExternalID
createElementDecl
public ElementDecl createElementDecl(java.lang.String name,
ContentModel contentModel)
- Create and initialize a
ElementDecl
instance using the supplied parameters.
- Implements:
- createElementDecl in interface ElementFactory
- Parameters:
name
- This element definition's name.
contentModel
- The content model to associate with this element definition,
or null if the content model is to be set later.
- Returns:
- Newly created ElementDecl.
createContentModel
public ContentModel createContentModel(int type)
- Create and initialize a
ContentModel
instance using the supplied parameters.
This factory is for content models NOT of type MODEL_GROUP.
- Implements:
- createContentModel in interface ElementFactory
- Parameters:
type
- The type for this content model.
Must be one of org.w3c.dom.ElementDefinition#ContentType.
Note that the XML4J parser will never set #PCDATA
as the
content type; MODEL_GROUP
will be set instead.
- Returns:
- Newly created ContentModel.
createContentModel
public ContentModel createContentModel(CMNode modelGroupNode)
- Create and initialize a
ContentModel
instance using the supplied parameters.
This factory is for content models of type MODEL_GROUP
.
- Implements:
- createContentModel in interface ElementFactory
- Parameters:
modelGroupNode
- The content model associated with the model group.
- Returns:
- Newly created ContentModel.
createAttlist
public Attlist createAttlist(java.lang.String name)
- Create and initialize a
Attlist
instance using the supplied parameters.
- Implements:
- createAttlist in interface ElementFactory
- Parameters:
name
- This attribute list's name; this value is also known as the Element type.
- Returns:
- Newly created Attlist.
createAttDef
public AttDef createAttDef(java.lang.String name)
- Create and initialize a
AttDef
instance using the supplied parameters.
- Implements:
- createAttDef in interface ElementFactory
- Parameters:
name
- Name of this attribute as defined by the DTD.
- Returns:
- Newly created AttDef.
createEntity
public Entity createEntity(java.lang.String name,
java.lang.String value,
boolean isParameter)
- Create and initialize a
Entity
instance using the supplied parameters.
This factory is for internal Entities.
- Implements:
- createEntity in interface ElementFactory
- Parameters:
name
- Name of this Entity.
value
- The XML-encoded value that was directly assigned to the Entity.
isParameter
- =true if a parameter Entity; otherwise =false.
- Returns:
- Newly created Entity.
createEntity
public Entity createEntity(java.lang.String name,
ExternalID externalID,
boolean isParameter,
java.lang.String ndata)
- Create and initialize a
Entity
instance using the supplied parameters.
Constructor for external Entities.
- Implements:
- createEntity in interface ElementFactory
- Parameters:
name
- Name of the Entity.
externalID
- The reference(s) to the external entity to retrieve.
isParameter
- =true if a parameter Entity; otherwise =false.
ndata
- The notation associated with the binary Entity, or null if
the Entity is a text Entity.
- Returns:
- Newly created Entity.
- See Also:
- ExternalID
createNotation
public TXNotation createNotation(java.lang.String name,
ExternalID externalID)
- Create and initialize a
TXNotation
instance using the supplied parameters.
- Implements:
- createNotation in interface ElementFactory
- Parameters:
name
- The name of the Notation.
externalID
- The public or system identifier which defines the DTD's notation.
- Returns:
- Newly created TXNotation.
createGeneralReference
public GeneralReference createGeneralReference(java.lang.String name)
- Create and initialize a
GeneralReference
instance using the supplied parameters.
- Implements:
- createGeneralReference in interface ElementFactory
- Parameters:
name
- This General Reference's name. This is also the name of the entity
being referred to by the General Reference.
- Returns:
- Newly created GeneralReference.
createAttributeList
public TXAttributeList createAttributeList()
- Create and initialize a
TXAttributeList
instance.
- Implements:
- createAttributeList in interface ElementFactory
- Returns:
- Newly created TXAttributeList.
createMessageDigest
public java.security.MessageDigest createMessageDigest() throws java.security.NoSuchAlgorithmException
- Returns a newly created
MessageDigest
instance if none currently exists,
or resets the existing digest. The digest will be created based on the existing
digest algorithm (see setDigestAlgorithm
).
- Implements:
- createMessageDigest in interface ElementFactory
- Returns:
- Newly created or reset digest.
- Throws:
- java.security.NoSuchAlgorithmException - Thrown if unable to create a new message
digest based on the default digest algorithm.
- See Also:
- setDigestAlgorithm
setDigestAlgorithm
public void setDigestAlgorithm(java.lang.String defDigestAlgorithm)
- Sets the default message digest algorithm for use by
createMessageDigest()
.
By default, the message digest algorithm is MD5.
- Parameters:
defDigestAlgorithm
- Refer to java.security.MessageDigest for acceptable values.
- See Also:
- createMessageDigest