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

Preserve Text Nodes in XML #4359

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

singpolyma
Copy link

The XML model that was being used was not able to represent elements with text
nodes and element children interspersed (such as in "markup like" XML:
<x>abc <y>def</y> ghi</x>). This switches from a single content String to a
list of child Node. Content is pulled from all children recursively. A list of
Element children is also maintained since this list is frequently traversed so
it saves runtime checks in all of those loops at the expense of a small amount
of memory. Since the children and childNode lists must be kept in sync, they
are both made private to avoid a child class trying to mutate one of them
without a safe helper.

The XML model that was being used was not able to represent elements with text
nodes and element children interspersed (such as in "markup like" XML:
<x>abc <y>def</y> ghi</x>).  This switches from a single content String to a
list of child Node.  Content is pulled from all children recursively.  A list of
Element children is also maintained since this list is frequently traversed so
it saves runtime checks in all of those loops at the expense of a small amount
of memory.  Since the children and childNode lists must be kept in sync, they
are both made private to avoid a child class trying to mutate one of them
without a safe helper.
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

Successfully merging this pull request may close these issues.

None yet

1 participant