xmlquery icon indicating copy to clipboard operation
xmlquery copied to clipboard

Some text nodes not present in tree after parsing - seems to be mixed content with formatted xml

Open max-carroll opened this issue 3 years ago • 3 comments

func Test_MyTest(t *testing.T) {
	assert := assert.New(t)
	inputHtml := `
	<a>
	  <b>hello</b>
		my friend
  </a>`

	topNode, _ := xmlquery.Parse(strings.NewReader(inputHtml))

      //  `my friend` should be a sibling with <b> or a child of <a> but it is neither and unobtainable from the tree structure
}

max-carroll avatar Apr 27 '21 10:04 max-carroll

One thing thats notable is if we remove all the whitespace, the my friend node is within the tree structure

max-carroll avatar Apr 27 '21 13:04 max-carroll

Hello, which version are you using? I test on my machine with the latest version, the output is not problem.

output: <?xml?><a><b>hello</b>my friend</a>

zhengchun avatar Apr 29 '21 06:04 zhengchun

@max-carroll : Now that v1.3.7 has been released with the fix in PR #62 , I wonder if that fixes this issue.

galtm avatar Sep 22 '21 11:09 galtm