Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6290947

LSSerializer does not writes the XML declaration when LSSerializerFilter is set

    XMLWordPrintable

Details

    • b71
    • generic
    • generic

    Description

      When XML document is being serialized and the parameter "xml-declaration" of DOMConfiguration is set to "true" (default value) then if LSSerializerFilter is set that rejects all nodes the result of serialization of this document will be an empty string. That is wrong.

      According to the javadoc for LSSerializer class: "Within a Document, DocumentFragment, or Entity being serialized, Nodes are processed as follows Document nodes are written, including the XML declaration (unless the parameter "xml-declaration" is set to false) and a DTD subset, if one exists in the DOM. Writing a Document node serializes the entire document."
      Also in javadoc for LSSerializerFilter written "Document, DocumentType, DocumentFragment, Notation, Entity , and children of Attr nodes are not passed to the filter."
      Hence even if filter rejects all nodes that are passed to it, XML declaration string (for example "<?xml version="1.0" encoding="UTF-16"?>") must be written to serialized form of document.
      ###@###.### 2005-06-27 10:00:37 GMT

      Attachments

        Activity

          People

            sreddysunw Sunitha Reddy (Inactive)
            ashurygisunw Alexey Shurygin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: