예제 #1
0
파일: XMLWriter.java 프로젝트: dom4j/dom4j
  /**
   * Writes the given {@link CDATA}.
   *
   * @param cdata <code>CDATA</code> to output.
   * @throws IOException DOCUMENT ME!
   */
  public void write(CDATA cdata) throws IOException {
    writeCDATA(cdata.getText());

    if (autoFlush) {
      flush();
    }
  }
예제 #2
0
파일: XMLWriter.java 프로젝트: dom4j/dom4j
  protected void writeNode(Node node) throws IOException {
    int nodeType = node.getNodeType();

    switch (nodeType) {
      case Node.ELEMENT_NODE:
        writeElement((Element) node);

        break;

      case Node.ATTRIBUTE_NODE:
        writeAttribute((Attribute) node);

        break;

      case Node.TEXT_NODE:
        writeNodeText(node);

        // write((Text) node);
        break;

      case Node.CDATA_SECTION_NODE:
        writeCDATA(node.getText());

        break;

      case Node.ENTITY_REFERENCE_NODE:
        writeEntity((Entity) node);

        break;

      case Node.PROCESSING_INSTRUCTION_NODE:
        writeProcessingInstruction((ProcessingInstruction) node);

        break;

      case Node.COMMENT_NODE:
        writeComment(node.getText());

        break;

      case Node.DOCUMENT_NODE:
        write((Document) node);

        break;

      case Node.DOCUMENT_TYPE_NODE:
        writeDocType((DocumentType) node);

        break;

      case Node.NAMESPACE_NODE:

        // Will be output with attributes
        // write((Namespace) node);
        break;

      default:
        throw new IOException("Invalid node type: " + node);
    }
  }