Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: is XML what I want here?

From: Peter Flynn <peter.nosp@-.--------.-->
To: NULL
Date: 3/5/2006 7:48:00 PM
John Salerno wrote:
> Hi everyone. I thought I might do a little experiment with XML and type 
> up some rules for syntax formatting for a programming language. But I'm 
> a little confused about how to format the XML file. My first thought was 
> I might do this in HTML instead, and I think I sort of wrote the XML 
> file with HTML syntax in mind. Needless to say, nothing is nested properly:
> 
> <?xml version='1.0' encoding='utf-8'?>
> 
> <category>Code Layout</category>
>     
>     <subcategory>Indentation</subcategory>
>     <rule>Use 4 spaces per indentation level.</rule>

This is generally counterproductive. XML works on the basis of 
hierarchies and containers (think DIVs), so better would be

<subcategory>
   <name>Indentation</name>
   <rule>Use 4 spaces per indentation level.</rule>
</subcategory>

However, if you want to use the XML in processing, rather than just
document things, you need to phrase it so a machine can read it:

<subcategory>
   <name>Indentation</name>
   <rule class="textindent" lang="css" value="4" units="em"/>
</subcategory>

[...]
> My question is, how do I have text within an element like <category>, 

Just type it. But in practice, for an XML document going to be used as
data, mixing text and markup is A Bad Idea. It's normal for text
documents (eg HTML) but for XML-used-as-data is will only lead to tears
and recriminations.

> which should actually be the entire parent node of the file? Am I not 
> supposed to have text in it? What would be the proper way to do this?
> 
> I am thinking of something like this:
> 
> <h1>Code Layout</h1>
>   <h2>Indentation</h2>
>     <p>Use 4 spaces per indentation level.</p>

Not useful.

///Peter
-- 
XML FAQ: http://xml.silmaril.ie/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent