當前位置: 首頁>>代碼示例>>Java>>正文


Java Document.replaceChild方法代碼示例

本文整理匯總了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;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:14,代碼來源:SignatureMarshaller.java

示例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);
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:16,代碼來源:AbstractXMLObjectMarshaller.java

示例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();
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:43,代碼來源:SourcePickerHelper.java

示例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();        
}
 
開發者ID:convertigo,項目名稱:convertigo-engine,代碼行數:44,代碼來源:SourcePickerHelperWrap.java


注:本文中的org.w3c.dom.Document.replaceChild方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。