com.simonstl.fragment
Class DocComponent

java.lang.Object
  |
  +--com.simonstl.fragment.DocComponent
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
Attribute, Characters, Element, Skip

public abstract class DocComponent
extends java.lang.Object
implements java.lang.Cloneable

The DocComponent abstract class stores information about XML document components in a way which makes it easy use them in a streaming SAX environment.

Version 0.04 removes the isAttribute property and getIsAttribute() method.

Version 0.03 adds the cleanDuplicate() method.

Version 0.02 adds the boolean isAttribute and the getIsAttribute() method.

version 0.01 is the initial release, based on version 0.05 of the Element class.

Version:
0.04 5 July 2001
Author:
Simon St.Laurent

Field Summary
protected  java.lang.String after
           
protected  java.lang.String before
           
protected  java.lang.String content
           
protected  java.lang.String localName
           
protected  java.lang.String nsURI
           
protected  java.lang.String prefix
           
protected  java.lang.String type
           
 
Constructor Summary
DocComponent()
           
 
Method Summary
 void addContent(DocComponent newComponent)
          Sets the content for this component.
abstract  DocComponent cleanDuplicate()
          Returns a clean copy of the component and its contents.
 void clearContent()
          Clears the content for this component.
 java.lang.Object clone()
          This method is here to provide clone-ability.
abstract  void eventComponent(FragmentFilter handler)
          Describes the content for this component as a series of SAX events.
 java.lang.String getAfter()
          Returns a string of content which may appear after the component
 java.lang.String getBefore()
          Returns a string of content which may appear before the component
 java.lang.String getContent()
          Returns the content for this component.
abstract  java.lang.String getKey()
          Returns a key which can be used as a unique identifier for this component.
 java.lang.String getLocalName()
          Returns the local name for the component
 java.lang.String getNsURI()
          Returns the URI reference value for the namespace.
 java.lang.String getPrefix()
          Returns the prefix used to represent the namespace URI reference for this component.
 java.lang.String getType()
          Sets the type for this component.
abstract  boolean matchComponent(java.lang.String match)
          Takes a string representing a component description and returns true or false to indicate whether or not it matches this component.
abstract  void print()
          Prints a representation of the component to STDOUT
 void processComponentContent(FragmentRules rules)
          Supports processing of content, if any.
 void setAfter(java.lang.String newAfter)
          Sets a string of content which may appear after the component
 void setBefore(java.lang.String newBefore)
          Sets a string of content which may appear before the component
 void setContent(java.lang.String newContent)
          Sets the content for this component.
 void setLocalName(java.lang.String newLocalName)
          Accepts a string which will serve as the local name for this component.
 void setNsURI(java.lang.String newNsURI)
          Accepts a URI reference value which is used as the namespace for the component.
 void setPrefix(java.lang.String newPrefix)
          Accepts a string which serves as the prefix for this component.
 void setType(java.lang.String _type)
          Gets the type for this component.
abstract  java.lang.String toString()
          Returns a representation of the component as a String.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nsURI

protected java.lang.String nsURI

localName

protected java.lang.String localName

prefix

protected java.lang.String prefix

content

protected java.lang.String content

before

protected java.lang.String before

after

protected java.lang.String after

type

protected java.lang.String type
Constructor Detail

DocComponent

public DocComponent()
Method Detail

matchComponent

public abstract boolean matchComponent(java.lang.String match)
Takes a string representing a component description and returns true or false to indicate whether or not it matches this component.

getKey

public abstract java.lang.String getKey()
Returns a key which can be used as a unique identifier for this component.

setNsURI

public void setNsURI(java.lang.String newNsURI)
Accepts a URI reference value which is used as the namespace for the component.

getNsURI

public java.lang.String getNsURI()
Returns the URI reference value for the namespace.

setLocalName

public void setLocalName(java.lang.String newLocalName)
Accepts a string which will serve as the local name for this component.

getLocalName

public java.lang.String getLocalName()
Returns the local name for the component

setPrefix

public void setPrefix(java.lang.String newPrefix)
Accepts a string which serves as the prefix for this component.

getPrefix

public java.lang.String getPrefix()
Returns the prefix used to represent the namespace URI reference for this component.

setContent

public void setContent(java.lang.String newContent)
Sets the content for this component.

addContent

public void addContent(DocComponent newComponent)
Sets the content for this component.

clearContent

public void clearContent()
Clears the content for this component.

getContent

public java.lang.String getContent()
Returns the content for this component.

setBefore

public void setBefore(java.lang.String newBefore)
Sets a string of content which may appear before the component

getBefore

public java.lang.String getBefore()
Returns a string of content which may appear before the component

setAfter

public void setAfter(java.lang.String newAfter)
Sets a string of content which may appear after the component

getAfter

public java.lang.String getAfter()
Returns a string of content which may appear after the component

getType

public java.lang.String getType()
Sets the type for this component. CDATA is typical for attributes, but may be used for others.

setType

public void setType(java.lang.String _type)
Gets the type for this component. CDATA is typical for attributes, but may be used for others.

eventComponent

public abstract void eventComponent(FragmentFilter handler)
                             throws org.xml.sax.SAXException
Describes the content for this component as a series of SAX events. Note that FragmentFilter supports some events (startChars and endChars) which are extensions to the existing SAX models and which serve to keep the stacks under control.

print

public abstract void print()
Prints a representation of the component to STDOUT

toString

public abstract java.lang.String toString()
Returns a representation of the component as a String.
Overrides:
toString in class java.lang.Object

processComponentContent

public void processComponentContent(FragmentRules rules)
Supports processing of content, if any. By default, does nothing. (Element overrides, Attribute will.)

cleanDuplicate

public abstract DocComponent cleanDuplicate()
Returns a clean copy of the component and its contents.

clone

public java.lang.Object clone()
This method is here to provide clone-ability. Replaced by cleanDuplicate().
Overrides:
clone in class java.lang.Object