Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DAFFODIL-2141

namespace prefix definitions wrong in parse result infoset

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Bug
    • 2.4.0
    • 2.4.0
    • Back End
    • None

    Description

      If you run the CSV example, the Infoset XML from parse looks like:

       

      <file xmlns="http://example.com">
          <header xmlns="">
              <title>last</title>
              <title>first</title>
              <title>middle</title>
              <title>DOB</title>
          </header>
          <record>
              <item>smith</item>
              <item>robert</item>
              <item>brandon</item>
              <item>1988-03-24</item>
          </record>
          <record>
              <item>johnson</item>
              <item>john</item>
              <item>henry</item>
              <item>1986-01-23</item>
          </record>
          <record>
              <item>jones</item>
              <item>arya</item>
              <item>cat</item>
              <item>1986-02-19</item>
          </record>
      </file>
      

      The above is simply wrong, because the elementFormDefault is 'unqualified', so the record element is a local element declaration in no namespace. The above sets the default no-prefix namespace to the example namespace, and that definition applies not to the header element, which overrides it, but to all the record elements and their children.

       

      This is simply incorrect. Every record element needs the same xmlns="" on it as well as the header element.

      A better output infoset would reuse the "ex" prefix definition from the CSV.dfdl.xsd schema and output this:

       

      <ex:file xmlns:ex="http://example.com">
        <header>
          <title>last</title>
          <title>first</title>
          <title>middle</title>
          <title>DOB</title>
        </header>
        <record>
          <item>smith</item>
          <item>robert</item>
          <item>brandon</item>
          <item>1988-03-24</item>
        </record>
        <record>
          <item>johnson</item>
          <item>john</item>
          <item>henry</item>
          <item>1986-01-23</item>
        </record>
        <record>
          <item>jones</item>
          <item>arya</item>
          <item>cat</item>
          <item>1986-02-19</item>
        </record>
      </ex:file>
      

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            mbeckerle Mike Beckerle
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: