APIdia Launch Partner
Top Fields Constructors Methods
com.sun.org.apache.xalan.internal.xsltc.compiler

pack-priv final Class LiteralElement

extends Instruction
Class Inheritance
Imports
com.sun.org.apache.bcel.internal.generic.ConstantPoolGen, .InstructionList, .PUSH, com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator, .ErrorMsg, .MethodGenerator, .Type, .TypeCheckError, .Util, com.sun.org.apache.xml.internal.serializer.ElemDesc, .ToHTMLStream, java.util.ArrayList, .HashMap, .LinkedHashMap, .Hashtable, .List, .Map, .Set

Authors
Jacek Ambroziak, Santiago Pericas-Geertsen, Morten Jorgensen

Field Summary

Modifier and TypeField and Description
private Map<String, String>
private boolean
private List<SyntaxTreeNode>
private LiteralElement
private String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private String
accessedNamespace(String prefix)

Returns the namespace URI for which a prefix is pointing to

public void
addAttribute(SyntaxTreeNode attribute)

Add an attribute to this element

public boolean
allAttributesUnique()

Return true if all attributes of this LRE have unique names.

private boolean
canProduceAttributeNodes(SyntaxTreeNode node, boolean ignoreXslAttribute)

Return true if the instructions under the given SyntaxTreeNode can produce attribute nodes to an element.

private boolean
checkAttributesUnique()

Check whether all attributes are unique.

protected boolean
contextDependent()

Overrides com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode.contextDependent.

Returns true if this expression/instruction depends on the context.

public void
display(int indent)

Overrides com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode.display.

Displays the contents of this literal element

public ElemDesc
getElemDesc()

Return the ElemDesc object for an HTML element.

public QName
getName()

Returns the QName for this literal element

public Set<Map.Entry<String, String>>
getNamespaceScope(SyntaxTreeNode node)

This method starts at a given node, traverses all namespace mappings, and assembles a list of all prefixes that (for the given node) maps to _ANY_ namespace URI.

private boolean
isHTMLOutput()

Return true if the output method is html.

public void
parseContents(Parser parser)

Overrides com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode.parseContents.

Determines the final QName for the element and its attributes.

public void
registerNamespace(String prefix, String uri, SymbolTable stable, boolean declared)

Method used to keep track of what namespaces that are references by this literal element and its attributes.

public void
setFirstAttribute(SyntaxTreeNode attribute)

Set the first attribute of this element

public void
translate(ClassGenerator classGen, MethodGenerator methodGen)

Overrides com.sun.org.apache.xalan.internal.xsltc.compiler.Instruction.translate.

Compiles code that emits the literal element to the output handler, first the start tag, then namespace declaration, then attributes, then the element contents, and then the element end tag.

private String
translateQName(QName qname, SymbolTable stable)

Translates the prefix of a QName according to the rules set in the attributes of xsl:stylesheet.

public Type
typeCheck(SymbolTable stable)

Overrides com.sun.org.apache.xalan.internal.xsltc.compiler.Instruction.typeCheck.

Type-check the contents of this element.

Field Detail

_accessedPrefixesback to summary
private Map<String, String> _accessedPrefixes
_allAttributesUniqueback to summary
private boolean _allAttributesUnique
_attributeElementsback to summary
private List<SyntaxTreeNode> _attributeElements
_literalElemParentback to summary
private LiteralElement _literalElemParent
_nameback to summary
private String _name

Constructor Detail

LiteralElementback to summary
pack-priv LiteralElement()

Method Detail

accessedNamespaceback to summary
private String accessedNamespace(String prefix)

Returns the namespace URI for which a prefix is pointing to

addAttributeback to summary
public void addAttribute(SyntaxTreeNode attribute)

Add an attribute to this element

allAttributesUniqueback to summary
public boolean allAttributesUnique()

Return true if all attributes of this LRE have unique names.

canProduceAttributeNodesback to summary
private boolean canProduceAttributeNodes(SyntaxTreeNode node, boolean ignoreXslAttribute)

Return true if the instructions under the given SyntaxTreeNode can produce attribute nodes to an element. Only return false when we are sure that no attribute node is produced. Return true if we are not sure. If the flag ignoreXslAttribute is true, the direct <xsl:attribute> children of the current node are not included in the check.

checkAttributesUniqueback to summary
private boolean checkAttributesUnique()

Check whether all attributes are unique.

contextDependentback to summary
protected boolean contextDependent()

Overrides com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode.contextDependent.

Doc from com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode.contextDependent.

Returns true if this expression/instruction depends on the context. By default, every expression/instruction depends on the context unless it overrides this method. Currently used to determine if result trees are compiled using procedures or little DOMs (result tree fragments).

displayback to summary
public void display(int indent)

Overrides com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode.display.

Displays the contents of this literal element

getElemDescback to summary
public ElemDesc getElemDesc()

Return the ElemDesc object for an HTML element. Return null if the output method is not HTML or this is not a valid HTML element.

getNameback to summary
public QName getName()

Returns the QName for this literal element

getNamespaceScopeback to summary
public Set<Map.Entry<String, String>> getNamespaceScope(SyntaxTreeNode node)

This method starts at a given node, traverses all namespace mappings, and assembles a list of all prefixes that (for the given node) maps to _ANY_ namespace URI. Used by literal result elements to determine

isHTMLOutputback to summary
private boolean isHTMLOutput()

Return true if the output method is html.

parseContentsback to summary
public void parseContents(Parser parser)

Overrides com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode.parseContents.

Determines the final QName for the element and its attributes. Registers all namespaces that are used by the element/attributes

registerNamespaceback to summary
public void registerNamespace(String prefix, String uri, SymbolTable stable, boolean declared)

Method used to keep track of what namespaces that are references by this literal element and its attributes. The output must contain a definition for each namespace, so we stuff them in a map.

setFirstAttributeback to summary
public void setFirstAttribute(SyntaxTreeNode attribute)

Set the first attribute of this element

translateback to summary
public void translate(ClassGenerator classGen, MethodGenerator methodGen)

Overrides com.sun.org.apache.xalan.internal.xsltc.compiler.Instruction.translate.

Compiles code that emits the literal element to the output handler, first the start tag, then namespace declaration, then attributes, then the element contents, and then the element end tag. Since the value of an attribute may depend on a variable, variables must be compiled first.

translateQNameback to summary
private String translateQName(QName qname, SymbolTable stable)

Translates the prefix of a QName according to the rules set in the attributes of xsl:stylesheet. Also registers a QName to assure that the output element contains the necessary namespace declarations.

typeCheckback to summary
public Type typeCheck(SymbolTable stable) throws TypeCheckError

Overrides com.sun.org.apache.xalan.internal.xsltc.compiler.Instruction.typeCheck.

Type-check the contents of this element. The element itself does not need any type checking as it leaves nothign on the JVM's stack.