本文整理匯總了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();
}