1
votes

following works fine:

XMLDocumentManager docMgr = client.newXMLDocumentManager();

JAXBContext context = JAXBContext.newInstance(Document.class);
JAXBHandle jaxbHandle = new JAXBHandle(context);
docMgr.read(
  "/masters/1337-12/t/1439-1074_2013_2_toc.xml",
  jaxbHandle);

Assert.assertNotNull(jaxbHandle);

Document document = (Document) jaxbHandle.get();

But what I can do if I don't know the document URI and I have to do a search like following:

StructuredQueryBuilder qb = new StructuredQueryBuilder(
  "OPTIONS_NAME");
StructuredQueryDefinition querydef = qb.valueConstraint("tocId",
  tocId);
// contains RAW data - 
StringHandle resultsHandle = queryMgr.search(querydef, new StringHandle());

How can I transform this result with JAXB?

1
well..because JAVA API is quite slow (tested now) Ill switch to XCC.. - user1731299
I’d be curious to better understand where the performance of the Java API didn’t meet your expectations. Can you provide more details? - Justin Makeig

1 Answers

2
votes

For a POJO interface to search results, use the built-in SearchHandle class.

JAXB is easiest to use when roundtripping tree data structures from Java objects to XML and back (and thus useful for your own content).

Regarding performance, XCC is faster than the Java API for direct operations on documents. That's why MLCP uses XCC for ingestion. The performance difference is not significant for most applications that interact with the database (especially those that need the value-add services exposed by the REST API).