A validator for XML files.
Questions tagged [xmllint]
33 questions
27
votes
9 answers
Parse XML to get node value in bash script?
I would like to know how I can get the value of a node with the following paths:…
MagePsycho
- 485
- 1
- 6
- 14
6
votes
1 answer
xmllint shell not showing number from count xpath expression?
I am using xmllint's interactive shell on cygwin. I would like to count the number of nodes, but xmllint doesn't seem to behaving as I expect:
$> cat test.xml
…
user394
- 14,194
- 21
- 66
- 93
6
votes
2 answers
xmllint display values of more than 1 attributes in single execution
I am using xmllint to parse xml file which has several tags and each tag has several attributes. Sample structure as shown below:
...
...
I need to fetch the values from the…
mtk
- 26,802
- 35
- 91
- 130
5
votes
4 answers
Using Bash to split XML data into variables
I am trying to download some files from a services. The files are found in an XML file. The XML file can have a single file or several files to download. However, now I have a problem with my script. I do not know how to split string from XMLLINT…
Noel Alex Makumuli
- 131
- 2
- 3
- 12
5
votes
1 answer
How do I get a list of the values of matching attributes using xmllint and xpath?
I'm trying to use xmllint to parse names of Solr cores from the configuration file.
This works:
xmllint --xpath /solr/cores/core/@name solr.xml |grep -Po '(?<=name=")[a-z-]+(?=")'
And it returns something like:
core-a
core-b
...
Which is exactly…
Travis Well
- 183
- 1
- 2
- 8
4
votes
1 answer
Problem with encoding in shell script
I have the following code:
#!/bin/bash
task=$1
xml=$(curl -sL "http://login:[email protected]/issues/$task.xml")
id=$(xmllint --xpath '//issue/id/text()' --format - <<<"$xml")
name=$(xmllint --xpath '//issue/subject/text()' --encode utf8 -…
almost_done
- 43
- 3
4
votes
2 answers
Strip attribute name from result set?
I have a HTML document that looks (when oversimplified) like this:
...
...
...
...
What I'd like to do would be to extract the URLs in…
Naftuli Kay
- 38,686
- 85
- 220
- 311
3
votes
2 answers
Get Node value from a XML using xmllint
I have a xml called Det.xml like this :
The Dark Knight
- 2,124
- 4
- 19
- 20
3
votes
3 answers
Create CSV from an xml file
I'm trying to create a csv from an xml with just some information from the xml.
This is my xml :
…
MrBotus
- 31
- 2
3
votes
2 answers
reading XML file and extract only node names and structure
I need to audit XML file structures and need to generate a report that shows only the DOM tree structure and omit the values. Essentially, I just the node names only and no values. I tried using xmllint and xmlstarlet but can't figure out how to do…
Kinnara
- 31
- 2
3
votes
1 answer
how to output html to a file with xmllint?
How do I get xmllint to output to a file?
thufir@dur:~/xmllint$
thufir@dur:~/xmllint$ xmllint --html http://www.skynet.be/nieuws-sport/weer/mijn-weer?cityId=6450 --xpath '//div[@class = "tides"]' - 2>/dev/null
Thufir
- 1,810
- 6
- 33
- 60
3
votes
1 answer
Retrieve attribute value from xml with namespaces using xmllint
I want to retrieve attribute value, using xpath option (without using xmllint' shell).
my xml:
this…
markiz
- 131
- 1
- 5
2
votes
2 answers
XML parsing using xmllint and customizing the output
I have xml file (say input.xml) of the following schema:
…
NGambit
- 495
- 2
- 5
- 7
2
votes
1 answer
How to count nodes and get attribute value without using xpath
Currently I have a shell script like this:
LOGIN=`curl 'https://www.ponta.jp/u/LWAS900/SLWAS900010.htm' -sS | grep '
user218669
- 21
- 3
2
votes
1 answer
How do I write the contents of an XMLLint --shell query?
I'm using xmllint --shell to inspect a very large XML file. I've written an XPath query that returns the results that I want, but in order to view and save the results, I'm having to cd to each node and then write filename.xml. This wouldn't be so…
jktravis
- 2,156
- 2
- 13
- 15