xmlstarlet

Parsing xml to and replacing specific tags shell script

浪子不回头ぞ 提交于 2020-01-12 05:50:10
问题 For the below xml ,I need to replace <studentStatus> for <studentName>CLASSA</studentName> to <studentStatus>failed</studentStatus> . <studentFile> <student> <studentName>CLASSA</studentName> <studentStatus>Success</studentStatus> <studentActions> <studentAction> <studentType>Juniour</studentType> <studentStatus>Completed</studentStatus> <studentMsg/> </studentAction> <studentAction> <studentType>HighSchool</studentType> <studentStatus>Completed</studentStatus> <studentMsg/> </studentAction>

Using XML starlet to pull values

纵然是瞬间 提交于 2020-01-06 21:42:53
问题 Given: <UOIS UOI_ID="9352923211a63c6fe6643832d3c4a7786e21ed26" CONTENT_TYPE="VIDEO" NAME="TR2014_295_11_1a_PM.mov" VERSION="1" METADATA_STATE_DT="2016-06-03 17:01:10.0" METADATA_STATE_USER_ID="1" IMPORT_DT="2016-06-03 13:35:58.0" IMPORT_USER_ID="1" MASTER_OBJ_MIME_TYPE="video/quicktime" MODEL_ID="30001"> <FILE_SIZE_VIEW CONTENT_SIZE="100948.92 " /> <SI_AV_ASSET_METADATA VIDEO_BIT_RATE="226 Mbps" REGIONAL_ENCODING_FORMAT="NTSC" DC_TITLE="TR2014_295_11_1a_PM.mov" VIDEO_ORIGINATION_FORMAT=

Using XML starlet to pull values

瘦欲@ 提交于 2020-01-06 21:42:31
问题 Given: <UOIS UOI_ID="9352923211a63c6fe6643832d3c4a7786e21ed26" CONTENT_TYPE="VIDEO" NAME="TR2014_295_11_1a_PM.mov" VERSION="1" METADATA_STATE_DT="2016-06-03 17:01:10.0" METADATA_STATE_USER_ID="1" IMPORT_DT="2016-06-03 13:35:58.0" IMPORT_USER_ID="1" MASTER_OBJ_MIME_TYPE="video/quicktime" MODEL_ID="30001"> <FILE_SIZE_VIEW CONTENT_SIZE="100948.92 " /> <SI_AV_ASSET_METADATA VIDEO_BIT_RATE="226 Mbps" REGIONAL_ENCODING_FORMAT="NTSC" DC_TITLE="TR2014_295_11_1a_PM.mov" VIDEO_ORIGINATION_FORMAT=

Using XML starlet to pull values

人盡茶涼 提交于 2020-01-06 21:42:02
问题 Given: <UOIS UOI_ID="9352923211a63c6fe6643832d3c4a7786e21ed26" CONTENT_TYPE="VIDEO" NAME="TR2014_295_11_1a_PM.mov" VERSION="1" METADATA_STATE_DT="2016-06-03 17:01:10.0" METADATA_STATE_USER_ID="1" IMPORT_DT="2016-06-03 13:35:58.0" IMPORT_USER_ID="1" MASTER_OBJ_MIME_TYPE="video/quicktime" MODEL_ID="30001"> <FILE_SIZE_VIEW CONTENT_SIZE="100948.92 " /> <SI_AV_ASSET_METADATA VIDEO_BIT_RATE="226 Mbps" REGIONAL_ENCODING_FORMAT="NTSC" DC_TITLE="TR2014_295_11_1a_PM.mov" VIDEO_ORIGINATION_FORMAT=

XMLStarlet - UTF-8 Nordic characters

会有一股神秘感。 提交于 2020-01-06 03:26:07
问题 Using XMLStarlet (windows) to edit an RSS feed, but got a few issues with norwegian characters 'ÆØÅ'. I'm using an example I found at this site ( https://stackoverflow.com/a/14397390/3168446 ) This is my feed.xml. (Notepad++ says it's encoded in UTF-8) <?xml version="1.0" encoding="utf-8"?> <rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"> <channel> <title>My RSS Feed</title> <description>This is my RSS Feed</description> </channel> </rss> I'm not using the following example as it

Insert XML from one file into another with xmlstarlet?

萝らか妹 提交于 2020-01-05 04:36:11
问题 Is there a way to insert XML from one file into another using xmlstarlet or am I stuck stringing together a bunch of -s commands? I have a fairly large chunk to insert. Would I be better off writing some xsl with that chunk in it? 回答1: Would I be better off writing some xsl with that chunk in it? I think you would be better off using XSL; the document() function lets you get XML from another file. xmlstarlet's ed subcommand doesn't have access to document() and it lacks a way of accessing

XMLStarlet and RSS

依然范特西╮ 提交于 2020-01-03 04:19:46
问题 I can't seem to get this basic xslt query working via xmlstarlet. I'm sure I'm missing something obvious, but for the life of me I cannot figure out this syntax, so someone please illuminate me. XML Starlet Command: xml sel -t -m "//rdf:RDF/item" -v link -v description -v link ./sss.rdf sss.rdf: <?xml version="1.0" encoding="UTF-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl

Unescape the ampersand (&) via XMLStarlet - Bugging &

橙三吉。 提交于 2020-01-02 13:45:05
问题 This a quite annoying but rather a much simpler task. According to this guide, I wrote this: #!/bin/bash content=$(wget "https://example.com/" -O -) ampersand=$(echo '\&') xmllint --html --xpath '//*[@id="table"]/tbody' - <<<"$content" 2>/dev/null | xmlstarlet sel -t \ -m "/tbody/tr/td" \ -o "https://example.com" \ -v "a//@href" \ -o "/?A=1" \ -o "$ampersand" \ -o "B=2" -n \ I successfully extract each link from the table and everything gets concatenated correctly, however, instead of

xmlstarlet append and insert new line value

允我心安 提交于 2019-12-30 11:35:18
问题 I'd like to know how to add a new line using xmlstarlet. My aim is to add a <audio>track_01</audio> after job/input/file_input/uri. <?xml version="1.0" encoding="UTF-8"?> <job version="2.10.8"> <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_input> <certificate_file nil="true"/> <password>upass</password> <uri>source_path</uri> <username>uname</username> </file_input

Xmlstarlet ed encoding and powershell inside Process C#

扶醉桌前 提交于 2019-12-25 08:48:24
问题 I want to use xmlstarlet from the powershell started with Process in a C# application. My main problem is that when I use this code: ./xml.exe ed -N ns=http://www.w3.org/2006/04/ttaf1 -d '//ns:div[not(contains(@xml:lang,''Italian''))]' "C:\Users\1H144708H\Downloads\a.mul.ttml" > "C:\Users\1H144708H\Downloads\a.mul.ttml.conv" on powershell I get a file with the wrong encoding (I need UTF-8). On Bash I used to just export LANG=it_IT.UTF-8 && before xmlstarlet but on powershell I really don't