[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tree with xml
- From: greg@circacipher.com
- To: Mike Brown <mbrown@webb.net>
- Date: Tue, 13 Feb 2001 01:17:44 +0100
Hi,
Thanks for our answer, i tought noone would :-)
In the mean time, i browsed through websites and some doc, and had already
understood what you explained to me.
And i've also tried to mess out a little bit with java and php and an xml
file of mine.
It seemed to work ok, except when i tried to do what i wanted to do in the
first place
Something like reproducing a file/directory hierarchy
like
<folder name="root">
<file>
<type>doc</type>
<filename>mytest</filename>
<last-visited-date>011201</last-visited-date>
</file>
<file>
<type>doc</type>
<filename>mytest2</filename>
<last-visited-date>011201</last-visited-date>
</file>
<folder name="subdir-test">
<file>
<type>doc</type>
<filename>mytest-insubdir</filename>
<last-visited-date>011201</last-visited-date>
</file>
<folder name="subsubdir">
<file>
<type>doc</type>
<filename>subsubdir-testfile</filename>
<last-visited-date>011201</last-visited-date>
</file>
</folder>
</folder>
</folder>
See what i mean? The parser i used seemed not the 'see' the <file>'s inside
the <folder>'s, and i didn't really understand what and how to do, so i
decided to ask the mailing list...
So maybe you can point me to some more precise doc, or book ?
Thanks anyway
greg
----- Message d'origine -----
De : "Mike Brown" <mbrown@webb.net>
À : <greg@circacipher.com>
Cc : <xml-dev@lists.xml.org>
Envoyé : mardi 13 février 2001 0:59
Objet : RE: tree with xml
> > It's probably a stupid-beginner question, but i'm wondering
> > weither its possible to have simple tree (hierarchy, like
> > files and directories ie) utilisation of XML?
>
> Hmm, definitely a beginner question, but not stupid, considering how
> obtusely organized and not-for-the-layman the XML spec is.
>
> You will be happy to learn that XML is a linear syntax for the
> representation of a hierarchical data structure.
>
> A very simplistic view, to get you started, is that the data being
> represented is divided into segments of character data (text strings) and
> nested abstract containers called elements. Elements have names (types,
> rather). An XML document has just one element at the top level, and the
tree
> forms 'below' that. Elements can have associated with them name-value
pairs
> called attributes. Attribute values are typically more character data.
>
> The XML syntax uses markup called tags to indicate element boundaries and
> their attributes. Here is an example of the fundamental syntax:
>
> <greeting xml:lang="en">hello</greeting>
>
> This markup represents an element of type 'greeting' with the character
data
> contents 'hello'. The element has an attribute named 'xml:lang' with a
value
> of 'en'. Please do not confuse the physical markup ("tags") with the
> abstract, logical structures ("elements").
>
> OK, now we'll make that particular 'greeting' element be a child of a
> 'mydoc' element, and we give the greeting element some siblings that are
> empty (content-free) 'foo' elements, demonstrating the two different ways
> allowed to write an empty element:
>
> <mydoc><foo></foo><greeting xml:lang="en">hello</greeting><foo/></mydoc>
>
> I could model the corresponding tree with ASCII art like this:
>
> element 'mydoc'
> |___element 'foo'
> |___element 'greeting'
> | | \___attribute 'xml:lang' w/value 'en'
> | |___text 'hello'
> |___element 'foo'
>
> Whitespace can be significant, so the above is not necessarily the same as
>
> <mydoc>
> <foo></foo>
> <greeting xml:lang="en">hello</greeting>
> <foo/>
> </mydoc>
>
> although I'm sure you'll agree it is much easier to read when text is
> inserted between the tags like that.
>
> As I said, this is just a simplistic introduction to get you started and
to
> demonstrate the hierarchical nature of XML. There's a lot more to know.
Get
> a good book on the subject.