特定のコンテンツに対して特定のXMLファイルを解析する必要があります。残念ながら私はxmllintをxpathなしで自分のシステムに持っているだけです(私は他のソースをインストール/更新することはできません)。 XMLが含まれます:最後にxmlをbashで解析する
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<CreateIncidentResponse xmlns="http://schemas.hp.com/SM/7" xmlns:cmn="http://schemas.hp.com/SM/7/Common" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" message="Success" returnCode="0" schemaRevisionDate="2016-02-16" schemaRevisionLevel="2" status="SUCCESS" xsi:schemaLocation="http://schemas.hp.com/SM/7 /Incident.xsd">
<model>
<keys>
<IncidentID type="String">IM0832268</IncidentID>
</keys>
<instance recordid="IM0832268 - Paul test 3 incident via soap" uniquequery="number="IM0832268"">
<IncidentID type="String">IM0832268</IncidentID>
<Category type="String">request for change</Category>
<OpenTime type="DateTime">2016-03-18T16:06:28+00:00</OpenTime>
<OpenedBy type="String">Harlass, Alexander</OpenedBy>
<Priority type="String">4</Priority>
<Urgency type="String">medium</Urgency>
<UpdatedTime type="DateTime">2016-03-18T16:06:28+00:00</UpdatedTime>
<AssignmentGroup type="String">TS3-AOS</AssignmentGroup>
<Description type="Array">
<Description type="String">RH test incident description via soap row 1</Description>
<Description type="String">RH test incident description via soap row 2</Description>
</Description>
<Contact type="String">Harlass, Rudolf</Contact>
<Title type="String">Paul test 3 incident via soap</Title>
<TicketOwner type="String">INTEGRATION.OVO</TicketOwner>
<UpdatedBy type="String">INTEGRATION.OVO</UpdatedBy>
<Status type="String">Open</Status>
<Area type="String">it products</Area>
<Subarea type="String">utilization</Subarea>
<ProblemType type="String">request for change</ProblemType>
<Impact type="String">low</Impact>
<Service type="String">PI Automation and Orchestration Service</Service>
<VIP type="Boolean">false</VIP>
<TargetResolutionDate type="DateTime">2016-03-25T15:00:00+00:00</TargetResolutionDate>
<SOD type="String">OML</SOD>
<SourceId type="String">4711</SourceId>
<UserIncident type="Boolean">false</UserIncident>
<AlertId type="String">4712</AlertId>
<MonitoredId type="String">MI4713</MonitoredId>
</instance>
</model>
<messages>
<cmn:message type="String">Audit Record successfully recorded and added.</cmn:message>
</messages>
</CreateIncidentResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
を私はこのような出力必要があります:
Create SUCCESS
Messages:
Audit Record successfully recorded and added.
Incident ID: IM0832268
Status: Open
Severity: 4
Brief Description: RH test incident description via soap row 1
Opened by: integration.ovo
Opened time: March 20, 2016 11:54:08 PM CET
を私は出力を含む文字列を作成する方法を知っていますが、残念ながら、私はそれはありませんよsedまたは類似のツールに精通している。
xmlから必要な文字列を抽出する方法についてのヘルプがあれば幸いです。事前に
おかげで
システムに[xsltproc](http://xmlsoft.org/XSLT/xsltproc.html)がありますか? – Tomalak
残念ながら、 – user3322838
(このコメントに従ってください。これは長期的な解決策ではありません)何もインストールすることはできませんが、通常はバイナリ(&依存関係)をコンパイルしてパスに書き込み権限があります。最悪の場合、 '/ tmp'は読み書き可能です。 'xmllint'の新しいバージョンをそのパスにコピーしてそこから実行することができます。 – anishsane