I've meant to start playing with IronPython for a while. And I've also meant to start learning C#/.NET stuff. So, I thought I'd try running the MarkLogic XCC.Net examples via IronPthon.
And, it works! Woohoo! Not that it does much yet...
import clr
clr.AddReferenceToFile("MarklogicXcc.dll")
import Marklogic.Xcc
import System
import os
doc = 'hamlet.xml'
#replace connection info and marklogic db name
contentSource = 'xcc://USER:PASSWORD@HOST:PORT/MLDBNAME'
print "Loading document ..."
Marklogic.Xcc.Examples.ContentLoader.Main(
System.Array[System.String](
[contentSource ,doc]
)
)
print "Fetching document ..."
Marklogic.Xcc.Examples.ContentFetcher.Main(
System.Array[System.String](
[contentSource,os.path.abspath(doc).replace('\\','/'),'-o','hamlet_fetched.xml']
)
)
print "Done."
Our collection of XSLT/XQuery/Java applications is a pain to deploy and do quick interactive testing against. Hopefully being able to script it with IronPython -- and maybe provide a nice interface with Windows Forms -- will allow quicker turnaround times.
No comments:
Post a Comment