当前位置: 首页>>代码示例>>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;未经允许,请勿转载。