我正在webservices
通过Javascript
发送请求,我收到的回复是这样的:
<ListOfBook>
<Book>
<Id>ACIA-11QWTKX</Id>
<ListOfBookUser recordcount="0" lastpage="true">
</ListOfBookUser>
</Book>
<Book>
<Id>ACIA-ANC0CC</Id>
<ListOfBookUser recordcount="1" lastpage="true">
<BookUser>
<BookId>ACIA-ANC0CC</BookId>
<BookName>TKSP_GLOBAL</BookName>
</BookUser>
</ListOfBookUser>
</Book>
<Book>
<Id>ACIA-ANC0CF</Id>
<ListOfBookUser recordcount="0" lastpage="true">
</ListOfBookUser>
</Book>
<Book>
<Id>ACIA-EUMCH5</Id>
<ListOfBookUser recordcount="1" lastpage="true">
<BookUser>
<BookId>ACIA-EUMCH5</BookId>
<BookName>TKSP_MADRID_CENTRO_SUR</BookName>
</BookUser>
</ListOfBookUser>
</Book>
正如您所看到的,<Book>
有一些元素有一个孩子<BookUser>
,还有其他元素没有这个孩子。
我需要一种方法来提取<Book>
个<BookUser>
孩子的元素regular expressions
,DOM
或Xpath
。有什么建议吗?