I would like to generate some reports from data stored in SharePoint lists. It is possible to query the lists using web services and retrieve the data in a xml data format.

For example, sending a request to my SharePoint site using the following curl commad

curl --ntlm --user "user:pass" -H "Content-Type: text/xml;charset=UTF-8" --data @request.txt --output answer.txt http://intranet/_vti_bin/lists.asmx

With a request.txt file containing

<?xml version="1.0" encoding="utf-8"?>
        <GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
                            <FieldRef Name="Title" />
                    <FieldRef Name='Title' />
                    <FieldRef Name='Day' />

returns an answer from my test list in SharePoint:

<?xml version="1.0" encoding="utf-8"?>
        <GetListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
                    <rs:data ItemCount="3">
                        <z:row ows_Title='Yesterday' ows_Day='2014-04-13 00:00:00' />
                        <z:row ows_Title='Today' ows_Day='2014-04-14 00:00:00' />
                        <z:row ows_Title='Tomorrow' ows_Day='2014-04-15 00:00:00' />

Is it possible to send such a request directly from LuaLaTeX and process the response as part of the typesetting process? I know I can write the request to a file using the filecontents package and wrap the curl call in \immediate\write18{curl ...} but I was wondering if a better way exists that take advantage of additional features from LuaLaTeX?

From Google I have found that LuaTeX has luasocket build in, and luaxml from the odsfile package also seems relevant. However, I have no idea how to start using these tools. Therefore my question: Is it possible to query a SharePoint list (or some other web service that returns data in xml format) and parse the result using LuaLaTeX?

  • 1
    Is it possible to send such a request directly from LuaLaTeX -- Yes, but you’re going to have to use an SSL wrapper like luasec to make the requests. Or call the curl binary using os.execute() like Context does. Then use the XML library of your choice to extract the data and process it like any normal document. I’ve never used Sharepoint so I can’t help you with the details. – Philipp Gesang Apr 14 '14 at 18:04
  • Thanks. However, this is basically similar to my current approach with the curl call in \immediate\write18 and a piped input using xmlstarlet to extract what I need from the SharePoint response xml. I was hoping that a more self contained solution existed that only relied on the LuaLaTeX executable and preferably only additional tools in TeXlive or things that can easily ship with the document. – Martin Heller Apr 15 '14 at 10:49
  • If you could drop the hard requirement on Latex, Context should be able to do it out of the box: It too uses curl transparently and comes with a builtin XML parser. Sorry I can’t help you any further. – Philipp Gesang Apr 15 '14 at 17:42
  • I haven't tried Context before, but I would be very interested in some pointers if anybody has tried something similar to what I am attempting in Context. – Martin Heller Apr 15 '14 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.