簡體   English   中英

解析Web服務請求Java的XML結果

[英]Parse XML result from Web service request Java

我有來自Web服務請求的XML結果。 框中的標記是xml結果中需要的標記。

在此處輸入圖片說明

這是我到目前為止的內容:

private Node getMessageNode(QueryResponseQueryResult paramQueryResponseQueryResult, String[] paramArrayOfString)
  {

MessageElement[] arrayOfMessageElement = paramQueryResponseQueryResult.get_any();
    Document localDocument = null;
    String res;
    try
    {
      localDocument = arrayOfMessageElement[0].getAsDocument(); //result from the webservice
    }
    catch (Exception localException) {}
    if (localDocument == null) {
      return null;
    }
    Object localObject = localDocument.getDocumentElement();
    localObject = Nodes.findChildByTags((Node)localObject, paramArrayOfString);
   return localDocument; //This returns the XML above
  }

如何解析結果以僅返回包裝盒上的那些標簽,並仍將其作為XML類型返回?

提前致謝。

您可以使用XQuery的Xpath執行此任務。

您應該獲取文檔,然后可以使用getElementByTagName(“ table”)獲取表的子節點或在其上運行XPath:

在這里看到一個很好的xpath教程。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM