LISTSERV mailing list manager LISTSERV 15.5

Help for XML-L Archives

XML-L Archives

XML-L Archives


Next Message | Previous Message
Next in Topic | Previous in Topic
Next by Same Author | Previous by Same Author
Chronologically | Most Recent First
Proportional Font | Monospaced Font


Join or Leave XML-L
Reply | Post New Message
Search Archives

Subject: Re: Question about multiple XML documents
From: "John E. Simpson" <[log in to unmask]>
Reply-To:General discussion of Extensible Markup Language <[log in to unmask]>
Date:Wed, 14 Feb 2001 18:02:39 -0500

text/plain (89 lines)

At 02:06 PM 02/14/2001 -0700, Adam Kaupisch wrote:
>...What if I have 2 files which just contain properties.
>file 1:
><?XML version="1.0"?>
><data x="0"></data>
><data y="0"></data>
>file 2:
><?XML version="1.0"?>
><data a="1"></data>
><data b="2"></data>
><foo bar="asdf"></foo>

Some nits to pick :)... first, the "XML declaration (that's the first line
of each of your files above) must be lowercase.

Second, those name-value pairs do look like properties, but they're
actually called "attributes" in an XML context. (That's just so you don't
shoot yourself in the foot on a less forgiving mailing list. :)

Third, for these files to be legitimate XML there *must* be a "wrapper"
element in each one. Under the wrapper you can have as many or few
sub-branches as you want, but XML doesn't permit you to declare that your
one document tree has two trunks (in the case of file 1) or three trunks
(in the case of file 2).

Of course that's not to say that you *must* use legitimate XML document
structure to solve this or any other problem... only that if you want to
leverage XML tools, resources like this mailing list :), etc., then you do
need to put a wrapper in each one, even if it's just a placeholder.

>but, I want to include file 1 into file 2. That is, when viewed, I would
>simply see output from file 2 as:
><?zml version="1.0"?>
><data x="0"/>
><data y="0"/>
><data a="1"/>
><data b="2"/>
><foo bar="asdf"/>
>note that I don't want to have a wrapper around it like the "roottag" below,
>I simply want it to list.

(Same nit as above... you must have a "roottag," of that or any other name.)

>That way if I were to go into file 1 and change
>x=0 to x=1 it would propogate to file 2 when file 2 was displayed. In this
>case I am simply working with property files and want to pull the properties
>from some root file into another file(s) so I can keep all common data in 1
>file but when viewing the sub files (file 2, etc) it looks seemless and as
>if file 1 didn't exist (i.e. when viewed no one would know the wiser that a
>file 1 existed unless they were editing it)
>does this make sense?

Well... sort of. I mean, I think I know what you're asking. But XML files
are just text files with no inherent "display" properties. If you're using
an XML-aware application of some kind -- maybe a smart XML authoring tool
-- it might have the effect that you're seeking, but there's nothing
preventing someone from opening up the document with a plain old text
editor (short of operating system security measures, all that). It's kind
of like saying that you want to build a Web page in HTML, but you don't
want "View Source" available, you want just to allow the user to see the
formatted  results.

In general, what you want to do sounds like it can be done using the
entity-reference solution I provided before, as long as you use a "wrapper"
element in the including document. Again, though, if someone simply opens
the including document with a text editor, they won't "see" the included
document; they'll see the including one and the entity reference (e.g.
&root; or whatever you call it). The inclusion is a *logical* one which
will be understood (and perhaps made to seem "physical") by XML-aware
software, not a true physical one, nor a logical one which appears physical
in a non-XML context (such as a text editor).

>I'm still new to xml so my ability to express what I
>am thinking might be sweked ;)

It's okay; newcomer questions welcomed. Nonetheless, for the moment, I'd
agree that your thinking may indeed be sweked!

John E. Simpson          | "Is it weird in here, or is it just    | me?" -- Steven Wright
XML Q&A:     |

Back to: Top of Message | Previous Page | Main XML-L Page



CataList Email List Search Powered by the LISTSERV Email List Manager