Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xpath(~x"/some/path"l) transforms :xmlText nodes into char lists #30

Open
sllvn opened this issue Apr 28, 2016 · 1 comment
Open

xpath(~x"/some/path"l) transforms :xmlText nodes into char lists #30

sllvn opened this issue Apr 28, 2016 · 1 comment

Comments

@sllvn
Copy link

sllvn commented Apr 28, 2016

"<p>some nested <em>node</em> content</p>" |> xpath(~x"/node()/node()"l)

returns

['some nested ',
 {:xmlElement, :em, :em, [], {:xmlNamespace, [], []}, [p: 1], 2, [],
  [{:xmlText, [em: 2, p: 1], 1, [], 'node', :text}], [],
  '/some/directory', :undeclared}, ' content']

instead of

[{:xmlText, [p: 1], 1, [], 'some nested ', :text},
 {:xmlElement, :em, :em, [], {:xmlNamespace, [], []}, [p: 1], 2, [],
  [{:xmlText, [em: 2, p: 1], 1, [], 'node', :text}], [],
  '/some/directory', :undeclared},
 {:xmlText, [p: 1], 3, [], ' content', :text}]

Note how the text nodes have been unwrapped into char-lists. Is this correct behavior? I'm running into this issue when passing an element around via transform_by and performing further matching.

Thanks!

@sintro
Copy link

sintro commented Aug 15, 2017

Try
xpath(~x"/node()/node()"sl)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants