[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XML include,XPointer or DTD


how to use xpointer
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.