Forum .LRN Q&A: Import/Export XML

Collapse
Posted by Sandhya Subash on
Hi All,

  I am a student of University Sydney and currently given a thesis
project.

I am using the ETP package and have to implement functionality to
import/export XML. My project is to develop a e-Learning application
to deliver courses online.

Here's a brief explanation:

1. IMPORT XML : The User comes and writes the chapters of a book
using ETP and wants to save it as XML DTD Docbook. This is a function
to upload the content to the web page as a XML Docbook.

2. EXPORT XML : This is a function to download the Docbook in order
to put that in another page if needed.This is quite complicated and
hard to implement.

Please suggest ways to implement the above two cases. Any
ideas/similar implementations would really help me get started.

This sounded quite similar to export/import glossary and that's the
reason I posted this thread. Please keep updated of future threads.

Thanks!

Collapse
Posted by Jun Yamog on
Hi Sandhya,
<p>
I think ETP may not cut it.  If you are thinking of having a web interface to make a XML Docbook.  Although it may, but some heavy customization must be done.  But I do suggest you look at Content Repository and its api.  You may have to roll you own CMS app on top of CR.
<p>
As for the export once you have your data in the CR that is similar to Docbook.  Its only a matter of making a 2 templates one for putting out a web page and another for putting out a Docbook XML that can be downloaded.
<p>
If I will approach the problem I will probably do it this way:
<ul>
<li>Study the DTD of Docbook.  And see how to make a Content Type in the CR.  You may need to create several Content Types and linking them with one another by using the cr_items.parent_id.
<li>Create some forms to put in the data into your content types.
<li>Create an upload facility and parser to import an existing Docbook document into the CR's content types.
<li>Create a web template and probably a parser to get content out of the web.  It would be nice to have the parser in XSLT since a lot should be available.  Although I think XSLT support in aolserver or OpenACS is poor.
<li>Create a template/parser to get CR data back into Docbook format.
</ul>
<p>
Also it would be great that once you have done it you will share the code with OpenACS.  I think this should be a great addition to OpenACS.
Collapse
Posted by Emmanuelle Raffenne on
I'm working in a department of the "Universidad Nacional de Educación a Distancia" (Distance Learning University?) in Spain and we have the same project: import/export XML-Docbook for learning content, and a UI to get content on the web. Maybe we can join our efforts. As Jun said, AOLserver XML support is poor so we have a big work to do here.
Collapse
Posted by Jon Griffin on
AOLserver doesn't have any xml capability.

I discussed with several people at the LinuxWorld show (Roberto and Talli mainly) about writing a new export/import module for acs and that would include xml (as xml is still far from the standard exchange method) as well as csv, dif and etc.

I think a strict xml package is to specific and it should be folded into a generic import/export package in the core or an aol C module.

Collapse
Posted by Don Baccus on
I wrote a clunky import package for birdnotes.net that is now in ACS 3.5 (kept by Sussedorf and Roy).  A service contract-based package to do something similar would be really nice, I think.

Basically the one I wrote that's in ACS 3.5 lets you define the routines to import the data, list the data, delete the data etc.  Then there's a manager that just interfaces to these routines that are defined for import type.  It knows how to show you error logs generated during import, view the data and a bunch of stuff like that.

In other words it has a plug-in architecture but built manually rather than using a nice plug-in facility like service contracts (because ACS 3.x doesn't have a nice plug-in facility).

I think the basic approach to managing imports is pretty good.  On birdnotes I have import plugins for a variety of things we've needed to upload in bulk, mostly sighting data in various custom formats.  For SloanSpace V1 I wrote import code for bulk-uploading users.

Export would be easy.

If I had time I'd sit down and write a 4.x version myself!

Collapse
Posted by Emmanuelle Raffenne on
Thank you Don, I've just download it.

There's a nsxml library for AOLserver but it seems that this project don't have any activity since a long time. The library is "poor" but it can be a start point. Is there anybody working on it or any project for OpenACS and/or dotLRN to go on with it?

Sorry if the question has been discused before but my english is poor and sometimes it's hard for me to understand (and write) the post of this bboard.

Collapse
Posted by Don Baccus on
No need to apologize for your English.  There is a new XML package written in C called tclDOM.  Neophytos Demetriou has talked
about rewriting our XML parsing code to use this rather than nsxml, you might e-mail him to ask what his current plans are.
Collapse
Posted by Eduardo Palacio on

Hi to all,


I'm sorry for my little knowledge about ETP, but it seems to be a big company's tool, so they should help you to export your ETP to XML. If not, it'll be a very hard job since you need to know all the labels in both languages to form the equivalences.


Once you have the XML you only have to know these things:


1.- This man has a XSLT for Dockbook that you can customize just modifying some variables in it. Look at:


http://wwws.sun.com/software/xml/developers/online-pub/sec04.html


2.- You need to make a few changes in OpenACS or ACS to create a form to upload this FILE.xml and run a new group of TCL's. To use the Instant-Saxon you can download it at http://users.iclway.co.uk/mhkay/saxon/index.html.


This is a line commands program (use the command "exec" in your TCL) that will make the transformations with a .xml, .xsl and a few parameters. In other words, if you use the Norman Walsh Dockbook XSLT you will be able to obtain a web. Pay attention where you put this contents, you need a URL in OpenACS to call it.


3- A simple solution for export is to keep the last version of your .xml in OpenACS because when you push in the submit of the export option, it is automatically sent.



The first file: FORM.tcl


#After: checking, write the headers…

ns_write "
<form enctype=multipart/form-data action=form-2.tcl method=post>
<center><p>
<table border=2 cellpadding=10>
<tr><td>
<center>
<br><b>XML to load:</b>
<p><input type=file size=30 name=attachment>
<p><input type=submit value="Upload">
</center>
</td>
</tr>
</table>
</p></center>
#write the footers<br>
#end file.<br>

 

The second file: FORM-2.tcl
#After: checking, write the headers…
#Keep in mind that you need to have the FILE.xml in the system file if 
you want to use the Instant-Saxon.
#Make modifications in OpenACS in order to recognize the course location.

if {[catch { exec instant-saxon $tmp_filename $tmp_filename $dir
#see saxon documentation about.
} errmsg]
&& ![regexp {caution: filename not matched} $errmsg]}{...

ns_write "See your course in <a href="$dir"> $name_course</a>"

#for the error control
#your footer.
#end file.


That's all, I hope this can help you, bye.


PD: See the apache xml proyect,
http://xml.apache.org and http://xml.apache.org/cocoon/index.html

Collapse
Posted by Eduardo Palacio on

hey! see here,
I hope this can help you
http://www.dotnetguru.org/articles/etp.htm
http://www.hr-xml.org/channels/home.htm
bye do these links have something to do with your ETP?
some about XSLT. http://www.alistapart.com/stories/xslt/index.html

Collapse
Posted by Jun Yamog on
I think those pages has nothing to do with ETP (Edit this Page) package.  But those pointers are very good.
Collapse
Posted by Sandhya Subash on
Hi All,

Thanks for all your postings/suggestions/ideas. I very much appreciate it.Just a quick update on what I am working on at the moment.

I am reading/understanding Docbook and will install dotLRN today.
Start creating a docbook using ETP package. I came to know that
Don Wickinson(not sure about spelling) did some similar work on ETP. How can I contact him?
I think it would be great to work closely with him and get some valuable feedback on my plans. Later I plan to look closely into the code for ETP and start modifying it soon.

Also thanks Samir for posting that thread. It will really help for my project.

Thanks
Sandhya

Collapse
Posted by Talli Somekh on
Sandhya, there's a Dan Wickstrom and a Don Baccus, but no Don Wickstrom.

If you're interested in ETP, it's better to speak with Dave Bauer, Jun Yamog or Luke Pond, whose emails you can find at http://www.openacs.org/directory. Or, you can come to #openacs on irc.openprojects.net where at least Dave and Jun hang out often.

talli