IF the data is 'reasonably small' then you can serialize to a byte array
instead. 

But if you dont know ahead of time I'd go with a temp file

 

 

----------------------------------------

David A. Lee

Senior Principal Software Engineer

Epocrates, Inc.

[email protected]

812-482-5224

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Gary
Larsen
Sent: Wednesday, June 01, 2011 4:01 PM
To: 'General MarkLogic Developer Discussion'
Subject: Re: [MarkLogic Dev General] Storing with a ContenHandler

 

Hi David,

 

Thanks for your advice.   I wish I didn't need content handlers but much
of our data is sourced through the serialization of Java beans.  I'll
give the temp file method a go.

 

gary

 

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Lee, David
Sent: Wednesday, June 01, 2011 3:38 PM
To: General MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Storing with a ContenHandler

 

This is a bit tricky as ContentHandler is a callback (push) API while
InputStream is a pull API.

Marrying the 2 is quite difficult.

 

I suggest serializing the data to a temporary file then using the File
as the input to newContent()

This has the additional advantage of allowing XCC to intelligently retry
as needed.

 

 

 

----------------------------------------

David A. Lee

Senior Principal Software Engineer

Epocrates, Inc.

[email protected]

812-482-5224

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Gary
Larsen
Sent: Wednesday, June 01, 2011 2:41 PM
To: 'General MarkLogic Developer Discussion'
Subject: [MarkLogic Dev General] Storing with a ContenHandler

 

Sorry if this is a bit off topic.  

 

The XML data I'm storing to MarkLogic (Java XCC) is being processed
through one or more ContentHandlers.  With eXist I would create a
resource that would accept the ContentHandler stream.

 

I'm trying to figure out how to convert the ContentHandler stream to in
InputStream for use with one of the ContentFactory.newContent() methods.

 

>From looking at the samples it appears that eventually I should use the
DynamicContentStream class but I need to figure out the conversion
problem first. 

 

I'd really appreciate any pointers in this area.

 

Thanks,

gary

 

 

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to