本文整理了Java中org.dom4j.dom.DOMDocument.<init>()
方法的一些代码示例,展示了DOMDocument.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DOMDocument.<init>()
方法的具体详情如下:
包路径:org.dom4j.dom.DOMDocument
类名称:DOMDocument
方法名:<init>
暂无
代码示例来源:origin: gocd/gocd
public Document toXml(XmlWriterContext writerContext) {
DOMElement root = new DOMElement("scheduledJobs");
for (WaitingJobPlan jobPlan : jobPlans) {
DOMElement jobElement = getXmlForJobPlan(writerContext, jobPlan);
root.add(jobElement);
}
DOMDocument domDocument = new DOMDocument(root);
return domDocument;
}
代码示例来源:origin: stackoverflow.com
// In php
$dd = new DOMDocument();
// file_get_contents will simply convert the entire web address into a String
$dd->loadXML( file_get_contents( "http://" . $_GET[ 'loadedURL' ] ) );
$scripts = $dd->getElementsByTagName( "script" );
// iterate through the website and remove all script tags.
for( $i = 0; $i < $scripts->length; $i++ )
{
$current = $scripts->item( $i );
$current->parentNode->removeChild( $current );
}
// output it to the dummy page.
echo $dd->saveXML();
代码示例来源:origin: org.dom4j/dom4j
public Document createDocument() {
DOMDocument answer = new DOMDocument();
answer.setDocumentFactory(this);
return answer;
}
代码示例来源:origin: gocd/gocd
public Document toXml(XmlWriterContext writerContext) {
DOMElement root = new DOMElement("stage");
root.addAttribute("name", stage.getName()).addAttribute("counter", String.valueOf(stage.getCounter()));
Document document = new DOMDocument(root);
root.addElement("link").addAttribute("rel", "self").addAttribute("href", httpUrl(writerContext.getBaseUrl()));
StageIdentifier stageId = stage.getIdentifier();
root.addElement("id").addCDATA(stageId.asURN());
String pipelineName = stageId.getPipelineName();
root.addElement("pipeline").addAttribute("name", pipelineName)
.addAttribute("counter", String.valueOf(stageId.getPipelineCounter()))
.addAttribute("label", stageId.getPipelineLabel())
.addAttribute("href", writerContext.getBaseUrl() + "/api/pipelines/" + pipelineName + "/" + stage.getPipelineId() + ".xml");
root.addElement("updated").addText(DateUtils.formatISO8601(stage.latestTransitionDate()));
root.addElement("result").addText(stage.getResult().toString());
root.addElement("state").addText(stage.status());
root.addElement("approvedBy").addCDATA(stage.getApprovedBy());
Element jobs = root.addElement("jobs");
for (JobInstance jobInstance : stage.getJobInstances()) {
jobs.addElement("job").addAttribute("href", writerContext.getBaseUrl() + "/api/jobs/" + jobInstance.getId() + ".xml");
}
return document;
}
代码示例来源:origin: org.dom4j/dom4j
public org.w3c.dom.Document createDocument(String namespaceURI,
String qualifiedName, org.w3c.dom.DocumentType docType)
throws org.w3c.dom.DOMException {
DOMDocument document;
if (docType != null) {
DOMDocumentType documentType = asDocumentType(docType);
document = new DOMDocument(documentType);
} else {
document = new DOMDocument();
}
document.addElement(createQName(qualifiedName, namespaceURI));
return document;
}
代码示例来源:origin: gocd/gocd
public Document toXml(XmlWriterContext writerContext) {
DOMElement root = new DOMElement("pipeline");
root.addAttribute("name", pipeline.getName()).addAttribute("counter", String.valueOf(pipeline.getCounter())).addAttribute("label", pipeline.getLabel());
Document document = new DOMDocument(root);
String baseUrl = writerContext.getBaseUrl();
root.addElement("link").addAttribute("rel", "self").addAttribute("href", httpUrl(baseUrl));
root.addElement("id").addCDATA(pipeline.getPipelineIdentifier().asURN());
PipelineTimelineEntry pipelineAfter = pipeline.getPipelineAfter();
if (pipelineAfter != null) {
addTimelineLink(root, baseUrl, "insertedBefore", pipelineAfter);
}
PipelineTimelineEntry pipelineBefore = pipeline.getPipelineBefore();
if (pipelineBefore != null) {
addTimelineLink(root, baseUrl, "insertedAfter", pipelineBefore);
}
root.addElement("scheduleTime").addText(DateUtils.formatISO8601(pipeline.getScheduledDate()));
Element materials = root.addElement("materials");
for (MaterialRevision materialRevision : pipeline.getCurrentRevisions()) {
populateXml(materials, materialRevision, writerContext);
}
Element stages = root.addElement("stages");
for (StageInstanceModel stage : pipeline.getStageHistory()) {
if (! (stage instanceof NullStageHistoryItem)) {
stages.addElement("stage").addAttribute("href", StageXmlViewModel.httpUrlFor(writerContext.getBaseUrl(), stage.getId()));
}
}
root.addElement("approvedBy").addCDATA(pipeline.getApprovedBy());
return document;
}
代码示例来源:origin: org.dom4j/dom4j
/**
* Marshals the given {@link javax.xml.bind.Element}in to its DOM4J
* counterpart.
*
* @param element
* JAXB Element to be marshalled
*
* @return the marshalled DOM4J {@link org.dom4j.Element}
*
* @throws JAXBException
* when an error occurs
*/
protected org.dom4j.Element marshal(javax.xml.bind.Element element)
throws JAXBException {
DOMDocument doc = new DOMDocument();
getMarshaller().marshal(element, doc);
return doc.getRootElement();
}
代码示例来源:origin: gocd/gocd
public Document toXml(XmlWriterContext writerContext) {
DOMElement root = new DOMElement("job");
root.addAttribute("name", jobInstance.getName());
Document document = new DOMDocument(root);
root.addElement("link").addAttribute("rel", "self").addAttribute("href", httpUrl(writerContext.getBaseUrl()));
代码示例来源:origin: stackoverflow.com
$dom = new DOMDocument();
$dom->loadHTML($string);
$bodyChildNodes = $dom->documentElement->firstChild->childNodes;
$string = '';
foreach ($bodyChildNodes as $node){
$string .= $dom->saveHTML($node);
}
代码示例来源:origin: stackoverflow.com
<?php
$dom = new DOMDocument();
$dom->validateOnParse = true;
$dom->loadHTML(file_get_contents("march.html"));
$name = $dom->getElementById("name")->nodeValue;
print $name;
?>
代码示例来源:origin: stackoverflow.com
$sourcedoc = new DOMDocument();
$sourcedoc->load('test.xml');
$stylesheet = new DOMDocument();
$stylesheet->load('test.xsl');
// create a new XSLT processor and load the stylesheet
$xsltprocessor = new XSLTProcessor();
$xsltprocessor->importStylesheet($stylesheet);
// save the new xml file
file_put_contents('test-translated.xml', $xsltprocessor->transformToXML($sourcedoc));
代码示例来源:origin: stackoverflow.com
$html = new DOMDocument();
@$html->loadHtmlFile('https://qc.yahoo.com/');
$xpath = new DOMXPath( $html );
$nodelist = $xpath->query( "//div[@id='news_moreTopStories']//a/@href" );
foreach ($nodelist as $n){
echo $n->nodeValue."\n";
}
代码示例来源:origin: dom4j/dom4j
public Document createDocument() {
DOMDocument answer = new DOMDocument();
answer.setDocumentFactory(this);
return answer;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j
public Document createDocument() {
DOMDocument answer = new DOMDocument();
answer.setDocumentFactory(this);
return answer;
}
代码示例来源:origin: maven/dom4j
public Document createDocument() {
DOMDocument answer = new DOMDocument();
answer.setDocumentFactory(this);
return answer;
}
代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand
public Document createDocument() {
DOMDocument answer = new DOMDocument();
answer.setDocumentFactory(this);
return answer;
}
代码示例来源:origin: org.dom4j/com.springsource.org.dom4j
public Document createDocument() {
DOMDocument answer = new DOMDocument();
answer.setDocumentFactory(this);
return answer;
}
代码示例来源:origin: org.dom4j/org.motechproject.org.dom4j
public Document createDocument() {
DOMDocument answer = new DOMDocument();
answer.setDocumentFactory(this);
return answer;
}
代码示例来源:origin: skyscreamer/yoga
public static void write( Element rootElement, OutputStream outputStream ) throws IOException
{
DOMDocument domDocument = new DOMDocument();
domDocument.setRootElement( rootElement );
OutputStreamWriter out = new OutputStreamWriter( outputStream );
domDocument.write( out );
out.flush();
out.close();
}
}
代码示例来源:origin: dom4j/dom4j
public org.w3c.dom.Document createDocument(String namespaceURI,
String qualifiedName, org.w3c.dom.DocumentType docType)
throws org.w3c.dom.DOMException {
DOMDocument document;
if (docType != null) {
DOMDocumentType documentType = asDocumentType(docType);
document = new DOMDocument(documentType);
} else {
document = new DOMDocument();
}
document.addElement(createQName(qualifiedName, namespaceURI));
return document;
}
内容来源于网络,如有侵权,请联系作者删除!