本文整理汇总了Java中org.w3c.dom.Document.replaceChild方法的典型用法代码示例。如果您正苦于以下问题:Java Document.replaceChild方法的具体用法?Java Document.replaceChild怎么用?Java Document.replaceChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.w3c.dom.Document
的用法示例。
在下文中一共展示了Document.replaceChild方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: marshall
import org.w3c.dom.Document; //导入方法依赖的package包/类
/** {@inheritDoc} */
public Element marshall(XMLObject xmlObject, Document document) throws MarshallingException {
Element signatureElement = createSignatureElement((SignatureImpl) xmlObject, document);
Element documentRoot = document.getDocumentElement();
if (documentRoot != null) {
document.replaceChild(signatureElement, documentRoot);
} else {
document.appendChild(signatureElement);
}
return signatureElement;
}
示例2: setDocumentElement
import org.w3c.dom.Document; //导入方法依赖的package包/类
/**
* Sets the given element as the Document Element of the given Document. If the document already has a Document
* Element it is replaced by the given element.
*
* @param document the document
* @param element the Element that will serve as the Document Element
*/
protected void setDocumentElement(Document document, Element element) {
Element documentRoot = document.getDocumentElement();
if (documentRoot != null) {
document.replaceChild(element, documentRoot);
} else {
document.appendChild(element);
}
}
示例3: displayTargetWsdlDom
import org.w3c.dom.Document; //导入方法依赖的package包/类
public void displayTargetWsdlDom(DatabaseObject dbo) {
try {
if (dbo instanceof Step) {
Step step = (Step)dbo;
String xpath = getSourceXPath();
String anchor = step.getAnchor();
Document stepDoc = null;
Step targetStep = step;
while (targetStep instanceof IteratorStep) {
targetStep = getTargetStep(targetStep);
}
if (targetStep != null) {
Project project = step.getProject();
XmlSchema schema = Engine.theApp.schemaManager.getSchemaForProject(project.getName(), Option.fullSchema);
XmlSchemaObject xso = SchemaMeta.getXmlSchemaObject(schema, targetStep);
if (xso != null) {
stepDoc = XmlSchemaUtils.getDomInstance(xso);
}
}
if (stepDoc != null/* && !(targetStep instanceof IteratorStep)*/) { // stepDoc can be null for non "xml" step : e.g jIf
Document doc = step.getSequence().createDOM();
Element root = (Element)doc.importNode(stepDoc.getDocumentElement(), true);
doc.replaceChild(root, doc.getDocumentElement());
removeUserDefinedNodes(doc.getDocumentElement());
boolean shouldDisplayDom = (!(!step.isXml() && (step instanceof StepWithExpressions) && !(step instanceof IteratorStep)));
if ((doc != null) && (shouldDisplayDom)) {
xpath = onDisplayXhtml(xpath);
displayXhtml(doc);
xpathEvaluator.removeAnchor();
xpathEvaluator.displaySelectionXpathWithAnchor(twsDomTree, anchor, xpath);
return;
}
}
}
} catch (Exception e) {
ConvertigoPlugin.logException(e, StringUtils.readStackTraceCauses(e));
}
clean();
}
示例4: displayTargetWsdlDom
import org.w3c.dom.Document; //导入方法依赖的package包/类
public void displayTargetWsdlDom(DatabaseObject dbo) {
try {
if (dbo instanceof Step) {
Step step = (Step) dbo;
String xpath = getSourceXPath();
String anchor = step.getAnchor();
Document stepDoc = null;
Step targetStep = step;
while (targetStep instanceof IteratorStep) {
targetStep = getTargetStep(targetStep);
}
if (targetStep != null) {
Project project = step.getProject();
XmlSchema schema = Engine.theApp.schemaManager.getSchemaForProject(project.getName(), Option.fullSchema);
XmlSchemaObject xso = SchemaMeta.getXmlSchemaObject(schema, targetStep);
if (xso != null) {
stepDoc = XmlSchemaUtils.getDomInstance(xso);
}
}
if (stepDoc != null/* && !(targetStep instanceof IteratorStep)*/) { // stepDoc can be null for non "xml" step : e.g jIf
Document doc = step.getSequence().createDOM();
Element root = (Element) doc.importNode(stepDoc.getDocumentElement(), true);
doc.replaceChild(root, doc.getDocumentElement());
removeUserDefinedNodes(doc.getDocumentElement());
boolean shouldDisplayDom = (!(!step.isXml() && (step instanceof StepWithExpressions) && !(step instanceof IteratorStep)));
if ((doc != null) && (shouldDisplayDom)) {
xpath = onDisplayXhtml(xpath);
displayXhtml(doc);
xpathEvaluator.removeAnchor();
xpathEvaluator.displaySelectionXpathWithAnchor(twsDomTree, anchor, xpath);
return;
}
}
}
}
catch (Exception e) {
//ConvertigoPlugin.logException(e, StringUtils.readStackTraceCauses(e));
}
clean();
}