[XML-SIG] XML appropiate for config files of a xml processor?

Guy Murphy GuyM@eurodatasystems.com
Thu, 9 Nov 2000 13:10:03 -0000


Hiya.

One might consider...

<element xml="example">
    	<start><tag name="p" /><tag name="p" /><tag name="b" /></start>
	<content />
    	<end><tag name="p" /><tag name="p" /><tag name="b" /></end>
</element>

...although in the example you cite, the end tags can be infered.

I noted well the advice that you not use XML for config files. At the end of
the day it's a matter of personal taste, but have found that if one pays
attention to extensible ways of expressing config, rather than literal
notation in XML format, XML configs work well.

Why for the example you give do you not simply....

<template:element name="example">
	<p>
		<p>
			<b><template:content /></b>
		</p>
	</p>
</template:element>

If you use namespaces it clears up a lot of anxiety about confusing the
model of the config from expression of the content.

One might also question why you are not simply relying upon XSL to know how
to represent and "example", given that the config I expressed above is only
a hop, skip and a jump from XSL anyway.

<xsl:template match="example">
	<p>
		<p>
			<b>
				<xsl:value-of select="." />
			</b>
		</p>
	</p>
</xsl:template>

XSLT is very good at mapping from one data model to another. Why reinvent
the wheel?

So in short: I like XML for config descriptions. Concentrate on expressing
your data, not literally notating it... think in terms of "what do I *need*
to know to process this?", and exclude the rest.

If I've misunderstood your intent or requirements please correct me.

Cheers

	Guy.

-----Original Message-----
From: Stephan Tolksdorf [mailto:andorxor@gmx.de]
Sent: 9 November 2000 12:33
To: xml-sig@python.org
Subject: [XML-SIG] XML appropiate for config files of a xml processor?


Hello,

this a design question not directly related to Python.

I'm writing a small homegrown xml processor which is mainly
intended for transforming xml files to html.

At the moment it is configurable by config files written in xml.
But these config files are not easy to manually read or edit as you
have to escape <,>,".
For example a mapping for a xml-tag could look like
this:
<tag xml="example">
     <start>&lt;p&gt;&lt;p&gt;&lt;b&gt;</start>
     <end>&lt;/b&gt;&lt;/p&gt;</end>
</tag>

The processor should now transform
"<example>test</example>"
into
"<p><b>test</b></p>".

Obviously you have to use a special XML-Editor to edit these type of
config files.

So, would you say this is an acceptable drawback in comparison to the
flexibility and ease of use of xml as the config file format?
Or would you say one should use a custom format for these config files?
Maybe you could point me to a config file format actually in use with
such type of processor?

I'd be thankful for your answers.

Best Regards,
  Stephan Tolksdorf



_______________________________________________
XML-SIG maillist  -  XML-SIG@python.org
http://www.python.org/mailman/listinfo/xml-sig