antchfx / xmlquery

xmlquery is Golang XPath package for XML query.

Home Page:https://github.com/antchfx/xpath

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

max-carroll opened this issue · 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
}

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

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>

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