Common LISP [or your favorite language here] is an Excellent XML development tool

Terje Norderhaug terje at in-progress.com
Sat Jun 19 20:25:31 BST 1999


LISP is designed for manipulating structured information, so it is often a
perfect fit for XML. For comparasion purposes, here is the equivalent
functionality as in the C++ and VB examples below but written in Common
LISP. It opens an interface to an XML document named "test2.xml" and
appends a newly created element "Contacts":

(with-open-dom (document "test2.xml" :direction :output)
  (dom:append-child document
     (dom:create-element document "Contacts")))

The with-open-dom construct opens a DOM interface to the file "test2.xml"
and binds it to a variable "document". The direction is set to output to
declare that the created document should be written to the file.

The pathname can be substituted with a reference to any other object that
has a DOM interface. The direction can alternatively be :input or :io to
build on an existing document.

The Common LISP DOM interface used above is already (unofficially)
supported by the Emilé XML editor as well as other of our XML software. It
will soon be made official complete with supporting code, and is likely to
be supported by other Common LISP applications included the CL-HTTP web
server. CL-DOM is documented at:

  http://interaction.in-progress.com/developer/dom/index

At 11:42 PM 6/18/99, Richard Anderson wrote:
>> It will be easier with Java. See Matthew Fuch's article "Why XML Is
>> Meant for Java" at http://www.xml.com/xml/pub/1999/06/fuchs/fuchs.html
>> for background.
>
>That statement is not really true. Sure, if you've got a Java background it
>might be easier, but the articles seems to gloss over any detailed
>comparision of modern C++ XML tools likes IBMs and ours, or, langauges like
>VB, which to a lesser degree I understand.
>
>I think Java is great but..
>
>Anybody with a C++ *will* find it easier using C++ tools and get the huge
>performance benefits to boot.
>
>In the MS world I live in mostly, VB *is* the easiest tool for XML
>development unless this is complicated:
>
>Dim xmlfile As DOMDocument
>Dim contacts As DOMElement
>Dim contact As DOMElement
>
>Set xmlfile = New DOMDocument
>Set contacts = xmlfile.createElement("Contacts")
>xmlfile.appendChild contacts
>xmlfile.save ("C:\test2.xml")
>
>In C++ I just write this to create an XML document:
>
>   DOMDocument *pDoc;
>   pDoc = createDOMDocument();
>
>   pText = pDoc->createElement( L"Contacts");
>   pDoc>appendChild( pText );
>
>   saveDOMDocumentToFile( pDoc,
>                          L"simple_utf16.xml",
>                          L"UTF-16" );
>    pDoc->release();
>
>Is that so hard for a C++ programmer ?
>
>These code snippets are based on our products but the MS/IBM implementations
>are bound to be as simple.
>
>Just my 2$
>
>Richard.
>http://www.vivid-creations.com
>Home of various cross-platform/langauge XML tools

-- Terje <Terje at in-progress.com> | Media Design in*Progress

   Software for Mac Web Professionals at <http://www.in-progress.com>
   Take advantage of XML with Emile, the first XML editor for Mac.



xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)





More information about the Xml-dev mailing list