私はセールスフォースから取得し、以下の文字列の応答からタグ値を取得しようとしています、我々はタグ<fullName>
を持っていた上Javaを使用してSOAP応答から要素値を取り出す方法は?
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/2006/04/metadata">
<soapenv:Body>
<listMetadataResponse>
<result>
<createdById>00528000001m5RRAAY</createdById>
<createdByName>Hariprasath Thanarajah</createdByName>
<createdDate>1970-01-01T00:00:00.000Z</createdDate>
<fileName>objects/EmailMessage.object</fileName>
<fullName>EmailMessage</fullName>
<id />
<lastModifiedById>00528000001m5RRAAY</lastModifiedById>
<lastModifiedByName>Hariprasath Thanarajah</lastModifiedByName>
<lastModifiedDate>1970-01-01T00:00:00.000Z</lastModifiedDate>
<namespacePrefix />
<type>CustomObject</type>
</result>
</listMetadataResponse>
</soapenv:Body>
</soapenv:Envelope>
。私はタグ内の値を取得し、それをString配列に入れる必要があります。私は部分文字列メソッドで試してみましたが、1つの値しか返しません。誰も私にこれをするように提案することはできますか?
使用[XPathの](http://docs.oracle.com/javase/8/docs/api/javax、文字列配列にそれらを入れて、以下のような文字列の配列にそれらを返すことができます/xml/xpath/package-summary.html)、または[DocumentBuilderの作成](http://docs.oracle.com/javase/8/docs/api/javax/xml/parsers/DocumentBuilderFactory.html#newDocumentBuilder-- )、文書にSOAPメッセージを解析し、[getElementsByTagNameの(http://docs.oracle.com/javase/8/docs/api/org/w3c/dom/Document.html#getElementsByTagName-java.langを使用します。文字列 - )。 – VGR
私はこの方法で試しました。わたしにはできる。 – Hariprasath