Class ElementProxy
java.lang.Object
org.apache.xml.security.utils.ElementProxy
- Direct Known Subclasses:
Algorithm, EncryptionElementProxy, InclusiveNamespaces, 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.
- Author:
- $Author$
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringField _baseURIprotected ElementField _constructionElementprotected DocumentField _docprotected intstatic final intThe element has been created by the codestatic final intThe element is going to be decryptedstatic final intThe element is going to be encryptedstatic final intThe element has been readed from a DOM tree by the codestatic final intThe element is going to be signedstatic final intThe element isn't known if it is readen or createdstatic final intThe element is going to be verified -
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 setValvoidMethod addTextvoidaddTextElement(String text, String localname) Method addTextElementstatic ElementcreateElementForFamily(Document doc, String namespace, String localName) This method creates an Element in a given namespace with a given localname.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[]getBytesFromChildElement(String localname, String namespace) Method getBytesFromChildElementbyte[]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.getTextFromChildElement(String localname, String namespace) Method getTextFromChildElementMethod getTextFromTextChildvoidMethod guaranteeThatElementInCorrectSpaceintMethod lengthstatic voidsetDefaultPrefix(String namespace, String prefix) Method setDefaultPrefixvoidsetElement(Element element, String BaseURI) Method setElementvoidsetXPathNamespaceContext(String prefix, String uri) Adds an xmlns: definition to the Element.
-
Field Details
-
MODE_CREATE
public static final int MODE_CREATEThe element has been created by the code- See Also:
-
MODE_PROCESS
public static final int MODE_PROCESSThe element has been readed from a DOM tree by the code- See Also:
-
MODE_UNKNOWN
public static final int MODE_UNKNOWNThe element isn't known if it is readen or created- See Also:
-
MODE_SIGN
public static final int MODE_SIGNThe element is going to be signed- See Also:
-
MODE_VERIFY
public static final int MODE_VERIFYThe element is going to be verified- See Also:
-
MODE_ENCRYPT
public static final int MODE_ENCRYPTThe element is going to be encrypted- See Also:
-
MODE_DECRYPT
public static final int MODE_DECRYPTThe element is going to be decrypted- See Also:
-
_state
protected int _state -
_constructionElement
Field _constructionElement -
_baseURI
Field _baseURI -
_doc
Field _doc
-
-
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.
-
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.
-
getDocument
Method getDocument- Returns:
- the Document where this element is contained.
-
getBaseURI
-
guaranteeThatElementInCorrectSpace
Method guaranteeThatElementInCorrectSpace- Throws:
XMLSecurityException
-
addBigIntegerElement
Method setVal- Parameters:
bi-localname-
-
addBase64Element
Method addBase64Element- Parameters:
bytes-localname-
-
addTextElement
-
addBase64Text
public void addBase64Text(byte[] bytes) Method addBase64Text- Parameters:
bytes-
-
addText
-
getBigIntegerFromChildElement
public BigInteger getBigIntegerFromChildElement(String localname, String namespace) throws Base64DecodingException Method getVal- Parameters:
localname-namespace-- Returns:
- The biginter contained in the given element
- Throws:
Base64DecodingException
-
getBytesFromChildElement
public byte[] getBytesFromChildElement(String localname, String namespace) throws XMLSecurityException Method getBytesFromChildElement- Parameters:
localname-namespace-- Returns:
- the bytes
- Throws:
XMLSecurityException
-
getTextFromChildElement
-
getBytesFromTextChild
Method getBytesFromTextChild- Returns:
- The base64 bytes from the first text child of this element
- Throws:
XMLSecurityException
-
getTextFromTextChild
Method getTextFromTextChild- Returns:
- the Text obtained concatening all the 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:
XMLSecurityException
-
getDefaultPrefix
-