OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   RE: [xml-dev] XML include,XPointer or DTD

[ 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">

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.



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


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS