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 TypeMethodDescriptionvoidaddBase64Element(byte[] bytes, String localname) Method addBase64ElementvoidaddBase64Text(byte[] bytes) Method addBase64TextvoidaddBigIntegerElement(BigInteger bi, String localname) Method addBigIntegerElementprotected voidvoidMethod addTextvoidaddTextElement(String text, String localname) Method addTextElementprotected voidappendOther(Element parent, Node toAppend) protected voidappendSelf(ElementProxy toAppend) protected voidappendSelf(Node toAppend) static ElementcreateElementForFamily(Document doc, String namespace, String localName) This method creates an Element in a given namespace with a given localname.protected ElementcreateElementForFamilyLocal(String namespace, String localName) protected TextcreateText(String text) abstract StringReturns the localname of the Elements of the sub-class.abstract StringReturns the namespace of the Elements of the sub-class.Method getBaseURIgetBigIntegerFromChildElement(String localname, String namespace) Method getValbyte[]Method getBytesFromTextChildstatic StringgetDefaultPrefix(String namespace) Method getDefaultPrefixMethod getDocumentfinal ElementReturns the Element which was constructed by the Object.final NodeListReturns the Element plus a leading and a trailing CarriageReturn Text node.protected Nodeprotected StringgetLocalAttribute(String attrName) getTextFromChildElement(String localname, String namespace) Method getTextFromChildElementMethod getTextFromTextChild(package private) voidMethod guaranteeThatElementInCorrectSpaceintMethod lengthstatic voidThis method registers the default prefixes.static voidsetDefaultPrefix(String namespace, String prefix) Method setDefaultPrefixprotected voidsetDocument(Document doc) Set a new value for the wrapped document that this object is a proxy for.protected voidsetElement(Element elem) New value for the wrapped XML element that this object is a proxy for.voidsetElement(Element element, String baseURI) Method setElementprotected voidsetLocalAttribute(String attrName, String value) protected voidsetLocalIdAttribute(String attrName, String value) private static voidsetNamespacePrefix(String namespace, String prefix) voidsetXPathNamespaceContext(String prefix, String uri) Adds an xmlns: definition to the Element.
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG -
wrappedElement
What XML element does this ElementProxy instance wrap? -
baseURI
Field baseURI -
wrappedDoc
Field doc -
prefixMappings
-
-
Constructor Details
-
ElementProxy
public ElementProxy()Constructor ElementProxy -
ElementProxy
-
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(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
-
guaranteeThatElementInCorrectSpace
Method guaranteeThatElementInCorrectSpace- Throws:
XMLSecurityException
-
addBigIntegerElement
Method addBigIntegerElement- Parameters:
bi-localname-
-
addReturnToSelf
protected void addReturnToSelf() -
addBase64Element
Method addBase64Element- Parameters:
bytes-localname-
-
addTextElement
-
addBase64Text
public void addBase64Text(byte[] bytes) Method addBase64Text- Parameters:
bytes-
-
appendSelf
-
appendSelf
-
appendOther
-
addText
-
getBigIntegerFromChildElement
Method getVal- Parameters:
localname-namespace-- Returns:
- The biginteger contained in the given element
-
getTextFromChildElement
-
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
-
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:
XMLSecurityExceptionSecurityException- if a security manager is installed and the caller does not have permission to set the default prefix
-
setNamespacePrefix
- Throws:
XMLSecurityException
-
registerDefaultPrefixes
This method registers the default prefixes.- Throws:
XMLSecurityException
-
getDefaultPrefix
-
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
-