use of org.w3c.dom.Text in project jdk8u_jdk by JetBrains.
the class Base64 method decode.
/**
* Method decode
*
* Takes the <CODE>Text</CODE> children of the Element and interprets
* them as input for the <CODE>Base64.decode()</CODE> function.
*
* @param element
* @return the byte obtained of the decoding the element
* $todo$ not tested yet
* @throws Base64DecodingException
*/
public static final byte[] decode(Element element) throws Base64DecodingException {
Node sibling = element.getFirstChild();
StringBuffer sb = new StringBuffer();
while (sibling != null) {
if (sibling.getNodeType() == Node.TEXT_NODE) {
Text t = (Text) sibling;
sb.append(t.getData());
}
sibling = sibling.getNextSibling();
}
return decode(sb.toString());
}
use of org.w3c.dom.Text in project jdk8u_jdk by JetBrains.
the class ElementProxy method addTextElement.
/**
* Method addTextElement
*
* @param text
* @param localname
*/
public void addTextElement(String text, String localname) {
Element e = XMLUtils.createElementInSignatureSpace(this.doc, localname);
Text t = this.doc.createTextNode(text);
e.appendChild(t);
this.constructionElement.appendChild(e);
XMLUtils.addReturnToElement(this.constructionElement);
}
use of org.w3c.dom.Text in project jdk8u_jdk by JetBrains.
the class IntegrityHmac method engineAddContextToElement.
/**
* Method engineAddContextToElement
*
* @param element
*/
public void engineAddContextToElement(Element element) {
if (element == null) {
throw new IllegalArgumentException("null element");
}
if (this.HMACOutputLengthSet) {
Document doc = element.getOwnerDocument();
Element HMElem = XMLUtils.createElementInSignatureSpace(doc, Constants._TAG_HMACOUTPUTLENGTH);
Text HMText = doc.createTextNode(Integer.valueOf(this.HMACOutputLength).toString());
HMElem.appendChild(HMText);
XMLUtils.addReturnToElement(element);
element.appendChild(HMElem);
XMLUtils.addReturnToElement(element);
}
}
use of org.w3c.dom.Text in project webservices-axiom by apache.
the class TestAdoptNodeToSameDocument method runTest.
protected void runTest() throws Throwable {
DocumentBuilder builder = dbf.newDocumentBuilder();
Document document = builder.newDocument();
Element parent = document.createElementNS(null, "test");
Text node = document.createTextNode("test");
parent.appendChild(node);
assertSame(node, document.adoptNode(node));
assertSame(document, node.getOwnerDocument());
assertNull(node.getParentNode());
assertNull(parent.getFirstChild());
}
use of org.w3c.dom.Text in project webservices-axiom by apache.
the class TestAdoptNode method runTest.
protected void runTest() throws Throwable {
DocumentBuilder builder = dbf.newDocumentBuilder();
Document document1 = builder.newDocument();
Document document2 = builder.newDocument();
Element element = document1.createElementNS(null, "test");
Text child = document1.createTextNode("test");
element.appendChild(child);
assertSame(element, document2.adoptNode(element));
assertSame(document2, element.getOwnerDocument());
assertSame(child, element.getFirstChild());
assertSame(document2, element.getFirstChild().getOwnerDocument());
}
Aggregations