本文整理了Java中org.w3c.dom.Element.setNodeValue()
方法的一些代码示例,展示了Element.setNodeValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.setNodeValue()
方法的具体详情如下:
包路径:org.w3c.dom.Element
类名称:Element
方法名:setNodeValue
暂无
代码示例来源:origin: xyz.cofe/common
@Override
public void setNodeValue(String nodeValue) throws DOMException {
element.setNodeValue(nodeValue);
}
代码示例来源:origin: stackoverflow.com
// Creating a DOMSource Object for the request
DocumentBuilder db = DocumentBuilderFactory.newDocumentBuilder();
Document requestDoc = db.newDocument();
Element root = requestDoc.createElementNS("http://org.apache.cxf/stockExample", "getStockPrice");
root.setNodeValue("DOW");
DOMSource request = new DOMSource(requestDoc);
代码示例来源:origin: org.apache.tuscany.sca/tuscany-implementation-bpel-runtime
public TuscanyEPR(QName processName, Endpoint endpoint) {
Element serviceref = doc.createElementNS(EndpointReference.SERVICE_REF_QNAME.getNamespaceURI(),
EndpointReference.SERVICE_REF_QNAME.getLocalPart());
serviceref.setNodeValue(endpoint.serviceName + ":" + endpoint.portName);
doc.appendChild(serviceref);
}
代码示例来源:origin: apache/ofbiz-framework
public Element createElementSetValue(String elementName, String value) {
Element element = this.responseDocument.createElementNS(DAV_NAMESPACE_URI, elementName);
element.appendChild(element.getOwnerDocument().createTextNode(value));
element.setNodeValue(value);
return element;
}
代码示例来源:origin: stackoverflow.com
final Document docToSave = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
final Element fileInfo = docToSave.createElement("fileInfo");
docToSave.appendChild(fileInfo);
final Element fileName = docToSave.createElement("fileName");
fileName.setNodeValue("filename.bin");
fileInfo.appendChild(fileName);
return docToSave;
代码示例来源:origin: stackoverflow.com
DocumentBuilderFactory df = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = df.newDocumentBuilder();
Document doc = documentBuilder.newDocument();
Element root = doc.createElement("RootElement");
doc.appendChild(root);
Element child = doc.createElement("ChildElement");
child.setNodeValue("Hello World");
root.appendChild(child);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
StreamResult resultStream = new StreamResult(response.getOutputStream());
transformer.transform(new DOMSource(doc), resultStream);
代码示例来源:origin: org.opensingular/singular-commons
/**
* @see org.w3c.dom.Node#setNodeValue(String)
*/
public void setNodeValue(String arg0) throws DOMException {
getCurrentInternal().setNodeValue(arg0);
}
代码示例来源:origin: org.opensingular/form-core
/**
* @see org.w3c.dom.Node#setNodeValue(String)
*/
@Override
public void setNodeValue(String arg0) {
original.get().setNodeValue(arg0);
}
代码示例来源:origin: org.wso2.bpel/ode-bpel-test
public EndpointReference activateMyRoleEndpoint(QName processId, Endpoint myRoleEndpoint) {
final Document doc = DOMUtils.newDocument();
Element serviceref = doc.createElementNS(EndpointReference.SERVICE_REF_QNAME.getNamespaceURI(),
EndpointReference.SERVICE_REF_QNAME.getLocalPart());
serviceref.setNodeValue(myRoleEndpoint.serviceName +":" +myRoleEndpoint.portName);
doc.appendChild(serviceref);
return new EndpointReference() {
public Document toXML() {
return doc;
}
};
}
代码示例来源:origin: stackoverflow.com
DocumentBuilderFactory df = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = df.newDocumentBuilder();
Document doc = documentBuilder.newDocument();
Element root = doc.createElement("RootElement");
doc.appendChild(root);
Element child = doc.createElement("ChildElement");
child.setNodeValue("Hello World");
root.appendChild(child);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
File f = new File("c:\\temp\\dummy.xml");
StreamResult resultStream = new StreamResult(f);
transformer.transform(new DOMSource(doc), resultStream);
代码示例来源:origin: org.opensingular/singular-commons
/**
* @see org.w3c.dom.Node#setNodeValue(String)
*/
@Override
public void setNodeValue(String arg0) {
original.get().setNodeValue(arg0);
}
代码示例来源:origin: org.opensingular/form-core
/**
* @see org.w3c.dom.Node#setNodeValue(String)
*/
public void setNodeValue(String arg0) throws DOMException {
getAtualInterno().setNodeValue(arg0);
}
代码示例来源:origin: Geomatys/geotoolkit
@Override
public void setNodeValue(String nodeValue) throws DOMException {
final Element elem = getElement();
if (elem != null) elem.setNodeValue(nodeValue);
}
代码示例来源:origin: org.sbml.jsbml/jsbml-core
/**
*
* @param name
* @param definitionURI
* @return
*/
private Element createCSymbol(String name, String definitionURI) {
lastElementCreated = document.createElement("csymbol");
lastElementCreated.setAttribute("encoding", "text");
lastElementCreated.setAttribute("definitionURL", definitionURI);
lastElementCreated.setNodeValue(writeName(name));
//lastElementCreated.setTextContent(writeName(name));
return lastElementCreated;
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.server.tomcat.core
public void updateElementValue(String s) {
try {
xmlElement.setNodeValue(s);
} catch (DOMException ex) {
NodeList nodelist = xmlElement.getChildNodes();
int i = nodelist == null ? 0 : nodelist.getLength();
if (i > 0) {
for (int j = 0; j < i; j++)
if (nodelist.item(j) instanceof Text) {
((Text) nodelist.item(j)).setData(s);
return;
}
} else {
xmlElement.appendChild(factory.document.createTextNode(s));
}
}
}
代码示例来源:origin: org.sbml.jsbml/jsbml-core
/**
*
* @param name
* @return
*/
private ASTNodeValue createCiElement(String name) {
lastElementCreated = document.createElement("ci");
lastElementCreated.setNodeValue(writeName(name.trim()));
//lastElementCreated.setTextContent(writeName(name.trim()));
return new ASTNodeValue(lastElementCreated, this);
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.server.tomcat.core
protected static void setElementValue(Element element, String value) {
String s = element.getNodeValue();
if (s != null) {
element.setNodeValue(value);
return;
}
NodeList nodelist = element.getChildNodes();
for (int i = 0; i < nodelist.getLength(); i++)
if (nodelist.item(i) instanceof Text) {
Text text = (Text) nodelist.item(i);
text.setData(value);
return;
}
return;
}
代码示例来源:origin: org.codehaus.xfire/xfire-core
private org.w3c.dom.Element createElement(String value){
org.w3c.dom.Element elem = w3cDocument.createElementNS(WSDL11_NS, "documentation");
String prefix = getNamespacePrefix(WSDL11_NS);
elem.setPrefix(prefix);
elem.setNodeValue(value);
return elem;
}
代码示例来源:origin: org.apache.ws.commons.axiom/dom-testsuite
/**
* Runs the test case.
* @throws Throwable Any uncaught exception causes test to fail
*/
public void runTest() throws Throwable {
Document doc;
Element newNode;
String newValue;
doc = (Document) load("hc_staff", true);
newNode = doc.createElement("acronym");
newValue = newNode.getNodeValue();
assertNull("initiallyNull", newValue);
newNode.setNodeValue("This should have no effect");
newValue = newNode.getNodeValue();
assertNull("nullAfterAttemptedChange", newValue);
}
/**
代码示例来源:origin: org.apache.ws.commons.axiom/dom-testsuite
/**
* Runs the test case.
* @throws Throwable Any uncaught exception causes test to fail
*/
public void runTest() throws Throwable {
Document doc;
Element newNode;
String newValue;
doc = (Document) load("staff", true);
newNode = doc.createElement("address");
newValue = newNode.getNodeValue();
assertNull("initiallyNull", newValue);
newNode.setNodeValue("This should have no effect");
newValue = newNode.getNodeValue();
assertNull("nullAfterAttemptedChange", newValue);
}
/**
内容来源于网络,如有侵权,请联系作者删除!