Skip to content

fix: --xml-root and --xml-row ignored for XML input (not passed to parser) #139

@vmvarela

Description

@vmvarela

Description

--xml-root and --xml-row flags were only used for XML output formatting. The call to loadXmlInput(), getXmlColumnNames(), and summarizeXml() never received these values, so they were silently ignored when parsing XML input.

Impact

Commands like the following produced wrong results or SQL errors instead of working as expected:

curl -s "https://feeds.feedburner.com/TheHackersNews" \
  | sql-pipe -I xml --xml-root channel --xml-row item \
    'SELECT pubDate, title FROM t WHERE title LIKE "%Google%" LIMIT 5'

The parser would read <rss> as root, treat <channel> as the only row, and fail with no such column: pubDate because the actual item fields were nested one level deeper.

Root cause

loadXmlInput() (and the two related functions) had no xml_root / xml_row parameters, so the values parsed from the CLI were dropped before parsing started.

Acceptance Criteria

  • --xml-root <tag> navigates to that element in the document before iterating rows
  • --xml-row <tag> filters direct children of the container to only those with a matching tag
  • Both flags are optional; omitting them preserves existing behaviour (accept any root, any row tag)
  • --columns and --validate modes respect the flags for XML input as well
  • Existing tests pass; new integration tests cover nested navigation

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:highMust be in the next sprintsize:mMedium — 4 to 8 hourstype:bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions