comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Another XML Question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Another XML Question [message #43054 is a reply to message #43053] Wed, 23 March 2005 14:54 Go to previous messageGo to previous message
Robert Barnett is currently offline  Robert Barnett
Messages: 70
Registered: May 2004
Member
Hello there,

I know this might sound callous, but there are some who argue that you
haven't actually produced a valid XML document until you have specified
a document type definition (DTD) or similar. DTD and XSLs are common
ways of expressing the contraints on an XML document. You may have
realised from the barrage of acronyms that there are actually quite a
few alternatives to the document type definition (DTD). However, if your
documents are simple enough then a DTD should be more than sufficent.

I learnt XML and DTDs from a few excellent tutorials on the web. Either
that, or you could try getting a book on the subject. I can understand
that you might be tempted to skip out on DTDs. I guess this is ok, but,
don't expect anyone else to use your XML if you do not provide some
kind of definition of the structure of the XML document.

Here are an example of how I serialise IDL structures into XML and back
again. This is a parital implementation of the XML Remote Procedure Call
standard (XML-RPC - www.xmlrpc.com). I have provided a DTD as well.

I wish to serialise the following structure

configdata = {CAMPAIGN_ID: 0, SPAM_WAIT: 60}

This is an excerpt from the resulting XML

<struct>
<member>
<name>CAMPAIGN_ID</name>
<value><i4>0</i4></value>
</member>
<member>
<name>SPAM_WAIT</name>
<value><i4>60</i4></value>
</member>
</struct>

This is an excerpt from the DTD


<!ELEMENT i4 (#PCDATA)>

<!ELEMENT value (i4)>

<!ELEMENT name (#PCDATA)>

<!ELEMENT member (name,value)>

<!ELEMENT struct (member+)>

I have taken advantage of borrowing elements from the existing XML-RPC
DTD. This means that my code will be interoperable with many other
implementations of XML-RPC. For example, I could import this XML into
python as a dictionary in only a few lines of code.

The structure of your XML depends upon what you are using it for. In
your case it appears that you are only using XML as a convenient way to
get settings and configuration data into your IDL application. An
alternative to your current XML dilemma might be to formulate some kind
of general document definition (DTD or not) which would cover most of
the possible ways that settings or configuration could be expressed. Who
knows? You may find an minor extention of the example above more than
sufficent.

For those interested, I'm slowly working on an implementation of XMLRPC
for IDL 6.0.

I hope this clears things up a little. Happy easter everyone.


--

nrb@
Robbie Barnett
imag
Research Assistant
wsahs
Nuclear Medicine & Ultrasound
nsw
Westmead Hospital
gov
Sydney Australia
au
+61 2 9845 7223
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: LINUX Device Question
Next Topic: Re: LINUX Device Question

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Tue Dec 02 15:33:34 PST 2025

Total time taken to generate the page: 0.48174 seconds