-1

I have a xml retrieved from seedlist service like this.

<atom:feed xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:wplc="http://www.ibm.com/wplc/atom/1.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <atom:link href="/wps/images/icons/scope_search_wcm.gif" rel="icon"/>
  <wplc:field id="name">Locations</wplc:field>
  <wplc:field id="contentSourceType">Seedlist</wplc:field>
  <wplc:field id="defaultcontext">/poc</wplc:field>
  <wplc:field id="effectivedate">1354640637000</wplc:field>
  <wplc:field id="modifier">uid=wpsadmin,o=defaultWIMFileBasedRealm</wplc:field>
  <wplc:field id="securecontext">/mypoc</wplc:field>
  <wplc:field id="search_controllable_uuid">f2bedbba-724e-420b-b066-5d0fef04c421</wplc:field>
  <wplc:field id="locale">en</wplc:field>

I want to retrieve /mypoc

<wplc:field id="securecontext">/mypoc</wplc:field>

wplc tag have common local name field So I am unable to retrieve this.

I am using Abdera parser to parse xml.

If it is possible I want to retrieve this using QName or Feed.getSimpleExtension() method

4

1 回答 1

0

如果你想坚持使用 Abdera - 那是 Atom 特定的 - 我认为你不能通过一次调用来获得该值:你需要枚举所有在 parent 上wplc:field使用的元素then ,并使用检查正确的值.getFirstChild()getNextSibling()idgetAttributeValue()

如果您使用通用 XML 解析器,您应该能够使用 XPath 直接获取该值,例如:

/atom:feed/wplc:field[@id='securecontext']

atom(已经定义了forhttp://www.w3.org/2005/Atomwplcfor的前缀http://www.ibm.com/wplc/atom/1.0

于 2013-03-21T20:36:57.020 回答