Abdera parser: how to acess element with different namespaces

264 views Asked by At

Let's say I have an Atom entry like this:

<entry xmlns:custom="http://custom.xsd">
   <title>test</title>
   <custom:solution>42</custom:solution>
</entry>

If I load the entry into Apache Abdera, I get a nice org.apache.abdera.model.Entry instance. And I can now conveniently access all standard Atom elements with getters.

But how would I read the value 42 from the custom:solution element?

1

There are 1 answers

0
nehaLondon On

You can use something like:

for (Element element : (List<Element>)entry.getExtensions(" <UrI for custom namespace>")) {
    System.out.println(element.getText());// gives you 42
}