From: Chris H. <chr...@gm...> - 2013-01-15 16:40:26
|
Hello Adam, I've been working on project that had a higher priority, I'm running the code now on eXist-db 1.4.3 which works fine. I'll send you a working example as soon as I can. Kind regards, Chris 2013/1/15 Adam Retter <ad...@ex...> > Chris, > > Any chance of a standalone example that we can compile and run, which > will show us the issue you are seeing? I really would like to solve > this if there is an issue. > > On 12 January 2013 02:49, Dmitriy Shabanov <sha...@gm...> wrote: > > I can't run this code because of missing: > > BaseCollection, DocumentType, Language, DocumentId, IdsCollection, > > IdsXMLResource, existsDocument, getAccessor > > > > > > On Fri, Jan 11, 2013 at 11:13 PM, Chris Hofstede > > <chr...@gm...> wrote: > >> > >> Hello, > >> > >> I've added the java method below. IdsCollection and IdsXMLResource are > >> wrappers for the corresponding XMLDB classes for convenience. This code > >> works fine for eXist-db 1.4.3. > >> > >> Kind regards, > >> > >> Chris > >> > >> public static boolean saveBranchCurrent(BaseCollection collection, > >> DocumentType documentType, Language language, > >> DocumentId documentId, Document document) throws Exception { > >> boolean bReturn = false; > >> IdsCollection accessor = null; > >> IdsXMLResource resource = null; > >> try { > >> > >> // Adjust the document id > >> documentId.setDocumentId(document); > >> > >> // Check if the document does not already exist. > >> if (!existsDocument(collection, documentType, language, documentId)) > { > >> > >> // Create an accessor object for the document collection > >> accessor = getAccessor(collection, documentType, language); > >> > >> // Create an XML object > >> resource = accessor.createResource(documentId); > >> resource.setContentAsDOM(document); > >> > >> // Save the document in the collection > >> accessor.storeResource(resource); > >> bReturn = true; > >> } > >> return bReturn; > >> } finally { > >> if (accessor != null) > >> accessor.close(); > >> if (resource != null) > >> resource.close(); > >> } > >> } > >> > >> 2013/1/11 Dmitriy Shabanov <sha...@gm...> > >>> > >>> Can you give smallest code to reproduce issue? > >>> > > > > > > -- > > Dmitriy Shabanov > > > > > ------------------------------------------------------------------------------ > > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft > > MVPs and experts. SALE $99.99 this month only -- learn more at: > > http://p.sf.net/sfu/learnmore_122912 > > _______________________________________________ > > Exist-open mailing list > > Exi...@li... > > https://lists.sourceforge.net/lists/listinfo/exist-open > > > > > > -- > Adam Retter > > eXist Developer > { United Kingdom } > ad...@ex... > irc://irc.freenode.net/existdb > |