On 13.10.2012 11:38, Dirk Kirsten wrote:
> Welcome to BaseX and I hope we can help you with your troubles :)

Yeah, thank you!


> If you are running an XPath like "doc('catalog')//article" and you get
> a null result, I suspect that your xml document uses some namespaces.
> If /article/ is not in the default namespace, you will correctly
> retrieve a null value as result. Using the wildcard namespace should
> resolve your issue, i.e. using "doc('catalog')//*:article".

Yes, thanks, paying attention to namespaces was indeed helpful. My
application now does what it should do – well, at least sort of. It
retrieves the "article" elements from the database, the query returns
quickly and I can access the articles one by one.

However, articles are quite shallow. The whole model comprises about
16.000 articles nested in a hierarchy of container elements. The root of
everything is the "catalog" element. And when I retrieve that one, the
VM still fails with an OutOfMemoryError. The stacktrace shows that the
org.basex.query.util.DataBuilder class is busily and recursively adding
nodes, elements and atrributes and obviously trys to build up the whole
tree in memory.


> I personally never used the DOM for processing as XQuery itself is
> very nice. Indeed, using iteration and .toJava() should return just
> this single node. Maybe someone else on the list could help here.

Speaking as an XQuery newbie, I can imagine that it is possible to
implement navigating a DOM up and down and interactively controlled.
However, I am not yet convinced that this is the most straight-forward
way do to that, and I'd prefer using the DOM directly.


> I agree that the help could be extended. However, there is some
> extensive example source code for Java available
> at 
> https://github.com/BaseXdb/basex-examples/tree/master/src/main/java/org/basex/examples.
> Maybe you could have a look at this source code. Hope this helps.

Yes, I found these examples. They showed me that there is
is QueryProcessor, how to use it to submit a query, get an Iter as
result and use toJava() to get a DOM node. On the other hand, examples
and API documentation don't help much if you cannot go the DOM way (for
the reasons mentioned above) and want to try something else, namely
fiddle around with org.basex.query.value.item.Item and its subclasses.


-- 

Best regards
Rainer Klute


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

Reply via email to