APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xml.internal.security.utils

public abstract Class ElementProxy

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.org.apache.xml.internal.security.utils.Signature11ElementProxy, com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy, com.sun.org.apache.xml.internal.security.keys.KeyInfo, com.sun.org.apache.xml.internal.security.transforms.params.InclusiveNamespaces, com.sun.org.apache.xml.internal.security.transforms.params.XPath2FilterContainer
Imports
java.math.BigInteger, java.util.Map, java.util.concurrent.ConcurrentHashMap, com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException, org.w3c.dom.Attr, .Document, .Element, .Node, .NodeList, .Text

This is the base class to all Objects which have a direct 1:1 mapping to an Element in a particular namespace.

Field Summary

Modifier and TypeField and Description
protected String
baseURI

Field baseURI

protected static final Logger
private static Map<String, String>
prefixMappings

Field prefixMappings

private Document
wrappedDoc

Field doc

private Element
wrappedElement

What XML element does this ElementProxy instance wrap?

Constructor Summary

AccessConstructor and Description
public
ElementProxy()

Constructor ElementProxy

public
ElementProxy(Document doc)

Constructor ElementProxy

public
ElementProxy(Element element, String baseURI)

Constructor ElementProxy

Method Summary

Modifier and TypeMethod and Description
public void
addBase64Element(byte[] bytes, String localname)

Method addBase64Element

public void
addBase64Text(byte[] bytes)

Method addBase64Text

public void
addBigIntegerElement(BigInteger bi, String localname)

Method addBigIntegerElement

protected void
public void
addText(String text)

Method addText

public void
addTextElement(String text, String localname)

Method addTextElement

protected void
appendOther(Element parent, Node toAppend)

protected void
protected void
appendSelf(Node toAppend)

public static Element

Returns:

The element created.
createElementForFamily
(Document doc, String namespace, String localName)

This method creates an Element in a given namespace with a given localname.

protected Element
protected Text
public abstract String

Returns:

the localname of the Elements of the sub-class.
getBaseLocalName
()

Returns the localname of the Elements of the sub-class.

public abstract String

Returns:

the namespace of the Elements of the sub-class.
getBaseNamespace
()

Returns the namespace of the Elements of the sub-class.

public String

Returns:

the base uri of the namespace of this element
getBaseURI
()

Method getBaseURI

public BigInteger

Returns:

The biginteger contained in the given element
getBigIntegerFromChildElement
(String localname, String namespace)

Method getVal

public byte[]

Returns:

The base64 bytes from the text children of this element
getBytesFromTextChild
()

Method getBytesFromTextChild

public static String

Returns:

the default prefix bind to this element.
getDefaultPrefix
(String namespace)

Method getDefaultPrefix

public Document

Returns:

the Document where this element is contained.
getDocument
()

Method getDocument

public final Element

Returns:

the Element which was constructed by the Object.
getElement
()

Returns the Element which was constructed by the Object.

public final NodeList

Returns:

the Element which was constructed by the Object.
getElementPlusReturns
()

Returns the Element plus a leading and a trailing CarriageReturn Text node.

protected Node
protected String
public String

Returns:

the Text of the textNode
getTextFromChildElement
(String localname, String namespace)

Method getTextFromChildElement

public String

Returns:

the Text obtained by concatenating all the text nodes of this element
getTextFromTextChild
()

Method getTextFromTextChild

pack-priv void
guaranteeThatElementInCorrectSpace()

Method guaranteeThatElementInCorrectSpace

public int

Returns:

the number of elements {namespace}:localname under this element
length
(String namespace, String localname)

Method length

public static void
registerDefaultPrefixes()

This method registers the default prefixes.

public static void
setDefaultPrefix(String namespace, String prefix)

Method setDefaultPrefix

protected void
setDocument(Document
New document object being wrapped.
doc
)

Set a new value for the wrapped document that this object is a proxy for.

public void
setElement(Element element, String baseURI)

Method setElement

protected void
setElement(Element
New element
elem
)

New value for the wrapped XML element that this object is a proxy for.

protected void
setLocalAttribute(String attrName, String value)

protected void
private static void
setNamespacePrefix(String namespace, String prefix)

public void
setXPathNamespaceContext(String prefix, String uri)

Adds an xmlns: definition to the Element.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

baseURIback to summary
protected String baseURI

Field baseURI

LOGback to summary
protected static final Logger LOG
prefixMappingsback to summary
private static Map<String, String> prefixMappings

Field prefixMappings

wrappedDocback to summary
private Document wrappedDoc

Field doc

wrappedElementback to summary
private Element wrappedElement

What XML element does this ElementProxy instance wrap?

Constructor Detail

ElementProxyback to summary
public ElementProxy()

Constructor ElementProxy

ElementProxyback to summary
public ElementProxy(Document doc)

Constructor ElementProxy

ElementProxyback to summary
public ElementProxy(Element element, String baseURI) throws XMLSecurityException

Constructor ElementProxy

Method Detail

addBase64Elementback to summary
public void addBase64Element(byte[] bytes, String localname)

Method addBase64Element

addBase64Textback to summary
public void addBase64Text(byte[] bytes)

Method addBase64Text

addBigIntegerElementback to summary
public void addBigIntegerElement(BigInteger bi, String localname)

Method addBigIntegerElement

addReturnToSelfback to summary
protected void addReturnToSelf()
addTextback to summary
public void addText(String text)

Method addText

addTextElementback to summary
public void addTextElement(String text, String localname)

Method addTextElement

appendOtherback to summary
protected void appendOther(Element parent, Node toAppend)
appendSelfback to summary
protected void appendSelf(ElementProxy toAppend)
appendSelfback to summary
protected void appendSelf(Node toAppend)
createElementForFamilyback to summary
public static Element createElementForFamily(Document doc, String namespace, String localName)

This method creates an Element in a given namespace with a given localname. It uses the ElementProxy#getDefaultPrefix method to decide whether a particular prefix is bound to that namespace.

This method was refactored out of the constructor.
Returns:Element

The element created.

createElementForFamilyLocalback to summary
protected Element createElementForFamilyLocal(String namespace, String localName)
createTextback to summary
protected Text createText(String text)
getBaseLocalNameback to summary
public abstract String getBaseLocalName()

Returns the localname of the Elements of the sub-class.

Returns:String

the localname of the Elements of the sub-class.

getBaseNamespaceback to summary
public abstract String getBaseNamespace()

Returns the namespace of the Elements of the sub-class.

Returns:String

the namespace of the Elements of the sub-class.

getBaseURIback to summary
public String getBaseURI()

Method getBaseURI

Returns:String

the base uri of the namespace of this element

getBigIntegerFromChildElementback to summary
public BigInteger getBigIntegerFromChildElement(String localname, String namespace)

Method getVal

Returns:BigInteger

The biginteger contained in the given element

getBytesFromTextChildback to summary
public byte[] getBytesFromTextChild() throws XMLSecurityException

Method getBytesFromTextChild

Returns:byte[]

The base64 bytes from the text children of this element

getDefaultPrefixback to summary
public static String getDefaultPrefix(String namespace)

Method getDefaultPrefix

Returns:String

the default prefix bind to this element.

getDocumentback to summary
public Document getDocument()

Method getDocument

Returns:Document

the Document where this element is contained.

getElementback to summary
public final Element getElement()

Returns the Element which was constructed by the Object.

Returns:Element

the Element which was constructed by the Object.

getElementPlusReturnsback to summary
public final NodeList getElementPlusReturns()

Returns the Element plus a leading and a trailing CarriageReturn Text node.

Returns:NodeList

the Element which was constructed by the Object.

getFirstChildback to summary
protected Node getFirstChild()
getLocalAttributeback to summary
protected String getLocalAttribute(String attrName)
getTextFromChildElementback to summary
public String getTextFromChildElement(String localname, String namespace)

Method getTextFromChildElement

Returns:String

the Text of the textNode

getTextFromTextChildback to summary
public String getTextFromTextChild()

Method getTextFromTextChild

Returns:String

the Text obtained by concatenating all the text nodes of this element

guaranteeThatElementInCorrectSpaceback to summary
pack-priv void guaranteeThatElementInCorrectSpace() throws XMLSecurityException

Method guaranteeThatElementInCorrectSpace

lengthback to summary
public int length(String namespace, String localname)

Method length

Returns:int

the number of elements {namespace}:localname under this element

registerDefaultPrefixesback to summary
public static void registerDefaultPrefixes() throws XMLSecurityException

This method registers the default prefixes.

setDefaultPrefixback to summary
public static void setDefaultPrefix(String namespace, String prefix) throws XMLSecurityException

Method setDefaultPrefix

Exceptions
SecurityException:
if a security manager is installed and the caller does not have permission to set the default prefix
setDocumentback to summary
protected void setDocument(Document doc)

Set a new value for the wrapped document that this object is a proxy for.

Parameters
doc:Document

New document object being wrapped.

See Also
getDocument()
setElementback to summary
public void setElement(Element element, String baseURI) throws XMLSecurityException

Method setElement

setElementback to summary
protected void setElement(Element elem)

New value for the wrapped XML element that this object is a proxy for.

Parameters
elem:Element

New element

See Also
getElement()
setLocalAttributeback to summary
protected void setLocalAttribute(String attrName, String value)
setLocalIdAttributeback to summary
protected void setLocalIdAttribute(String attrName, String value)
setNamespacePrefixback to summary
private static void setNamespacePrefix(String namespace, String prefix) throws XMLSecurityException
setXPathNamespaceContextback to summary
public void setXPathNamespaceContext(String prefix, String uri) throws XMLSecurityException

Adds an xmlns: definition to the Element. This can be called as follows:

// set namespace with ds prefix
xpathContainer.setXPathNamespaceContext("ds", "http://www.w3.org/2000/09/xmldsig#");
xpathContainer.setXPathNamespaceContext("xmlns:ds", "http://www.w3.org/2000/09/xmldsig#");