org.apache.xalan.processor
Class XSLTElementDef

java.lang.Object
  extended by org.apache.xalan.processor.XSLTElementDef
Direct Known Subclasses:
XSLTSchema

public class XSLTElementDef
extends java.lang.Object

This class defines the allowed structure for an element in a XSLT stylesheet, is meant to reflect the structure defined in http://www.w3.org/TR/xslt#dtd, and the mapping between Xalan classes and the markup elements in the XSLT instance. This actually represents both text nodes and elements.


Field Summary
private  XSLTAttributeDef[] m_attributes
          The allowed attributes for this type.
private  java.lang.Class m_classObject
          If non-null, the class object that should in instantiated for a Xalan instance of this element.
private  XSLTElementProcessor m_elementProcessor
          If non-null, the ContentHandler/TransformerFactory for this element.
private  XSLTElementDef[] m_elements
          The allowed elements for this type.
private  boolean m_has_required
          If true, this has a required element.
(package private)  boolean m_isOrdered
           
private  int m_lastOrder
          the highest order of child elements have appeared so far, or -1 if not ordered
private  boolean m_multiAllowed
          True if this element can appear multiple times
private  java.lang.String m_name
          The name of this element.
private  java.lang.String m_nameAlias
          The name of this element.
private  java.lang.String m_namespace
          The allowed namespace for this element.
private  int m_order
          the order that this element should appear, or -1 if not ordered
private  boolean m_required
          If true, this is a required element.
(package private)  java.util.Hashtable m_requiredFound
           
private  int m_type
          The type of this element.
(package private) static int T_ANY
          Content type enumerations
(package private) static int T_ELEMENT
          Content type enumerations
(package private) static int T_PCDATA
          Content type enumerations
 
Constructor Summary
XSLTElementDef()
          Construct an instance of XSLTElementDef.
XSLTElementDef(java.lang.Class classObject, XSLTElementProcessor contentHandler, int type)
          Construct an instance of XSLTElementDef that represents text.
XSLTElementDef(XSLTSchema schema, java.lang.String namespace, java.lang.String name, java.lang.String nameAlias, XSLTElementDef[] elements, XSLTAttributeDef[] attributes, XSLTElementProcessor contentHandler, java.lang.Class classObject)
          Construct an instance of XSLTElementDef.
XSLTElementDef(XSLTSchema schema, java.lang.String namespace, java.lang.String name, java.lang.String nameAlias, XSLTElementDef[] elements, XSLTAttributeDef[] attributes, XSLTElementProcessor contentHandler, java.lang.Class classObject, boolean has_required)
          Construct an instance of XSLTElementDef.
XSLTElementDef(XSLTSchema schema, java.lang.String namespace, java.lang.String name, java.lang.String nameAlias, XSLTElementDef[] elements, XSLTAttributeDef[] attributes, XSLTElementProcessor contentHandler, java.lang.Class classObject, boolean has_required, boolean required)
          Construct an instance of XSLTElementDef.
XSLTElementDef(XSLTSchema schema, java.lang.String namespace, java.lang.String name, java.lang.String nameAlias, XSLTElementDef[] elements, XSLTAttributeDef[] attributes, XSLTElementProcessor contentHandler, java.lang.Class classObject, boolean has_required, boolean required, boolean has_order, int order, boolean multiAllowed)
          Construct an instance of XSLTElementDef.
XSLTElementDef(XSLTSchema schema, java.lang.String namespace, java.lang.String name, java.lang.String nameAlias, XSLTElementDef[] elements, XSLTAttributeDef[] attributes, XSLTElementProcessor contentHandler, java.lang.Class classObject, boolean has_required, boolean required, int order, boolean multiAllowed)
          Construct an instance of XSLTElementDef.
XSLTElementDef(XSLTSchema schema, java.lang.String namespace, java.lang.String name, java.lang.String nameAlias, XSLTElementDef[] elements, XSLTAttributeDef[] attributes, XSLTElementProcessor contentHandler, java.lang.Class classObject, boolean has_order, int order, boolean multiAllowed)
          Construct an instance of XSLTElementDef.
XSLTElementDef(XSLTSchema schema, java.lang.String namespace, java.lang.String name, java.lang.String nameAlias, XSLTElementDef[] elements, XSLTAttributeDef[] attributes, XSLTElementProcessor contentHandler, java.lang.Class classObject, int order, boolean multiAllowed)
          Construct an instance of XSLTElementDef.
 
Method Summary
(package private)  void build(java.lang.String namespace, java.lang.String name, java.lang.String nameAlias, XSLTElementDef[] elements, XSLTAttributeDef[] attributes, XSLTElementProcessor contentHandler, java.lang.Class classObject)
          Construct an instance of XSLTElementDef.
private static boolean equalsMayBeNull(java.lang.Object obj1, java.lang.Object obj2)
          Tell if two objects are equal, when either one may be null.
private static boolean equalsMayBeNullOrZeroLen(java.lang.String s1, java.lang.String s2)
          Tell if the two string refs are equal, equality being defined as: 1) Both strings are null.
(package private)  XSLTAttributeDef getAttributeDef(java.lang.String uri, java.lang.String localName)
          Given a namespace URI, and a local name, return the element's attribute definition, if it has one.
(package private)  XSLTAttributeDef[] getAttributes()
          Get the allowed attributes for this type.
(package private)  java.lang.Class getClassObject()
          Return the class object that should in instantiated for a Xalan instance of this element.
 XSLTElementProcessor getElementProcessor()
          Return the XSLTElementProcessor for this element.
 XSLTElementDef[] getElements()
          Get the allowed elements for this type.
(package private)  int getLastOrder()
          Get the highest order of child elements have appeared so far .
(package private)  boolean getMultiAllowed()
          Get whether this element can appear multiple times
(package private)  java.lang.String getName()
          Get the local name of this element.
(package private)  java.lang.String getNameAlias()
          Get the name of this element.
(package private)  java.lang.String getNamespace()
          Get the allowed namespace for this element.
(package private)  int getOrder()
          Get the order that this element should appear .
(package private)  XSLTElementProcessor getProcessorFor(java.lang.String uri, java.lang.String localName)
          Given a namespace URI, and a local name, get the processor for the element, or return null if not allowed.
(package private)  XSLTElementProcessor getProcessorForUnknown(java.lang.String uri, java.lang.String localName)
          Given an unknown element, get the processor for the element.
(package private)  boolean getRequired()
          Get whether or not this is a required element.
(package private)  java.lang.String getRequiredElem()
          Get required elements that were not found.
(package private)  boolean getRequiredFound()
          Get whether all required elements were found.
(package private)  int getType()
          Get the type of this element.
(package private)  boolean hasRequired()
          Get whether or not this has a required element.
(package private)  boolean isOrdered()
          Get whether this element requires ordered children.
private  boolean QNameEquals(java.lang.String uri, java.lang.String localName)
          Tell if the namespace URI and local name match this element.
 void setElementProcessor(XSLTElementProcessor handler)
          Set the XSLTElementProcessor for this element.
(package private)  void setElements(XSLTElementDef[] defs)
          Set the allowed elements for this type.
(package private)  void setLastOrder(int order)
          Set the highest order of child elements have appeared so far .
(package private)  void setRequiredFound(java.lang.String elem, boolean found)
          Set this required element found.
(package private)  void setType(int t)
          Set the type of this element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

T_ELEMENT

static final int T_ELEMENT
Content type enumerations

See Also:
Constant Field Values

T_PCDATA

static final int T_PCDATA
Content type enumerations

See Also:
Constant Field Values

T_ANY

static final int T_ANY
Content type enumerations

See Also:
Constant Field Values

m_type

private int m_type
The type of this element.


m_namespace

private java.lang.String m_namespace
The allowed namespace for this element.


m_name

private java.lang.String m_name
The name of this element.


m_nameAlias

private java.lang.String m_nameAlias
The name of this element.


m_elements

private XSLTElementDef[] m_elements
The allowed elements for this type.


m_attributes

private XSLTAttributeDef[] m_attributes
The allowed attributes for this type.


m_elementProcessor

private XSLTElementProcessor m_elementProcessor
If non-null, the ContentHandler/TransformerFactory for this element.


m_classObject

private java.lang.Class m_classObject
If non-null, the class object that should in instantiated for a Xalan instance of this element.


m_has_required

private boolean m_has_required
If true, this has a required element.


m_required

private boolean m_required
If true, this is a required element.


m_requiredFound

java.util.Hashtable m_requiredFound

m_isOrdered

boolean m_isOrdered

m_order

private int m_order
the order that this element should appear, or -1 if not ordered


m_lastOrder

private int m_lastOrder
the highest order of child elements have appeared so far, or -1 if not ordered


m_multiAllowed

private boolean m_multiAllowed
True if this element can appear multiple times

Constructor Detail

XSLTElementDef

XSLTElementDef()
Construct an instance of XSLTElementDef. This must be followed by a call to build().


XSLTElementDef

XSLTElementDef(XSLTSchema schema,
               java.lang.String namespace,
               java.lang.String name,
               java.lang.String nameAlias,
               XSLTElementDef[] elements,
               XSLTAttributeDef[] attributes,
               XSLTElementProcessor contentHandler,
               java.lang.Class classObject)
Construct an instance of XSLTElementDef.

Parameters:
namespace - The Namespace URI, "*", or null.
name - The local name (without prefix), "*", or null.
nameAlias - A potential alias for the name, or null.
elements - An array of allowed child element defs, or null.
attributes - An array of allowed attribute defs, or null.
contentHandler - The element processor for this element.
classObject - The class of the object that this element def should produce.

XSLTElementDef

XSLTElementDef(XSLTSchema schema,
               java.lang.String namespace,
               java.lang.String name,
               java.lang.String nameAlias,
               XSLTElementDef[] elements,
               XSLTAttributeDef[] attributes,
               XSLTElementProcessor contentHandler,
               java.lang.Class classObject,
               boolean has_required)
Construct an instance of XSLTElementDef.

Parameters:
namespace - The Namespace URI, "*", or null.
name - The local name (without prefix), "*", or null.
nameAlias - A potential alias for the name, or null.
elements - An array of allowed child element defs, or null.
attributes - An array of allowed attribute defs, or null.
contentHandler - The element processor for this element.
classObject - The class of the object that this element def should produce.
has_required - true if this element has required elements by the XSLT specification.

XSLTElementDef

XSLTElementDef(XSLTSchema schema,
               java.lang.String namespace,
               java.lang.String name,
               java.lang.String nameAlias,
               XSLTElementDef[] elements,
               XSLTAttributeDef[] attributes,
               XSLTElementProcessor contentHandler,
               java.lang.Class classObject,
               boolean has_required,
               boolean required)
Construct an instance of XSLTElementDef.

Parameters:
namespace - The Namespace URI, "*", or null.
name - The local name (without prefix), "*", or null.
nameAlias - A potential alias for the name, or null.
elements - An array of allowed child element defs, or null.
attributes - An array of allowed attribute defs, or null.
contentHandler - The element processor for this element.
classObject - The class of the object that this element def should produce.
has_required - true if this element has required elements by the XSLT specification.
required - true if this element is required by the XSLT specification.

XSLTElementDef

XSLTElementDef(XSLTSchema schema,
               java.lang.String namespace,
               java.lang.String name,
               java.lang.String nameAlias,
               XSLTElementDef[] elements,
               XSLTAttributeDef[] attributes,
               XSLTElementProcessor contentHandler,
               java.lang.Class classObject,
               boolean has_required,
               boolean required,
               int order,
               boolean multiAllowed)
Construct an instance of XSLTElementDef.

Parameters:
namespace - The Namespace URI, "*", or null.
name - The local name (without prefix), "*", or null.
nameAlias - A potential alias for the name, or null.
elements - An array of allowed child element defs, or null.
attributes - An array of allowed attribute defs, or null.
contentHandler - The element processor for this element.
classObject - The class of the object that this element def should produce.
has_required - true if this element has required elements by the XSLT specification.
required - true if this element is required by the XSLT specification.
order - the order this element should appear according to the XSLT specification.
multiAllowed - whether this element is allowed more than once

XSLTElementDef

XSLTElementDef(XSLTSchema schema,
               java.lang.String namespace,
               java.lang.String name,
               java.lang.String nameAlias,
               XSLTElementDef[] elements,
               XSLTAttributeDef[] attributes,
               XSLTElementProcessor contentHandler,
               java.lang.Class classObject,
               boolean has_required,
               boolean required,
               boolean has_order,
               int order,
               boolean multiAllowed)
Construct an instance of XSLTElementDef.

Parameters:
namespace - The Namespace URI, "*", or null.
name - The local name (without prefix), "*", or null.
nameAlias - A potential alias for the name, or null.
elements - An array of allowed child element defs, or null.
attributes - An array of allowed attribute defs, or null.
contentHandler - The element processor for this element.
classObject - The class of the object that this element def should produce.
has_required - true if this element has required elements by the XSLT specification.
required - true if this element is required by the XSLT specification.
has_order - whether this element has ordered child elements
order - the order this element should appear according to the XSLT specification.
multiAllowed - whether this element is allowed more than once

XSLTElementDef

XSLTElementDef(XSLTSchema schema,
               java.lang.String namespace,
               java.lang.String name,
               java.lang.String nameAlias,
               XSLTElementDef[] elements,
               XSLTAttributeDef[] attributes,
               XSLTElementProcessor contentHandler,
               java.lang.Class classObject,
               boolean has_order,
               int order,
               boolean multiAllowed)
Construct an instance of XSLTElementDef.

Parameters:
namespace - The Namespace URI, "*", or null.
name - The local name (without prefix), "*", or null.
nameAlias - A potential alias for the name, or null.
elements - An array of allowed child element defs, or null.
attributes - An array of allowed attribute defs, or null.
contentHandler - The element processor for this element.
classObject - The class of the object that this element def should produce.
has_order - whether this element has ordered child elements
order - the order this element should appear according to the XSLT specification.
multiAllowed - whether this element is allowed more than once

XSLTElementDef

XSLTElementDef(XSLTSchema schema,
               java.lang.String namespace,
               java.lang.String name,
               java.lang.String nameAlias,
               XSLTElementDef[] elements,
               XSLTAttributeDef[] attributes,
               XSLTElementProcessor contentHandler,
               java.lang.Class classObject,
               int order,
               boolean multiAllowed)
Construct an instance of XSLTElementDef.

Parameters:
namespace - The Namespace URI, "*", or null.
name - The local name (without prefix), "*", or null.
nameAlias - A potential alias for the name, or null.
elements - An array of allowed child element defs, or null.
attributes - An array of allowed attribute defs, or null.
contentHandler - The element processor for this element.
classObject - The class of the object that this element def should produce.
order - the order this element should appear according to the XSLT specification.
multiAllowed - whether this element is allowed more than once

XSLTElementDef

XSLTElementDef(java.lang.Class classObject,
               XSLTElementProcessor contentHandler,
               int type)
Construct an instance of XSLTElementDef that represents text.

Parameters:
classObject - The class of the object that this element def should produce.
contentHandler - The element processor for this element.
type - Content type, one of T_ELEMENT, T_PCDATA, or T_ANY.
Method Detail

build

void build(java.lang.String namespace,
           java.lang.String name,
           java.lang.String nameAlias,
           XSLTElementDef[] elements,
           XSLTAttributeDef[] attributes,
           XSLTElementProcessor contentHandler,
           java.lang.Class classObject)
Construct an instance of XSLTElementDef.

Parameters:
namespace - The Namespace URI, "*", or null.
name - The local name (without prefix), "*", or null.
nameAlias - A potential alias for the name, or null.
elements - An array of allowed child element defs, or null.
attributes - An array of allowed attribute defs, or null.
contentHandler - The element processor for this element.
classObject - The class of the object that this element def should produce.

equalsMayBeNull

private static boolean equalsMayBeNull(java.lang.Object obj1,
                                       java.lang.Object obj2)
Tell if two objects are equal, when either one may be null. If both are null, they are considered equal.

Parameters:
obj1 - A reference to the first object, or null.
obj2 - A reference to the second object, or null.
Returns:
true if the to objects are equal by both being null or because obj2.equals(obj1) returns true.

equalsMayBeNullOrZeroLen

private static boolean equalsMayBeNullOrZeroLen(java.lang.String s1,
                                                java.lang.String s2)
Tell if the two string refs are equal, equality being defined as: 1) Both strings are null. 2) One string is null and the other is empty. 3) Both strings are non-null, and equal.

Parameters:
s1 - A reference to the first string, or null.
s2 - A reference to the second string, or null.
Returns:
true if Both strings are null, or if one string is null and the other is empty, or if both strings are non-null, and equal because s1.equals(s2) returns true.

getType

int getType()
Get the type of this element.

Returns:
Content type, one of T_ELEMENT, T_PCDATA, or T_ANY.

setType

void setType(int t)
Set the type of this element.

Parameters:
t - Content type, one of T_ELEMENT, T_PCDATA, or T_ANY.

getNamespace

java.lang.String getNamespace()
Get the allowed namespace for this element.

Returns:
The Namespace URI, "*", or null.

getName

java.lang.String getName()
Get the local name of this element.

Returns:
The local name of this element, "*", or null.

getNameAlias

java.lang.String getNameAlias()
Get the name of this element.

Returns:
A potential alias for the name, or null.

getElements

public XSLTElementDef[] getElements()
Get the allowed elements for this type.

Returns:
An array of allowed child element defs, or null.

setElements

void setElements(XSLTElementDef[] defs)
Set the allowed elements for this type.

Parameters:
defs - An array of allowed child element defs, or null.

QNameEquals

private boolean QNameEquals(java.lang.String uri,
                            java.lang.String localName)
Tell if the namespace URI and local name match this element.

Parameters:
uri - The namespace uri, which may be null.
localName - The local name of an element, which may be null.
Returns:
true if the uri and local name arguments are considered to match the uri and local name of this element def.

getProcessorFor

XSLTElementProcessor getProcessorFor(java.lang.String uri,
                                     java.lang.String localName)
Given a namespace URI, and a local name, get the processor for the element, or return null if not allowed.

Parameters:
uri - The Namespace URI, or an empty string.
localName - The local name (without prefix), or empty string if not namespace processing.
Returns:
The element processor that matches the arguments, or null.

getProcessorForUnknown

XSLTElementProcessor getProcessorForUnknown(java.lang.String uri,
                                            java.lang.String localName)
Given an unknown element, get the processor for the element.

Parameters:
uri - The Namespace URI, or an empty string.
localName - The local name (without prefix), or empty string if not namespace processing.
Returns:
normally a ProcessorUnknown reference.
See Also:
ProcessorUnknown

getAttributes

XSLTAttributeDef[] getAttributes()
Get the allowed attributes for this type.

Returns:
An array of allowed attribute defs, or null.

getAttributeDef

XSLTAttributeDef getAttributeDef(java.lang.String uri,
                                 java.lang.String localName)
Given a namespace URI, and a local name, return the element's attribute definition, if it has one.

Parameters:
uri - The Namespace URI, or an empty string.
localName - The local name (without prefix), or empty string if not namespace processing.
Returns:
The attribute def that matches the arguments, or null.

getElementProcessor

public XSLTElementProcessor getElementProcessor()
Return the XSLTElementProcessor for this element.

Returns:
The element processor for this element.

setElementProcessor

public void setElementProcessor(XSLTElementProcessor handler)
Set the XSLTElementProcessor for this element.

Parameters:
handler - The element processor for this element.

getClassObject

java.lang.Class getClassObject()
Return the class object that should in instantiated for a Xalan instance of this element.

Returns:
The class of the object that this element def should produce, or null.

hasRequired

boolean hasRequired()
Get whether or not this has a required element.

Returns:
true if this this has a required element.

getRequired

boolean getRequired()
Get whether or not this is a required element.

Returns:
true if this is a required element.

setRequiredFound

void setRequiredFound(java.lang.String elem,
                      boolean found)
Set this required element found.


getRequiredFound

boolean getRequiredFound()
Get whether all required elements were found.

Returns:
true if all required elements were found.

getRequiredElem

java.lang.String getRequiredElem()
Get required elements that were not found.

Returns:
required elements that were not found.

isOrdered

boolean isOrdered()
Get whether this element requires ordered children.

Returns:
true if this element requires ordered children.

getOrder

int getOrder()
Get the order that this element should appear .

Returns:
the order that this element should appear.

getLastOrder

int getLastOrder()
Get the highest order of child elements have appeared so far .

Returns:
the highest order of child elements have appeared so far.

setLastOrder

void setLastOrder(int order)
Set the highest order of child elements have appeared so far .

Parameters:
order - the highest order of child elements have appeared so far.

getMultiAllowed

boolean getMultiAllowed()
Get whether this element can appear multiple times

Returns:
true if this element can appear multiple times