xmlstarlet

XPath query with xmlstarlet

荒凉一梦 提交于 2021-02-19 03:42:34
问题 I have XML similar to this one: <orders> <orderCompleteRequestType> <Head> <Aufnr>11111</Aufnr> </Head> <Register> <Id>180</Id> <value1>11</value1> <value2>22</value2> </Register> <Register> <Id>181</Id> <value1>3</value1> <value2>43</value2> </Register> <Register> <Id>160</Id> <value1>5</value1> <value2>25</value2> </Register> </orderCompleteRequestType> <orderCompleteRequestType> <Head> <Aufnr>22222</Aufnr> </Head> <Register> <Id>280</Id> <value1>1</value1> <value2>12</value2> </Register>

XMLStarlet updating node with the expression

我只是一个虾纸丫 提交于 2021-02-10 12:52:11
问题 I am struggling with the xmlstarlet's update function. I am trying to update xml node value with the value of another. In my exmaple I'm trying to copy FVALUE field value to QUANTITY field with the command: xml ed -u "INVOICE_ITEM_LIST/INVOICE_ITEM/QUANTITY" -x "INVOICE_ITEM_LIST/INVOICE_ITEM/PRODUCT_FEATURES/FEATURE/FVALUE" Using -v "value" option works perfectly but using -x "xpath" parameter doesn't work. What I'm doing wrong? <INVOICE_ITEM_LIST> <INVOICE_ITEM> <PRODUCT_NAME>Product1<

How do I use xmlstarlet to append xml files with multiple sub node?

强颜欢笑 提交于 2021-02-07 08:51:41
问题 I want to add this block after </audio_selector> <input_clipping> <end_timecode>00:00:05:00</end_timecode> <order>1</order> <order>2</order> <start_timecode>00:00:01:00</start_timecode> </input_clipping> Below is my expected output: <?xml version="1.0" encoding="UTF-8"?> <job href="/jobs/35932" version="2.10.0.44452"> <input> <deblock_enable>Auto</deblock_enable> <deblock_strength>0</deblock_strength> <no_psi>false</no_psi> <order>1</order> <timecode_source>zerobased</timecode_source> <file

How do I use xmlstarlet to append xml files with multiple sub node?

蹲街弑〆低调 提交于 2021-02-07 08:49:36
问题 I want to add this block after </audio_selector> <input_clipping> <end_timecode>00:00:05:00</end_timecode> <order>1</order> <order>2</order> <start_timecode>00:00:01:00</start_timecode> </input_clipping> Below is my expected output: <?xml version="1.0" encoding="UTF-8"?> <job href="/jobs/35932" version="2.10.0.44452"> <input> <deblock_enable>Auto</deblock_enable> <deblock_strength>0</deblock_strength> <no_psi>false</no_psi> <order>1</order> <timecode_source>zerobased</timecode_source> <file

How do I use xmlstarlet to append xml files with multiple sub node?

限于喜欢 提交于 2021-02-07 08:49:17
问题 I want to add this block after </audio_selector> <input_clipping> <end_timecode>00:00:05:00</end_timecode> <order>1</order> <order>2</order> <start_timecode>00:00:01:00</start_timecode> </input_clipping> Below is my expected output: <?xml version="1.0" encoding="UTF-8"?> <job href="/jobs/35932" version="2.10.0.44452"> <input> <deblock_enable>Auto</deblock_enable> <deblock_strength>0</deblock_strength> <no_psi>false</no_psi> <order>1</order> <timecode_source>zerobased</timecode_source> <file

Retrieve value of child node given attribute

杀马特。学长 韩版系。学妹 提交于 2020-01-25 06:17:55
问题 I am trying to retrieve the value of a child node of a given node on a Windows Machine. Suppose I have the following XML structure: <xsd:type name="type1"> <xsd:example> <xsd:description>This is the description of said type1 tag</xsd:description> </xsd:example> </xsd:type> I'd like to retrieve the value in between the xsd:description tag given that it is the child of the xsd:type tag with the name="type1" attribute. In other words, I'd like to retrieve "This is the description of said type1

Update .properties file with values from .xml file - problems

依然范特西╮ 提交于 2020-01-16 13:02:49
问题 Following Update .properties file with values from .xml file I have the following problems: Problem 1 : Example: X.xml: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE DOC SYSTEM "ts.dtd"> <?xml-stylesheet type="text/css" href="ts.css"?> <DOC> <PTXT ID="a.b.c.d" CONTEXT="label"><NTI>Text</NTI></PTXT> </DOC> Y.properties: a.b.c.d=Text and my output is: a.b.c.d= Text= = Can you please help me as I really don't understand what's going on. Problem 2 : Example: X.xml my.id = \u00D6ffnen Express

Retrieve XML Node Structure - Bash

允我心安 提交于 2020-01-16 01:16:10
问题 I am trying to retrieve the node structure of a given XML file on a Windows machine through git bash. I have pretty much followed exactly what was mentioned in this example. I am running the same command as in the example, which is: xml sel -T -t -m '//*' \ -m 'ancestor-or-self::*' -v 'name()' -i 'not(position()=last())' -o \ . -b -b -n structure.xml This command runs fine on a MAC (through the regular terminal). However, when I run it on a Windows machine through git bash, it only returns

Update .properties file with values from .xml file

江枫思渺然 提交于 2020-01-15 22:16:25
问题 The following xmlstarlet command: ./xmlstarlet-1.5.0/xml.exe fo --dropdtd $filename | ./xmlstarlet-1.5.0/xml.exe sel -t -m "//DOC//PTXT" -v "concat(./@ID,' ', .)" returns multiple results, because my file contains a lot of doc/ptxt . I need to do something with each output, more explicitly I need to do something with each ptxt value. How can I loop through all results of XMLstarlet ? My output looks something like: my.id.one Text I need my.id.two Text I also need my.id.three Surprisingly I

Update .properties file with values from .xml file

点点圈 提交于 2020-01-15 22:15:12
问题 The following xmlstarlet command: ./xmlstarlet-1.5.0/xml.exe fo --dropdtd $filename | ./xmlstarlet-1.5.0/xml.exe sel -t -m "//DOC//PTXT" -v "concat(./@ID,' ', .)" returns multiple results, because my file contains a lot of doc/ptxt . I need to do something with each output, more explicitly I need to do something with each ptxt value. How can I loop through all results of XMLstarlet ? My output looks something like: my.id.one Text I need my.id.two Text I also need my.id.three Surprisingly I