Questions tagged [xmllint]

A validator for XML files.

Filter by
Sorted by
Tagged with
0
votes
1answer
77 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
0answers
9 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
1answer
110 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
1answer
623 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&...
2
votes
1answer
738 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
1answer
1k 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&...
0
votes
1answer
6k 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 ...
3
votes
4answers
7k 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
0answers
774 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
1answer
691 views

Problem with encoding in shell script

I have the following code: #!/bin/bash task=$1 xml=$(curl -sL "http://login:pass@server.com/issues/$task.xml") id=$(xmllint --xpath '//issue/id/text()' --format - <<<"$xml") name=$(xmllint --...
0
votes
3answers
1k 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
2answers
112 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
1answer
917 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
1answer
4k 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
1answer
2k 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
1answer
1k 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 -...
1
vote
1answer
1k 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
1answer
475 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
2answers
7k 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>...
3
votes
2answers
857 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="...">...&...
4
votes
1answer
9k 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
2answers
1k 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
2answers
42k 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> <...
21
votes
7answers
134k 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
1answer
6k 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"?> <...
1
vote
1answer
11k 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> <...
5
votes
2answers
21k 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" /> ...