[
Lists Home |
Date Index |
Thread Index
]
> I have XMLs where I need to reference a repetitive data. I figure there
> are several ways to do this. I have successfully used an Entity reference
> to identify the data as a String (this works well). However, I would like
> for the String to reside in an External file so all XMLs can reference the
> same file. The external file would either be an XML or txt file. I have
> seen Entity references to non-xml files such as images but am not sure how
> I would just point to a text file and its one line of text. I am sure it is
> simple I just have no example.
You can use still use an entity to do this:
<!DOCTYPE foo [
<!ENTITY string SYSTEM "string.txt">
]>
<foo>
&string;
</foo>
You can use a URL as well if you want to. And you can reference XML
files as well.
However I wouldn't recommend exchanging files that use entities in this
way. It's fine for 'local' use though.
> I believe I could also use XPointer and just point to an external xml file
> that contains the info I desire. Or I could even possibly use XMLInclude.
> Does anyone have a suggestion on the best approach to this problem. I hope
> I have been clear enough.
Yes you could use XPointer and/or XInclude to do this, but the question is
do you want to use additional software (i.e. an XPointer or XInclude processor)?
If the entity approach works for you then go ahead.
If you're going to end up doing more complex content management, then you
may want to think about something more robust/flexible. But for a single
line of text, an entity is more than enough.
Cheers,
L.
--
Leigh Dodds, Research Group, Ingenta | "Pluralitas non est ponenda
http://weblogs.userland.com/eclectic | sine necessitate"
http://www.xml.com/pub/xmldeviant | -- William of Ockham
|