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

Broken nested nodes order when taking text() #50

Open
sintro opened this issue Aug 15, 2017 · 0 comments
Open

Broken nested nodes order when taking text() #50

sintro opened this issue Aug 15, 2017 · 0 comments

Comments

@sintro
Copy link

sintro commented Aug 15, 2017

I am trying to achieve simple (I thought so) task. I have xml:

<title>
Hello <hlword>world</hlword>!
</title>

What I need is to convert this to string:

  1. Hello world!
    Or even better if I could do something like:
  2. Hello **world**!

For second option for now I am even don`t know now hot to implement this in most handy way (mostly because I am new to elixir). But even the first option became unsolvable task for me, because when I am trying to perform

doc |> xpath(~x"//title/descendant-or-self::*/text()"s) 

I get broken order of elements, something like world!Hello (can not tell exactly what order I will get in this situation, but usually this not even "reverse", but something absolutely random (but nested element is almost always going last)).
I don't know if it is sweet_xml's problem in breaking the order of gotten text() of nodes, but at least may be someone can help me in this task solving using this library.

@sintro sintro changed the title Nested nodes order when taking text() Broken nested nodes order when taking text() Aug 15, 2017
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

1 participant