gpt4 book ai didi

org.restlet.ext.xml.XmlWriter.startDocument()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-21 13:53:05 26 4
gpt4 key购买 nike

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

XmlWriter.startDocument介绍

[英]Write the XML declaration at the beginning of the document. Pass the event on down the filter chain for further processing.
[中]在文档开头编写XML声明。将事件向下传递到过滤器链以进行进一步处理。

代码示例

代码示例来源:origin: org.restlet.jee/org.restlet.ext.atom

/**
 * Writes the representation to a XML writer.
 * 
 * @param writer
 *            The XML writer to write to.
 * @throws IOException
 */
@Override
public void write(XmlWriter writer) throws IOException {
  try {
    writer.setPrefix(ATOM_NAMESPACE, "");
    writer.setDataFormat(true);
    writer.setIndentStep(3);
    writer.startDocument();
    writeElement(writer);
    writer.endDocument();
  } catch (SAXException e) {
    IOException ioe = new IOException(
        "Unable to write the Atom feed document.");
    ioe.initCause(e);
    throw ioe;
  }
}

代码示例来源:origin: org.restlet.android/org.restlet.ext.atom

/**
 * Writes the representation to a XML writer.
 * 
 * @param writer
 *            The XML writer to write to.
 * @throws IOException
 */
@Override
public void write(XmlWriter writer) throws IOException {
  try {
    writer.setPrefix(ATOM_NAMESPACE, "");
    writer.setDataFormat(true);
    writer.setIndentStep(3);
    writer.startDocument();
    writeElement(writer);
    writer.endDocument();
  } catch (SAXException e) {
    IOException ioe = new IOException(
        "Unable to write the Atom feed document.");
    ioe.initCause(e);
    throw ioe;
  }
}

代码示例来源:origin: org.restlet.android/org.restlet.ext.atom

/**
 * Writes the representation to a XML writer.
 * 
 * @param writer
 *            The XML writer to write to.
 * @throws IOException
 */
@Override
public void write(XmlWriter writer) throws IOException {
  try {
    writer.setPrefix(ATOM_NAMESPACE, "");
    writer.setDataFormat(true);
    writer.setIndentStep(3);
    writer.startDocument();
    writeElement(writer);
    writer.endDocument();
  } catch (SAXException e) {
    IOException ioe = new IOException(
        "Unable to write the Atom entry document.");
    ioe.initCause(e);
    throw ioe;
  }
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.atom

/**
 * Writes the representation to a XML writer.
 * 
 * @param writer
 *            The XML writer to write to.
 * @throws IOException
 */
@Override
public void write(XmlWriter writer) throws IOException {
  try {
    writer.setPrefix(ATOM_NAMESPACE, "");
    writer.setDataFormat(true);
    writer.setIndentStep(3);
    writer.startDocument();
    writeElement(writer);
    writer.endDocument();
  } catch (SAXException e) {
    IOException ioe = new IOException(
        "Unable to write the Atom entry document.");
    ioe.initCause(e);
    throw ioe;
  }
}

代码示例来源:origin: org.restlet.android/org.restlet.ext.atom

/**
 * Writes the representation to a XML writer.
 * 
 * @param writer
 *            The XML writer to write to.
 * @throws IOException
 */
@Override
public void write(XmlWriter writer) throws IOException {
  try {
    writer.setPrefix(APP_NAMESPACE, "");
    writer.setPrefix(ATOM_NAMESPACE, "atom");
    writer.setDataFormat(true);
    writer.setIndentStep(3);
    writer.startDocument();
    writeElement(writer);
    writer.endDocument();
  } catch (SAXException e) {
    IOException ioe = new IOException(
        "Unable to write the AtomPub categories document.");
    ioe.initCause(e);
    throw ioe;
  }
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.atom

/**
 * Writes the representation to a XML writer.
 * 
 * @param writer
 *            The XML writer to write to.
 * @throws IOException
 */
@Override
public void write(XmlWriter writer) throws IOException {
  try {
    writer.setPrefix(APP_NAMESPACE, "");
    writer.setPrefix(ATOM_NAMESPACE, "atom");
    writer.setDataFormat(true);
    writer.setIndentStep(3);
    writer.startDocument();
    writeElement(writer);
    writer.endDocument();
  } catch (SAXException e) {
    IOException ioe = new IOException(
        "Unable to write the AtomPub categories document.");
    ioe.initCause(e);
    throw ioe;
  }
}

代码示例来源:origin: org.restlet.android/org.restlet.ext.atom

/**
 * Writes the representation to a XML writer.
 * 
 * @param writer
 *            The XML writer to write to.
 * @throws IOException
 */
@Override
public void write(XmlWriter writer) throws IOException {
  try {
    writer.forceNSDecl(APP_NAMESPACE, "");
    writer.forceNSDecl(ATOM_NAMESPACE, "atom");
    writer.setDataFormat(true);
    writer.setIndentStep(3);
    writer.startDocument();
    writer.startElement(APP_NAMESPACE, "service");
    for (final Workspace workspace : getWorkspaces()) {
      workspace.writeElement(writer);
    }
    writer.endElement(APP_NAMESPACE, "service");
    writer.endDocument();
  } catch (SAXException se) {
    throw new IOException("Couldn't write the service representation: "
        + se.getMessage());
  }
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.atom

/**
 * Writes the representation to a XML writer.
 * 
 * @param writer
 *            The XML writer to write to.
 * @throws IOException
 */
@Override
public void write(XmlWriter writer) throws IOException {
  try {
    writer.forceNSDecl(APP_NAMESPACE, "");
    writer.forceNSDecl(ATOM_NAMESPACE, "atom");
    writer.setDataFormat(true);
    writer.setIndentStep(3);
    writer.startDocument();
    writer.startElement(APP_NAMESPACE, "service");
    for (final Workspace workspace : getWorkspaces()) {
      workspace.writeElement(writer);
    }
    writer.endElement(APP_NAMESPACE, "service");
    writer.endDocument();
  } catch (SAXException se) {
    throw new IOException("Couldn't write the service representation: "
        + se.getMessage());
  }
}

代码示例来源:origin: org.restlet.jse/org.restlet.example

public void write(org.restlet.ext.xml.XmlWriter writer)
      throws IOException {
    try {
      // Start document
      writer.startDocument();
      // Append the root node
      writer.startElement("mail");
      // Append the child nodes and set their text content
      writer.startElement("status");
      writer.characters("received");
      writer.endElement("status");
      writer.startElement("subject");
      writer.characters("Message to self");
      writer.endElement("subject");
      writer.startElement("content");
      writer.characters("Doh!");
      writer.endElement("content");
      writer.startElement("accountRef");
      writer.characters(new Reference(getReference(), "..")
          .getTargetRef().toString());
      writer.endElement("accountRef");
      // End the root node
      writer.endElement("mail");
      // End the document
      writer.endDocument();
    } catch (SAXException e) {
      throw new IOException(e.getMessage());
    }
  };
};

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com