Skip to content

Fix #91 add filenames for output results when using xmllint xpath option multiple input files

Zhongyuan Zhou requested to merge zaneChou/libxml2:fixOutputInfoForXpath into master

This is feature patch that add filenames in xmllint --xpath output message.
I have tested it using test case of libxml2-test and other kind. The result all ok.
For example, if here having three XML files a.xml b.xml c.xml, contents follows:

$ cat a.xml 
<a>fgh</a>
$ cat b.xml 
<b>dfghjk</b>
$ cat c.xml 
<a> dfghj </a>

Running xmllint --xpath '/a/text()' *.xml

  • Before patch up, the result follows:
$ xmllint --xpath '/a/text()' *.xml
afgh
XPath set is empty
 dfghj 
  • After patche up, the result follows:
$ xmllint --xpath '/a/text()' *.xml
a.xml: fgh
b.xml: XPath set is empty
c.xml:  dfghj

Of course, this is just a simple case to show. I have tried to test patch by all kind of test cases to confirm it's OK.
@nwellnhof Could you help me to check it and patch to libxml2? Thanks. If there are any problems, I am willing to solve them.

Merge request reports