J
John Salerno
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>
<subcategory>Tabs or Spaces</subcategory>
<rule>Spaces-only are strongly recommended over tabs.</rule>
<subcategory>Maximum Line Length</subcategory>
<rule>Limit all lines to a maximum of 79 characters.</rule>
<rule>
For flowing long blocks of text (docstrings or comments), limiting the
length to 72 characters is recommended.
</rule>
<rule>
The preferred way of wrapping long lines is by using Python's implied
line continuation inside parentheses, brackets and braces. If necessary,
you can add an extra pair of parentheses around an expression, but
sometimes using a backslash looks better.
</rule>
My question is, how do I have text within an element like <category>,
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>
But obviously that isn't the structure of XML, yet I'm after something
like that. I thought XML might be more general, and therefore a little
more flexible to use in a variety of ways, than HTML, but I can't get
the HTML structure out of my head when trying to write the XML file.
Thanks for any help.
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>
<subcategory>Tabs or Spaces</subcategory>
<rule>Spaces-only are strongly recommended over tabs.</rule>
<subcategory>Maximum Line Length</subcategory>
<rule>Limit all lines to a maximum of 79 characters.</rule>
<rule>
For flowing long blocks of text (docstrings or comments), limiting the
length to 72 characters is recommended.
</rule>
<rule>
The preferred way of wrapping long lines is by using Python's implied
line continuation inside parentheses, brackets and braces. If necessary,
you can add an extra pair of parentheses around an expression, but
sometimes using a backslash looks better.
</rule>
My question is, how do I have text within an element like <category>,
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>
But obviously that isn't the structure of XML, yet I'm after something
like that. I thought XML might be more general, and therefore a little
more flexible to use in a variety of ways, than HTML, but I can't get
the HTML structure out of my head when trying to write the XML file.
Thanks for any help.