You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that Saxy doesn't support the xml:space="preserve" attribute and fails to emit character data for an element containing only whitespace.
Here's a test which illustrates the issue and the expected behavior:
test"parses elements with xml:space=\"preserve\""dobuffer="<foo xml:space=\"preserve\"> </foo>"assert{:ok,state}=parse(buffer)events=Enum.reverse(state.user_state)assert[{:start_element,{"foo",[{"xml:space","preserve"}]}}|events]=eventsassert[{:characters," "}|events]=eventsassert[{:end_element,"foo"}|events]=eventsassert[{:end_document,{}}|events]=eventsassertevents==[]end
Note that this is a trivial case as the behavior dictated by xml:space is supposed to be inherited by child nodes.
I had a look at parser/element.ex and it seems like supporting such stateful behavior might be challenging.
Perhaps could we work around the issue by allowing some level of customization of whitespace handling as an option to the parse functions?
The text was updated successfully, but these errors were encountered:
Thanks for the report! It seems like it's a bug if Saxy doesn't emit the :characters event for this case. White spaces won't be trimmed by the parser and it's up to the application to decide what to do with it.
It appears that Saxy doesn't support the
xml:space="preserve"
attribute and fails to emit character data for an element containing only whitespace.Here's a test which illustrates the issue and the expected behavior:
Note that this is a trivial case as the behavior dictated by
xml:space
is supposed to be inherited by child nodes.I had a look at
parser/element.ex
and it seems like supporting such stateful behavior might be challenging.Perhaps could we work around the issue by allowing some level of customization of whitespace handling as an option to the parse functions?
The text was updated successfully, but these errors were encountered: