You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by "Michael Beckerle (JIRA)" <ji...@apache.org> on 2019/06/04 21:45:00 UTC

[jira] [Created] (DAFFODIL-2141) namespace prefix definitions wrong in parse result infoset

Michael Beckerle created DAFFODIL-2141:
------------------------------------------

             Summary: namespace prefix definitions wrong in parse result infoset
                 Key: DAFFODIL-2141
                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2141
             Project: Daffodil
          Issue Type: Bug
          Components: Back End
    Affects Versions: 2.4.0
            Reporter: Michael Beckerle
             Fix For: 2.4.0


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

 
{code:java}
<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>
{code}
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:

 
{code:java}
<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>
{code}
 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)