Package org.apache.xml.security.utils
Class ElementProxy
java.lang.Object
org.apache.xml.security.utils.ElementProxy
- Direct Known Subclasses:
EncryptionElementProxy
,InclusiveNamespaces
,Signature11ElementProxy
,SignatureElementProxy
,XPath2FilterContainer
,XPath2FilterContainer04
,XPathFilterCHGPContainer
This is the base class to all Objects which have a direct 1:1 mapping to an
Element in a particular namespace.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor ElementProxyElementProxy
(Document doc) Constructor ElementProxyElementProxy
(Element element, String baseURI) Constructor ElementProxy -
Method Summary
Modifier and TypeMethodDescriptionvoid
addBase64Element
(byte[] bytes, String localname) Method addBase64Elementvoid
addBase64Text
(byte[] bytes) Method addBase64Textvoid
addBigIntegerElement
(BigInteger bi, String localname) Method addBigIntegerElementprotected void
void
Method addTextvoid
addTextElement
(String text, String localname) Method addTextElementprotected void
appendOther
(Element parent, Node toAppend) protected void
appendSelf
(ElementProxy toAppend) protected void
appendSelf
(Node toAppend) static Element
createElementForFamily
(Document doc, String namespace, String localName) This method creates an Element in a given namespace with a given localname.protected Element
createElementForFamilyLocal
(String namespace, String localName) protected Text
createText
(String text) abstract String
Returns the localname of the Elements of the sub-class.abstract String
Returns the namespace of the Elements of the sub-class.Method getBaseURIgetBigIntegerFromChildElement
(String localname, String namespace) Method getValbyte[]
Method getBytesFromTextChildstatic String
getDefaultPrefix
(String namespace) Method getDefaultPrefixMethod getDocumentfinal Element
Returns the Element which was constructed by the Object.final NodeList
Returns the Element plus a leading and a trailing CarriageReturn Text node.protected Node
protected String
getLocalAttribute
(String attrName) getTextFromChildElement
(String localname, String namespace) Method getTextFromChildElementMethod getTextFromTextChildint
Method lengthstatic void
This method registers the default prefixes.static void
setDefaultPrefix
(String namespace, String prefix) Method setDefaultPrefixprotected void
setDocument
(Document doc) Set a new value for the wrapped document that this object is a proxy for.protected void
setElement
(Element elem) New value for the wrapped XML element that this object is a proxy for.void
setElement
(Element element, String baseURI) Method setElementprotected void
setLocalAttribute
(String attrName, String value) protected void
setLocalIdAttribute
(String attrName, String value) void
setXPathNamespaceContext
(String prefix, String uri) Adds an xmlns: definition to the Element.
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG -
baseURI
Field baseURI
-
-
Constructor Details
-
ElementProxy
public ElementProxy()Constructor ElementProxy -
ElementProxy
Constructor ElementProxy- Parameters:
doc
-
-
ElementProxy
Constructor ElementProxy- Parameters:
element
-baseURI
-- Throws:
XMLSecurityException
-
-
Method Details
-
getBaseNamespace
Returns the namespace of the Elements of the sub-class.- Returns:
- the namespace of the Elements of the sub-class.
-
getBaseLocalName
Returns the localname of the Elements of the sub-class.- Returns:
- the localname of the Elements of the sub-class.
-
createElementForFamilyLocal
-
createElementForFamily
This method creates an Element in a given namespace with a given localname. It uses thegetDefaultPrefix(java.lang.String)
method to decide whether a particular prefix is bound to that namespace. This method was refactored out of the constructor.- Parameters:
doc
-namespace
-localName
-- Returns:
- The element created.
-
setElement
Method setElement- Parameters:
element
-baseURI
-- Throws:
XMLSecurityException
-
getElement
Returns the Element which was constructed by the Object.- Returns:
- the Element which was constructed by the Object.
-
getElementPlusReturns
Returns the Element plus a leading and a trailing CarriageReturn Text node.- Returns:
- the Element which was constructed by the Object.
-
createText
-
getDocument
Method getDocument- Returns:
- the Document where this element is contained.
-
getBaseURI
Method getBaseURI- Returns:
- the base uri of the namespace of this element
-
addBigIntegerElement
Method addBigIntegerElement- Parameters:
bi
-localname
-
-
addReturnToSelf
protected void addReturnToSelf() -
addBase64Element
Method addBase64Element- Parameters:
bytes
-localname
-
-
addTextElement
Method addTextElement- Parameters:
text
-localname
-
-
addBase64Text
public void addBase64Text(byte[] bytes) Method addBase64Text- Parameters:
bytes
-
-
appendSelf
-
appendSelf
-
appendOther
-
addText
Method addText- Parameters:
text
-
-
getBigIntegerFromChildElement
Method getVal- Parameters:
localname
-namespace
-- Returns:
- The biginteger contained in the given element
-
getTextFromChildElement
Method getTextFromChildElement- Parameters:
localname
-namespace
-- Returns:
- the Text of the textNode
-
getBytesFromTextChild
Method getBytesFromTextChild- Returns:
- The base64 bytes from the text children of this element
- Throws:
XMLSecurityException
-
getTextFromTextChild
Method getTextFromTextChild- Returns:
- the Text obtained by concatenating all the text nodes of this element
-
length
Method length- Parameters:
namespace
-localname
-- Returns:
- the number of elements {namespace}:localname under this element
-
setXPathNamespaceContext
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#");
- Parameters:
prefix
-uri
-- Throws:
XMLSecurityException
-
setDefaultPrefix
Method setDefaultPrefix- Parameters:
namespace
-prefix
-- Throws:
XMLSecurityException
SecurityException
- if a security manager is installed and the caller does not have permission to set the default prefix
-
registerDefaultPrefixes
This method registers the default prefixes.- Throws:
XMLSecurityException
-
getDefaultPrefix
Method getDefaultPrefix- Parameters:
namespace
-- Returns:
- the default prefix bind to this element.
-
setElement
New value for the wrapped XML element that this object is a proxy for.- Parameters:
elem
- New element- See Also:
-
setDocument
Set a new value for the wrapped document that this object is a proxy for.- Parameters:
doc
- New document object being wrapped.- See Also:
-
getLocalAttribute
-
setLocalAttribute
-
setLocalIdAttribute
-
getFirstChild
-