8000 expand_entity: :never does not preserve the 
 entity as expected · Issue #136 · qcam/saxy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
expand_entity: :never does not preserve the 
 entity as expected #136
Open
@LFelicien

Description

@LFelicien

Hello,

I'm using Saxy to parse .docx files, and I need to preserve certain entities exactly as they appear in the XML content—for instance, (line feed) present in attributes such as o:gfxdata.

According to the documentation, the expand_entity: :never option is supposed to keep entity references literal in the output (rather than converting them to the character \n). However, in my tests, still ends up converted or normalized, and I no longer see in the resulting DOM structure.

Minimal example:

xml = ~s|<tag attr="Base64&#xA;MoreBase64" />|
{:ok, dom} = Saxy.SimpleForm.parse_string(xml, expand_entity: :never)
# Expected behavior: the attribute value should remain "Base64&#xA;MoreBase64".
# Actual behavior: the entity &#xA; seems to be turned into something else.
IO.inspect(dom)

The specification for the :never setting suggests that the entity should not be resolved, i.e., it should be emitted as in the final structure. Is this a bug, or is there an internal XML normalization step affecting line feeds in attributes?

Thank you in advance for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0