|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exolab.adaptx.xslt.XSLObject
public class XSLObject
This class represents an XSLObject in the style tree. It is the most basic of all XSLObjects and contains common functionality across different XSLObjects. I originally had this implemented as an extended W3C DOM XML Element, but due to problems with extending different implementations, and to make it more cross-DOM accessible I've chosen an this approach. Since this once was a DOM Element, you will notice many of the methods are very DOM-like.
Field Summary | |
---|---|
static short |
APPLY_IMPORTS
|
static short |
APPLY_TEMPLATES
|
static short |
ARG
|
static short |
ATTRIBUTE
|
static short |
ATTRIBUTE_SET
|
static short |
CALL_TEMPLATE
|
static short |
CDATA
|
static short |
CHOOSE
|
static short |
COMMENT
|
static short |
CONTENTS
|
static short |
COPY
|
static short |
COPY_OF
|
static short |
ELEMENT
|
static short |
ENTITY_REF
|
static short |
FOR_EACH
|
static short |
FUNCTIONS
|
static short |
ID
|
static short |
IF
|
static short |
IMPORT
|
static short |
INCLUDE
|
static short |
KEY
|
static short |
LITERAL
|
static short |
LOCALE
|
static short |
MESSAGE
|
static short |
NUMBER
|
static short |
OTHERWISE
|
static short |
OUTPUT
|
static short |
PARAM
|
static short |
PI
|
static short |
PRESERVE_SPACE
|
static short |
SCRIPT
|
static short |
SORT
|
static short |
STRIP_SPACE
|
static short |
STYLESHEET
|
static short |
TEMPLATE
|
static short |
TEXT
|
static short |
VALUE_OF
|
static short |
VARIABLE
|
static short |
WHEN
|
static short |
WITH_PARAM
|
Constructor Summary | |
---|---|
XSLObject(short type)
Creates an XSLObject using the specified type |
Method Summary | |
---|---|
void |
addNamespaceDecl(java.lang.String prefix,
java.lang.String namespace)
Adds the Given namespace declaration to this XSLObject's set of namespace declarations |
boolean |
appendAction(XSLObject xslObject)
Appends the given XSLObject to this XSLObject's list of actions. |
void |
appendText(char[] chars,
int start,
int length)
Appends the text to this XSLObject. |
void |
appendText(java.lang.String text)
Appends the text to this XSLObject. |
ActionTemplate |
getActions()
Returns the list of actions for this XSLObject |
java.lang.String |
getAttribute(java.lang.String name)
Returns the value of the attribute whose name is equal to the given name. |
org.xml.sax.AttributeList |
getAttributes()
Returns the value of the specified attribute as an AttributeValueTemplate |
java.lang.String |
getNamespace()
Returns this XSLObject's namespace URI. |
XSLObject |
getNearestAncestor(short type)
Returns the nearest ancestor of this XSLObject that is of the given type. |
static java.lang.String |
getNodeValue(org.w3c.dom.Node node)
Returns the String value of a DOM Node. |
XSLTStylesheet |
getStylesheet()
Returns the XSLStylesheet which contains this XSLObject |
static java.lang.String |
getText(org.w3c.dom.Element element)
Retrieves the text of an Element |
short |
getType()
Returns the type of XSLObject this Object represents |
static short |
getTypeFromName(java.lang.String name)
Returns the type of XSL Object that has the given name |
java.lang.String |
getTypeName()
Returns the name of this XSLObject |
java.lang.String |
resolveNamespace(java.lang.String prefix)
|
void |
setAllowActions(boolean allow)
|
void |
setAttribute(java.lang.String name,
java.lang.String value)
Sets the attribute with the given name to the given value. |
void |
setNamespace(java.lang.String uri)
Sets this XSLObject's namespace URI |
void |
setTypeName(java.lang.String name)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final short APPLY_IMPORTS
public static final short APPLY_TEMPLATES
public static final short ARG
public static final short ATTRIBUTE
public static final short ATTRIBUTE_SET
public static final short CALL_TEMPLATE
public static final short CDATA
public static final short CHOOSE
public static final short COMMENT
public static final short CONTENTS
public static final short COPY
public static final short COPY_OF
public static final short ELEMENT
public static final short FOR_EACH
public static final short FUNCTIONS
public static final short ID
public static final short IF
public static final short IMPORT
public static final short INCLUDE
public static final short KEY
public static final short LITERAL
public static final short LOCALE
public static final short MESSAGE
public static final short NUMBER
public static final short OTHERWISE
public static final short OUTPUT
public static final short PARAM
public static final short PI
public static final short PRESERVE_SPACE
public static final short SORT
public static final short STRIP_SPACE
public static final short STYLESHEET
public static final short TEMPLATE
public static final short TEXT
public static final short VALUE_OF
public static final short VARIABLE
public static final short WHEN
public static final short WITH_PARAM
public static final short ENTITY_REF
public static final short SCRIPT
Constructor Detail |
---|
public XSLObject(short type)
parentStylesheet
- the owner XSLStylesheet
of the new Elementtype
- the type of XSLObject that the new instance
representsMethod Detail |
---|
public void addNamespaceDecl(java.lang.String prefix, java.lang.String namespace)
public boolean appendAction(XSLObject xslObject)
xslObject
- the XSLObject to add to this XSLObject's
list of actions
public void appendText(java.lang.String text)
text
- the text to appendpublic void appendText(char[] chars, int start, int length)
text
- the text to appendpublic ActionTemplate getActions()
public java.lang.String getAttribute(java.lang.String name)
public org.xml.sax.AttributeList getAttributes()
XSLException
- when the Attribute is not a valid
AttrubueValueTemplate
public AttributeValueTemplate getAttributeAsAVT(String name)
throws XSLException
{
if (name == null) return null;
String attValue = getAttribute(name);
AttributeValueTemplate avt = null;
if ((attValue != null) && (attValue.length() > 0)) {
// look in cache first
avt = (AttributeValueTemplate) avtCache.get(attValue);
if (avt == null) {
try {
avt = new AttributeValueTemplate(attValue);
// add to cache for performace
// Do we need to clean cache? Yes if we are reusing
// XSLObjects. No if not. I am currently not
// reusing XSLObjects so I am not doing any house
// cleaning. This could lead to memory problems if
// XSLObjects are reused heavily.
avtCache.put(attValue, avt);
}
catch(InvalidExprException iee) {
throw new XSLException
(XSLException.INVALID_ATTRIBUTE_VALUE_TEMPLATE,
iee.getMessage());
}
}
}
return avt;
} //-- getAttributeAsAVT
/**
Returns the AttributeList for this XSLObjectpublic java.lang.String getNamespace()
public XSLObject getNearestAncestor(short type)
type
- the type of ancestor to search for
public static java.lang.String getNodeValue(org.w3c.dom.Node node)
Node
public XSLTStylesheet getStylesheet()
public static java.lang.String getText(org.w3c.dom.Element element)
Element
public final short getType()
public static short getTypeFromName(java.lang.String name)
name
- the name the XSLObject
public java.lang.String getTypeName()
public java.lang.String resolveNamespace(java.lang.String prefix)
public void setAllowActions(boolean allow)
public void setTypeName(java.lang.String name)
public void setAttribute(java.lang.String name, java.lang.String value) throws XSLException
name
- the name of the attribute to setvalue
- the value to set the attribute to
XSLException
- if this XSLObject does not allow attributes
with the given name, or if the attribute is read onlypublic void setNamespace(java.lang.String uri)
uri
- the namespace URI
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |