Questions tagged [xmlstarlet]

Open source command line utility for XML file processing.

Filter by
Sorted by
Tagged with
0
votes
1answer
30 views

insert a line into xml using xmlstarlet

I have an XML file which looks like so: <?xml version="1.0" encoding="UTF-8"?> <!-- Solr managed schema - automatically generated - DO NOT EDIT --> <schema name="default-...
0
votes
1answer
178 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
1answer
269 views

Creating new elements with xmlstarlet

I have been trying to to add new elements to an XML file. Original file: <levela> <levelb> </levelb> </levela> I'm trying to get the following result: <levela> &...
0
votes
1answer
363 views

Extract select match value of same contents in XML file

I using this command for below xml file. xmlstarlet sel -t -v '//channel[protected = "True"]/playlist_url' -nl file.xml and result; host.net/aa/vodpr host.net/aa/vodpr/con_tv_r.php Can I choose a ...
2
votes
1answer
850 views

How to extract selected value in XML

I would like to extract only a value from similar content XML file. Example; <?xml version="1.0" encoding="UTF-8" ?> <items> <channel> <title><![CDATA[*** text 1 text *...
0
votes
1answer
351 views

Set bash variables from XML tags

I have the following xml file <root> <deviceID>IO238470374109730497</devicdeID> <KeyValuePairs> <KeyValuePair> <BASE-URL>site.com</BASE-URL> &...
-4
votes
2answers
208 views

Extract content between tags which is having sub tag

Extract the desired content from the file using "xmlstarlet" or "sed" or "awk" or some similar tool. The process should refer the full name of the particular businessprocesses and then should just ...
1
vote
1answer
212 views

Parsing 12,000+ XML files

I have a folder that contains 12,000+ XML files. I need to get a list of files within that folder that meet certain criteria. In the XML file there is a node called /BillingData/InvoiceLinesList/...
0
votes
4answers
443 views

need to join only certain lines of a xml file together [duplicate]

I would like to transform this XML to where only certain lines are joined together. This is so I can later grep only specific lines. If this XML used attributes, then the data would already be in 1 ...
1
vote
1answer
342 views

XmlStarlet xml to csv output as 'NaNNaNNaN'

I wrote a a query xmlstarlet sel -T -t -m badges/row -v "concat(@row, ',')" -n Badges.xml and the output is repeated as: NaNNaNNaN... for what is likely the amount of rows in the Badges.xml file. I ...
0
votes
2answers
458 views

Executing Command in Pipes

I need to understand why I am not able to execute the following. ls -d /data/VT60000* | xargs -IDIRECTORY find DIRECTORY -type f -iname RJ\*.xml | xargs -IFILE sh -c ' XML=$( xmlstarlet fo -D "FILE" )...
3
votes
1answer
2k views

Edit XML using xmlstarlet only in one subnode

When using the command: -bash-4.2$ xmlstarlet ed -u "/configurations/rules/rule/branch" -v 'DAVID' config.xml > final.xml I see that the output file was changed to DAVID, But it was changed ...
2
votes
1answer
572 views

Rename XML elements to a sequence

I was looking at a possible XML-based solution to another question. I'm aware of its accepted answer, which offers sed and python solutions. The given XML fragment is: <Names> <Name>...
2
votes
1answer
434 views

How exactly does xmlstarlet move work

I want to move around elements in an xml document with xmlstarlet Specifically I want to make the following changes <parent> <before/> <span><a>blah</a></...
0
votes
1answer
514 views

Insert a tag with a unique identifier into a XML

I'm able to add a new node with a custom fixed value to my XML file in this way, with xmlstarlet: xmlstarlet ed --subnode "/legge190/data/lotto" --type elem -n newsubnode \ -v "myvalue" But how to ...
8
votes
1answer
398 views

how to massage or format html in order to parse with xmstarlet?

Do I first need to run html in the wild through something like jsoup? Not to make it valid in a human sense, might turn it to gibberish, but at least so that xmlstarlet can process the file? ...
1
vote
2answers
986 views

How to convert multi level xml to a single line containing all levels using XMLSTARLET

The sample XML looks like this: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <root> <level01> <field01>AAAAAAAAAAAAAAAAAAAA</field01> <field02>...
3
votes
2answers
597 views

Can I convert fields in XML to tags using xmlstarlet?

I want to convert fields in Tags to tags within that tag for example <book name="Data Structure" price="250" pages="350"/> To <book name="Data Structure"> <price>250</price&...
1
vote
1answer
1k views

Why isn't this XMLStarlet Query Working?

I'm trying to write a simple bash script that parses price info from the ebay developer API search results. Here's an example of XML search results for "Detective Comics 700": <...