Questions tagged [xmllint]
A validator for XML files.
33
questions
3
votes
3
answers
1k
views
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 :
<?xml version="1.0" encoding="UTF-8"?>
<hashlist version = "2.0" ...
3
votes
2
answers
2k
views
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 ...
2
votes
3
answers
731
views
How can XPath functions be expressed to output each input element?
I'm using this command:
xmllint --xpath 'substring-after(string(//item/link), "_")' rss.xml
And get the desired output, except it's on the first element. How would I fix this to have it be ...
1
vote
1
answer
806
views
Update XML parameter, with namespace, using xmlstarlet
I have this XML file:
<?xml version="1.0" encoding="UTF-8" ?>
<engineConfiguration xmlns="http://bla.com/engine/management/engineConfiguration">
<...
0
votes
1
answer
384
views
xmlstarlet how to select tag immediately before selected tag
I scan scribus SLA files and wish to find the text having some specific paragraph styles.
SLA file format is a quite flat XML format and there are several paragraphs in a row, each being separated ...
1
vote
1
answer
839
views
How to extract specific node values without travesing via xmlstarlet
<xml>
<email>[email protected]</email>
<email>[email protected]</email>
<email>[email protected]</email>
<host>
<ip>56....
1
vote
2
answers
705
views
I want to add a namespace prefix to the tags of the default name space of an XML document from the shell
I have a SVG file, which is an XML document:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
...
0
votes
0
answers
77
views
Extracting XML forming a resultset like format
I've encountered a case wherein I need to extract values from xml however, the tags are missing. To elaborate, I've manually finger-counted around 5 of the same elements however, one sibling node(...
0
votes
1
answer
2k
views
xmllint usage - having a hard time getting xml attributes
I'm in the process of retreiving some data from a xml file, it is actually a SSIS package file (dtsx). I've read about using xmllint, however I'm having a hard time retrieving what I want. I'd like ...
0
votes
1
answer
2k
views
how to parse the xml that have multiple properties and names
if we are having a XML script like this , How to get the value of a particular name using XML parsing
<?XML>
<conf>
<prop><name>something</name><value>1</value&...
3
votes
1
answer
4k
views
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
votes
1
answer
2k
views
Need to parse data from xml to shell script [closed]
Need to parse data from xml to shell script one aft another
Requriment :- we need to take <FileSetfolder> as one record. XML may contain many <FileSetFolder> from Each <FileSetFolder&...
1
vote
1
answer
11k
views
How to grep an XML tag and get only the value inside the quotes after it?
I'm trying to get these values from the XML format below: USA GERMANY
<country name="USA" id="TEST1" password="123" />
<country name="GERMANY" id="TEST2" password="456" />
I was ...
5
votes
4
answers
10k
views
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. ...
1
vote
0
answers
1k
views
xmllint is Killed while formatting huge file
I'm trying to format a XML file (2.6G) using xmllint tool and redirecting the output to a file as:
xmllint --format response.xml > formatted.xml
When the process gets started it is taking all ...
4
votes
1
answer
965
views
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 --...
0
votes
3
answers
2k
views
How can I escape special characters in a sed "sub-command"?
I'm using xmllint --shell on a large XML file, and using the write command to write out an XML snippet to be used in testing. The snippet that gets written out needs a couple of lines from the ...
0
votes
2
answers
164
views
Is there any tools that will let me check String length of XML Node
Am wondering if there are any tools that will do this:
Exmaple XML:
<node1>
<Data>
<Unique>123456789-1234567891</Unique>
</Data>
</node1>
What i was hoping ...
2
votes
1
answer
1k
views
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 '<input type="hidden" name\|<form\|</form'`
for i in $(seq $(printf "$...
3
votes
1
answer
6k
views
Retrieve attribute value from xml with namespaces using xmllint
I want to retrieve attribute value, using xpath option (without using xmllint' shell).
my xml:
<?xml version="1.0" encoding="UTF-8"?>
<XML>
<hhi:Elem xmlns:hhi="http://www.w3.org/...
0
votes
1
answer
3k
views
Parsing xml into array using xmllint
I have xml file with multiple <db> elements, I need to extract attributes from each node and do some work on them.
IS it possible to load them to array, using ksh and xmllint ?
This is what I ...
1
vote
1
answer
2k
views
Validate a list of xml files
I'd like to validate a list of xml files against a schema, and only be notified of failures.
This command seems to work, but the last grep command has no effect:
find -iname "*.xml" | xargs xmllint -...
2
votes
1
answer
2k
views
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 ...
-1
votes
1
answer
541
views
how can i fetch a value from a text which is an incomplete xml file and then store it in a variable
I am having an issue while formatting an incomplete XML file in to a proper tagged XML, so that I can easily fetch the XML value inside a tag from it.
Output text is like this:
Input parameters
...
2
votes
2
answers
11k
views
xmllint displays value of second attribute if first one matches
my xml looks like
<list1>
<list2 id="abc" value="yes"></list2>
<list2 id="xyz" value="no"></list2>
<list2 id="def" value="yes"></list2>
<list1>...
4
votes
2
answers
1k
views
Strip attribute name from result set?
I have a HTML document that looks (when oversimplified) like this:
<html>
<body>
<a href="...">...</a>
<a href="...">...</a>
<a href="...">...&...
5
votes
1
answer
11k
views
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 ...
1
vote
2
answers
2k
views
How to format xml attributes, not just elements
How do you format an XML document to make it easy to read element attributes?
I have a xml based webservice that returns one or two elements, but with hundreds of attributes. As I'm doing development,...
3
votes
2
answers
48k
views
Get Node value from a XML using xmllint
I have a xml called Det.xml like this :
<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<...
28
votes
9
answers
182k
views
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:
config/global/resources/default_setup/connection/host
config/global/resources/default_setup/connection/username
...
6
votes
1
answer
7k
views
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
<?xml version="1.0"?>
<...
2
votes
2
answers
13k
views
XML parsing using xmllint and customizing the output
I have xml file (say input.xml) of the following schema:
<?xml version="1.0"?>
<TagA>
<TagB>
<File Folder="FOLDER1M\1" File="R1.txt" />
</TagB>
<...
6
votes
2
answers
25k
views
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:
<root>
<child attr1="abc" attr2="def" attr3="ghi" />
...