uk.co.weft.domutil
Class ContextElementGenerator
java.lang.Object
uk.co.weft.htform.ResourceConsumerImpl
uk.co.weft.domutil.NodeGeneratorImpl
uk.co.weft.domutil.MaybeParseGenerator
uk.co.weft.domutil.ElementGenerator
uk.co.weft.domutil.ContextElementGenerator
- All Implemented Interfaces:
- NodeGenerator, ResourceConsumer
- public abstract class ContextElementGenerator
- extends ElementGenerator
a ContextElementGenerator generates a DOM elements from contexts. Intended
to be subclassed: add your attrNames and childNames values.
- Version:
- $Revision: 1.4.4.2 $ This revision: $Author: simon $
- Author:
- Simon Brooke
|
Field Summary |
protected java.lang.String[] |
attrNames
The names which, if bound in the generate timecontext, should be
implemented as attributes of the generated element |
protected java.lang.String[] |
childNames
The names which, if bound in the generate time context, should be
implemented as children of the generated element having only text
content. |
|
Constructor Summary |
ContextElementGenerator()
no args constructor; recommend you don't use this, but it makes it
easier to write subclasses |
ContextElementGenerator(java.lang.String name)
constructor: fix up my name |
ContextElementGenerator(java.lang.String name,
java.lang.String[] attrNames,
java.lang.String[] childNames)
constructor: fix up all my instance variables |
|
Method Summary |
Node |
generate(Document doc,
Context context)
construct an element with my name and attach my attributes and
children. |
protected java.lang.String[] |
getAttrNames()
return a String array of the names of my properties to output as
attributes |
protected java.lang.String[] |
getChildNames()
return a String array of the names of my properties to output as
children |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
attrNames
protected java.lang.String[] attrNames
- The names which, if bound in the generate timecontext, should be
implemented as attributes of the generated element
childNames
protected java.lang.String[] childNames
- The names which, if bound in the generate time context, should be
implemented as children of the generated element having only text
content.
ContextElementGenerator
public ContextElementGenerator()
- no args constructor; recommend you don't use this, but it makes it
easier to write subclasses
ContextElementGenerator
public ContextElementGenerator(java.lang.String name)
- constructor: fix up my name
ContextElementGenerator
public ContextElementGenerator(java.lang.String name,
java.lang.String[] attrNames,
java.lang.String[] childNames)
- constructor: fix up all my instance variables
- Parameters:
name - the name of the element I will generateattrNames - the names which, if bound in the generate time
context, should be implemented as attributes of the generated
elementchildNames - the names which, if bound in the generate time
context, should be implemented as children of the generated
element having only text content.
generate
public Node generate(Document doc,
Context context)
throws GenerationException,
DOMException
- construct an element with my name and attach my attributes and
children. Specialise for elements with more complex internal structure
- Specified by:
generate in interface NodeGenerator- Overrides:
generate in class ElementGenerator
- Parameters:
doc - the document in which this element is to be created.context - the context in which this generation takes place
- Returns:
- the element created.
- Throws:
GenerationException - may throw a GenerationException if the
generation cannot be completed.
DOMException - will be passed through if Xerces barfs
getAttrNames
protected java.lang.String[] getAttrNames()
- return a String array of the names of my properties to output as
attributes
getChildNames
protected java.lang.String[] getChildNames()
- return a String array of the names of my properties to output as
children