de.pdark.decentxml.Document.toXML()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中de.pdark.decentxml.Document.toXML()方法的一些代码示例,展示了Document.toXML()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Document.toXML()方法的具体详情如下:
包路径:de.pdark.decentxml.Document
类名称:Document
方法名:toXML

Document.toXML介绍

暂无

代码示例

代码示例来源:origin: io.provis/provisio-jenkins

public String finish() {
 return base.toXML();
}

代码示例来源:origin: io.provis/provisio-jenkins

public void finish(Writer w) throws IOException {
 base.toXML(new XMLWriter(w));
 w.flush();
}

代码示例来源:origin: io.fabric8.updatebot/updatebot-core

/**
 * Saves the pom.xml if its been changed
 *
 * @return true if the pom was modified
 * @throws IOException
 */
public boolean saveIfChanged() throws IOException {
  if (updated) {
    LOG.info("Updating " + pom);
    try {
      IOHelpers.writeFully(pom, doc.toXML());
    } catch (Exception e) {
      throw new IOException("failed to save " + pom + ". " + e, e);
    }
  }
  return updated;
}

代码示例来源:origin: io.fabric8.forge/camel-tooling-util

public void writeXml(Document doc, File file) throws IOException {
  File parentDir = file.getParentFile();
  if (parentDir != null) {
    parentDir.mkdirs();
  }
  XMLWriter writer = new XMLWriter(new FileWriter(file));
  doc.toXML(writer);
  writer.close();
}

代码示例来源:origin: jboss-fuse/fabric8

public void writeXml(Document doc, File file) throws IOException {
  File parentDir = file.getParentFile();
  if (parentDir != null) {
    parentDir.mkdirs();
  }
  XMLWriter writer = new XMLWriter(new FileWriter(file));
  doc.toXML(writer);
  writer.close();
}

代码示例来源:origin: io.jenkins.updatebot/updatebot-core

/**
 * Saves the pom.xml if its been changed
 *
 * @return true if the pom was modified
 * @throws IOException
 */
public boolean saveIfChanged() throws IOException {
  if (updated) {
    LOG.info("Updating " + pom);
    try {
      IOHelpers.writeFully(pom, doc.toXML());
    } catch (Exception e) {
      throw new IOException("failed to save " + pom + ". " + e, e);
    }
  }
  return updated;
}

代码示例来源:origin: org.eclipse.tycho/tycho-p2-facade

public static void write(TargetDefinitionFile target, File file) throws IOException {
  OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
  Document document = target.document;
  try {
    String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8";
    Writer w = new OutputStreamWriter(os, enc);
    XMLWriter xw = new XMLWriter(w);
    try {
      document.toXML(xw);
    } finally {
      xw.flush();
    }
  } finally {
    IOUtil.close(os);
  }
}

代码示例来源:origin: org.eclipse.tycho/tycho-metadata-model

public static void write(ProductConfiguration product, File file) throws IOException {
  OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
  Document document = product.document;
  try {
    String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8";
    Writer w = new OutputStreamWriter(os, enc);
    XMLWriter xw = new XMLWriter(w);
    try {
      document.toXML(xw);
    } finally {
      xw.flush();
    }
  } finally {
    IOUtil.close(os);
  }
}

代码示例来源:origin: io.teecube.tic/tic-bw6

public static void write(TargetDefinitionFile target, File file) throws IOException {
  OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
  Document document = target.document;
  try {
    String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8";
    Writer w = new OutputStreamWriter(os, enc);
    XMLWriter xw = new XMLWriter(w);
    try {
      document.toXML(xw);
    } finally {
      xw.flush();
    }
  } finally {
    IOUtil.close(os);
  }
}

代码示例来源:origin: org.eclipse.tycho/tycho-metadata-model

public static void write(Category category, File file) throws IOException {
  OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
  Document document = category.document;
  try {
    String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8";
    Writer w = new OutputStreamWriter(os, enc);
    XMLWriter xw = new XMLWriter(w);
    try {
      document.toXML(xw);
    } finally {
      xw.flush();
    }
  } finally {
    IOUtil.close(os);
  }
}

代码示例来源:origin: org.eclipse.tycho/tycho-metadata-model

public static void write(UpdateSite site, File file) throws IOException {
  OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
  Document document = site.document;
  try {
    String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8";
    Writer w = new OutputStreamWriter(os, enc);
    XMLWriter xw = new XMLWriter(w);
    try {
      document.toXML(xw);
    } finally {
      xw.flush();
    }
  } finally {
    IOUtil.close(os);
  }
}

代码示例来源:origin: eclipse/tycho

public static void write(Category category, File file) throws IOException {
  OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
  Document document = category.document;
  try {
    String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8";
    Writer w = new OutputStreamWriter(os, enc);
    XMLWriter xw = new XMLWriter(w);
    try {
      document.toXML(xw);
    } finally {
      xw.flush();
    }
  } finally {
    IOUtil.close(os);
  }
}

代码示例来源:origin: eclipse/tycho

public static void write(ProductConfiguration product, File file) throws IOException {
  OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
  Document document = product.document;
  try {
    String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8";
    Writer w = new OutputStreamWriter(os, enc);
    XMLWriter xw = new XMLWriter(w);
    try {
      document.toXML(xw);
    } finally {
      xw.flush();
    }
  } finally {
    IOUtil.close(os);
  }
}

代码示例来源:origin: eclipse/tycho

public static void write(UpdateSite site, File file) throws IOException {
  OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
  Document document = site.document;
  try {
    String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8";
    Writer w = new OutputStreamWriter(os, enc);
    XMLWriter xw = new XMLWriter(w);
    try {
      document.toXML(xw);
    } finally {
      xw.flush();
    }
  } finally {
    IOUtil.close(os);
  }
}

代码示例来源:origin: org.eclipse.tycho/tycho-metadata-model

public static void write(Feature feature, File file, String indent) throws IOException {
  OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
  Document document = feature.document;
  try {
    String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8";
    Writer w = new OutputStreamWriter(os, enc);
    XMLWriter xw = new XMLWriter(w);
    xw.setIndent(indent);
    try {
      document.toXML(xw);
    } finally {
      xw.flush();
    }
  } finally {
    IOUtil.close(os);
  }
}

代码示例来源:origin: eclipse/tycho

public static void write(Feature feature, File file, String indent) throws IOException {
  OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
  Document document = feature.document;
  try {
    String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8";
    Writer w = new OutputStreamWriter(os, enc);
    XMLWriter xw = new XMLWriter(w);
    xw.setIndent(indent);
    try {
      document.toXML(xw);
    } finally {
      xw.flush();
    }
  } finally {
    IOUtil.close(os);
  }
}

代码示例来源:origin: org.sonatype.tycho/tycho-metadata-model

public static void write( UpdateSite site, File file )
  throws IOException
{
  OutputStream os = new BufferedOutputStream( new FileOutputStream( file ) );
  Document document = site.document;
  try
  {
    String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8";
    Writer w = new OutputStreamWriter( os, enc );
    XMLWriter xw = new XMLWriter( w );
    try
    {
      document.toXML( xw );
    }
    finally
    {
      xw.flush();
    }
  }
  finally
  {
    IOUtil.close( os );
  }
}

代码示例来源:origin: org.eclipse.tycho/tycho-metadata-model

public static void write(IU iu, File file, String indent) throws IOException {
    OutputStream os = new BufferedOutputStream(new FileOutputStream(file));

    Document document = iu.document;
    try {
      String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8";
      Writer w = new OutputStreamWriter(os, enc);
      XMLWriter xw = new XMLWriter(w);
      xw.setIndent(indent);
      try {
        document.toXML(xw);
      } finally {
        xw.flush();
      }
    } finally {
      IOUtil.close(os);
    }
  }
}

代码示例来源:origin: eclipse/tycho

public static void write(IU iu, File file, String indent) throws IOException {
    OutputStream os = new BufferedOutputStream(new FileOutputStream(file));

    Document document = iu.document;
    try {
      String enc = document.getEncoding() != null ? document.getEncoding() : "UTF-8";
      Writer w = new OutputStreamWriter(os, enc);
      XMLWriter xw = new XMLWriter(w);
      xw.setIndent(indent);
      try {
        document.toXML(xw);
      } finally {
        xw.flush();
      }
    } finally {
      IOUtil.close(os);
    }
  }
}

代码示例来源:origin: io.takari.nexus/nexus-perf

/**
 * Deploys provided pom.xml file under specified groupId, artifactId and version. The contents of the pom is updated
 * to match specified groupId, artifactId and version.
 */
public long deployPom(String groupId, String artifactId, String version, File pomTemplate) throws IOException {
 final Document pom = XMLParser.parse(pomTemplate);
 pom.getRootElement().getChild("groupId").setText(groupId);
 pom.getRootElement().getChild("artifactId").setText(artifactId);
 pom.getRootElement().getChild("version").setText(version);
 // pom.getRootElement().getChild( "packaging" ).setText( "pom" );
 StringWriter buf = new StringWriter();
 XMLWriter writer = new XMLWriter(buf);
 pom.toXML(writer);
 String body = buf.toString();
 HttpEntity pomEntity = new StringEntity(body, ContentType.TEXT_XML);
 deploy(pomEntity, groupId, artifactId, version, ".pom");
 return body.getBytes(Charsets.UTF_8).length;
}

相关文章