Phrogz / SLAXML

SAX-like streaming XML parser for Lua

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

<x:el xmlns:x="foo" /> not supported

Phrogz opened this issue · comments

Declaring a namespace on the element and also using it on that same element does not work.

./slaxml.lua:90: Cannot find namespace for prefix x
stack traceback:
    [C]: in function 'error'
    ./slaxml.lua:90: in function 'nsForPrefix'
    ./slaxml.lua:103: in function 'startElement'
    ./slaxml.lua:205: in function 'parse'
    ./slaxdom.lua:46: in function 'dom'
    stdin:1: in main chunk
    [C]: ?

Wow, this was worse than I thought. Not only was this specific case not supported, but any attributes that were declared before the namespace would also fail, e.g.:

<el nnn:a="would not parse" xmlns:nnn="someuri" />

Further, any redefined namespace prefixes (not common) would incorrectly use the old URI for the prefix until the new definition was in place:

<r xmlns:a="original">
  <a:el a:foo="old namespace" xmlns:a="newuri" a:bar="new namespace">
    This element is also in the old namespace
  </a>
</r>

This is all fixed in v0.6