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

there is no easy way to gather all children, including Text children #24

Open
aappddeevv opened this issue Sep 19, 2019 · 1 comment
Open

Comments

@aappddeevv
Copy link

aappddeevv commented Sep 19, 2019

Since the .children uses \ "_" which skips Text nodes, there is no easy way to gather just text nodes or more generally, iterate over all nodes, including Text nodes, using the combinators. Since the signature of XmlReader.read pushes a NodeSeq argument, you are a bit stuck.

scala.xml Node.descendant returns all children (entire tree) including Text nodes, but Node \ "_" does not. So you are forced to hop through nodeReader. This is not urgent, but it seems like a better .children that is comprehensive would be nice.

@tmccombs
Copy link
Contributor

Yeah, that does seem like a problem. @aappddeevv, since you have a use case for this maybe you could answer a couple questions:

  1. Do you want an API that returns all the children for a single node (and fails if given more than one), returns all children of all nodes in the selection, or both?
  2. Since .children is already taken do you have any ideas on what this new method should be called? I have a couple of ideas, but none that I love.

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