xmllint

Modify an xml server on several servers

♀尐吖头ヾ 提交于 2021-01-29 15:41:02
问题 I asked Previously how to replace statement in xml file <app-connector port="${APP_CONNECTOR_PORT}" address="192.168.0.254" By <app-connector port="${APP_CONNECTOR_PORT}" address="0.0.0.0" Someone Helped me by giving a sed command which works in single host. sed -i '/<app-connector port="${APP_CONNECTOR_PORT}" address="192.168.0.254"$/s/192.168.0.254/0.0.0.0/' file So Now the question is to apply this to serveral hosts in text file: 192.168.0.1 192.168.0.2 192.168.0.3 192.168.0.4 192.168.0.5

How to append a newline after every match using xmlint --xpath

与世无争的帅哥 提交于 2020-02-20 07:26:45
问题 I have the following HTML code: <textarea name="command" class="setting-input fixed-width" rows="9">1</textarea><textarea name="command" class="setting-input fixed-width" rows="5">2</textarea> I would like to parse it to receive such output: 1 2 Currently I am using: xmllint --xpath '//textarea[@name="command"]/text()' --html but it does not append a newline after each match. 回答1: Hello from the year 2020! As of v2.9.9 of libxml, this behavior has been fixed in xmllint itself. However, if you

How to reference an attribute in xsd

南楼画角 提交于 2020-01-15 05:43:07
问题 I tried to define an attribute that could be referenced in subsequent element definitions. <xs:attribute name="ridref" type="xs:string"/> Later I use it like this: <xs:element name="coordRegRef"> <xs:complexType> <!--xs:attribute name="ridref" type="xs:string"/ this works but I want to use ref --> <xs:attribute ref="ridref" use="required"/> </xs:complexType> </xs:element> XSD compiles fine with xmllint xmllint --schema pc-ar.xsd pc-ar.xml But xmllint says pc-ar.xml:41: element coordRegRef:

How to reference an attribute in xsd

梦想的初衷 提交于 2020-01-15 05:43:07
问题 I tried to define an attribute that could be referenced in subsequent element definitions. <xs:attribute name="ridref" type="xs:string"/> Later I use it like this: <xs:element name="coordRegRef"> <xs:complexType> <!--xs:attribute name="ridref" type="xs:string"/ this works but I want to use ref --> <xs:attribute ref="ridref" use="required"/> </xs:complexType> </xs:element> XSD compiles fine with xmllint xmllint --schema pc-ar.xsd pc-ar.xml But xmllint says pc-ar.xml:41: element coordRegRef:

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>

xmllint: xmlns on a non-root xml element?

拥有回忆 提交于 2020-01-03 10:04:21
问题 xmllint --xpath "//project" test.xml fails on <?xml version="1.0" encoding="UTF-8"?> <projects> <project xmlns="http://maven.apache.org/POM/4.0.0"> <modelVersion>4.0.0</modelVersion> </project> </projects> but succeeds if I remove the xmlns attribute like this: <?xml version="1.0" encoding="UTF-8"?> <projects> <project> <modelVersion>4.0.0</modelVersion> </project> </projects> Is there some problem with this? Is xmlns legal on non-top level tags? I'm using Java Maven: mvn help:effective-pom

Extract value from xml file with namespaces by using xmllint in bash

一世执手 提交于 2020-01-02 19:10:33
问题 I need to extract the name value (Product Finder) from this xml: File: config.xml <?xml version="1.0" encoding="utf-8"?> <widget id="com.abc.app" version="1.3.1" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0" ios-CFBundleVersion="1.3.1.5" android-versionCode="5"> <name>Product Finder</name> <description> Description </description> </widget> I've tried: mles$ xmllint --xpath "/widget/name/text()"