Alex Chew wrote:
Hi, everybody
In my project, I want to use a query result just like
java.util.Map. But Resource.getContent() just return a raw XML String.
Does there some method can convert a query result into a Map
object? Then i can use like this,
Nope, not possible. XML:DB api provides a way to access binary data and XML
documents, no support for maps.
I tried now,
while (resourceIterator.hasMoreResources()) {
Resource resource = resourceIterator.nextResource();
//I must extract each value, element and attribute, here. It looks some
stranges and runs slowly
System.out.println((String) resource.getContent());
}
I want it can work like this,
while (resourceIterator.hasMoreResources()) {
Resource resource = resourceIterator.nextResource();
Map result = resource.getMap();
//then i can get specified value just use result.get("key")
}
Why don't you query the database and retrieve only the relevant document
fragments.
Vadim