Questions tagged [xmllint]

A validator for XML files.

Filter by
Sorted by
Tagged with
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" ...
MrBotus's user avatar
  • 31
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 ...
Kinnara's user avatar
  • 31
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 ...
T145's user avatar
  • 131
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"> <...
Dave Macias's user avatar
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 ...
JLuc's user avatar
  • 111
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....
Abhinav Gupta's user avatar
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" ...
Pierre François's user avatar
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(...
Kelvin's user avatar
  • 3
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 ...
Kelvin's user avatar
  • 3
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&...
Bhargav's user avatar
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"]' - ...
Thufir's user avatar
  • 1,840
-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&...
Vinay Gowda's user avatar
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 ...
ineedhelp's user avatar
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. ...
Noel Alex Makumuli's user avatar
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 ...
Tapas Bose's user avatar
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 --...
almost_done's user avatar
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 ...
jktravis's user avatar
  • 2,176
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 ...
Dave Hamilton's user avatar
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 "$...
user218669's user avatar
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/...
markiz's user avatar
  • 131
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 ...
markiz's user avatar
  • 131
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 -...
Fidel's user avatar
  • 405
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 ...
jktravis's user avatar
  • 2,176
-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 ...
user136340's user avatar
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>...
kumar2008's user avatar
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="...">...&...
Naftuli Kay's user avatar
  • 39.1k
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 ...
Travis Well's user avatar
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,...
mlathe's user avatar
  • 111
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> <...
The Dark Knight's user avatar
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 ...
MagePsycho's user avatar
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"?> <...
user394's user avatar
  • 14.3k
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> <...
NGambit's user avatar
  • 505
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" /> ...
mtk's user avatar
  • 27.2k