私はXMLクエリ関数にXPathクエリを書きたいと思っています。私は主に何かXMLの以前の知識の私の欠如に基づいて問題に実行されていると私はそれに少し強制されてきた。XMLクエリのネームスペースとノード
ただし、次のXML出力のテキストボックスがあるとします。<ShipmentOrigin>
の<State>
という情報をどのように引き出すのですか?のいくつかの例がありますので、<State>
の完全な検索は機能しません。具体的には<State>
の<ShipmentOrigin>
に集中する必要があります。
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<TrackViaPronumberAdvancedResponse xmlns="https://webservices.rrts.com/tracking/">
<TrackViaPronumberAdvancedResult>
<ShipmentOrigin>
<Name>EXAMPLE</Name>
<Address1>EXAMPLE</Address1>
<Address2>EXAMPLE</Address2>
<City>EXAMPLE</City>
<State>EXAMPLE</State>
<PostalCode>EXAMPLE</PostalCode>
</ShipmentOrigin>
<ShipmentDestination>
<Name>EXAMPLE</Name>
<Address1>EXAMPLE</Address1>
<Address2/>
<City>EXAMPLE</City>
<State>EXAMPLE</State>
<PostalCode>EXAMPLE</PostalCode>
</ShipmentDestination>
<Details>
<Pronumber>EXAMPLE</Pronumber>
<PickupNumber/>
<CustomerNumber>EXAMPLE</CustomerNumber>
<BOLNumber/>
<PONumber>EXAMPLE</PONumber>
<Pieces>5</Pieces>
<Weight>214</Weight>
<AppointmentDate>9/20/2017</AppointmentDate>
<EstimatedDelivery>NA</EstimatedDelivery>
<DeliveredDate>9/20/2017</DeliveredDate>
<BillToNumber>5001868</BillToNumber>
<AppointmentTime>10:00 AM</AppointmentTime>
<ProjectedDeliveryDate>2017-09-25T00:00:00</ProjectedDeliveryDate>
<DeliveredTime/>
<HAWB/>
</Details>
<OriginTerminal>
<TerminalName>San Francisco</TerminalName>
<TerminalTollFreePhone>(877) 220-4582</TerminalTollFreePhone>
</OriginTerminal>
<Comments>
<ShipmentComment>
<CommentDate>09/14</CommentDate>
<ActivityCode>PU</ActivityCode>
<Comment>Shipment was picked up</Comment>
<StatusTime>12:03 AM</StatusTime>
</ShipmentComment>
<ShipmentComment>
<CommentDate>09/25</CommentDate>
<ActivityCode>DUD</ActivityCode>
<Comment>Projected Delivery Date of 9/25/2017</Comment>
<StatusTime>12:03 AM</StatusTime>
</ShipmentComment>
<ShipmentComment>
<CommentDate>09/16</CommentDate>
<ActivityCode>CLO</ActivityCode>
<Comment>Trailer Closed - ready for dispatch</Comment>
<StatusTime>2:00 AM</StatusTime>
</ShipmentComment>
<ShipmentComment>
<CommentDate>09/17</CommentDate>
<ActivityCode>DSP</ActivityCode>
<Comment>Trailer dispatched to terminal</Comment>
<StatusTime>12:00 PM</StatusTime>
</ShipmentComment>
<ShipmentComment>
<CommentDate>09/18</CommentDate>
<ActivityCode>ENR</ActivityCode>
<Comment>Trailer enroute: BRYAN, WY</Comment>
<StatusTime>3:02 PM</StatusTime>
</ShipmentComment>
<ShipmentComment>
<CommentDate>09/19</CommentDate>
<ActivityCode>INV</ActivityCode>
<Comment>Invoice has been emailed</Comment>
<StatusTime>6:03 AM</StatusTime>
</ShipmentComment>
<ShipmentComment>
<CommentDate>09/19</CommentDate>
<ActivityCode>ARX</ActivityCode>
<Comment>Trailer arrived at terminal in DENVER, CO</Comment>
<StatusTime>12:00 PM</StatusTime>
</ShipmentComment>
<ShipmentComment>
<CommentDate>09/19</CommentDate>
<ActivityCode>UNL</ActivityCode>
<Comment>Trailer unloaded at terminal</Comment>
<StatusTime>12:01 PM</StatusTime>
</ShipmentComment>
<ShipmentComment>
<CommentDate>09/19</CommentDate>
<ActivityCode>TRF</ActivityCode>
<Comment>Released to Delivery</Comment>
<StatusTime>5:00 PM</StatusTime>
</ShipmentComment>
<ShipmentComment>
<CommentDate>09/20</CommentDate>
<ActivityCode>OFD</ActivityCode>
<Comment>Shipment out for delivery</Comment>
<StatusTime>12:00 PM</StatusTime>
</ShipmentComment>
<ShipmentComment>
<CommentDate>09/20</CommentDate>
<ActivityCode>APT</ActivityCode>
<Comment>Appointment set for delivery to consignee on 9/20/2017</Comment>
<StatusTime>1:03 PM</StatusTime>
</ShipmentComment>
<ShipmentComment>
<CommentDate>09/20</CommentDate>
<ActivityCode>DED</ActivityCode>
<Comment>Shipment delivered to consignee</Comment>
<StatusTime>4:05 PM</StatusTime>
</ShipmentComment>
</Comments>
<BOLReceived>true</BOLReceived>
<PODReceived>true</PODReceived>
<InspectionAvailable>false</InspectionAvailable>
</TrackViaPronumberAdvancedResult>
</TrackViaPronumberAdvancedResponse>
</soap:Body>
</soap:Envelope>
またはXPath 2.0では、「// *:ShipmentOrigin/*:State' –
@MichaelKay - 良い点。私がXPath 1.0を仮定した理由は不明です。 –