Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Making entities available to multiple XML documents

Reply
Thread Tools

Making entities available to multiple XML documents

 
 
Matthew Burgess
Guest
Posts: n/a
 
      07-27-2003
I'm not sure that XML allows me to do what I want, but here goes:

Given that I have files a.xml and b.xml who both need to access an
entity defined in c.ent how do I go about it?

Ideally I'd like a syntax similar to:

--- a.xml (or b.xml) ---
<!DOCTYPE ... [
#include c.ent <!-- makes all entities in c.ent available in a.xml
-->
]>

&c-ent;
--- end xml file ---

--- c.ent ---
<!ENTITY c-ent "entity from c.ent">
--- end c.ent ---

Any ideas if/how I can achieve this without putting the entities
within the DTD itself (which is not an option)?

Thanks,

Matt.
 
Reply With Quote
 
 
 
 
Toni Uusitalo
Guest
Posts: n/a
 
      07-27-2003

"Matthew Burgess" <> wrote in message
news: m...
> I'm not sure that XML allows me to do what I want, but here goes:
>
> Given that I have files a.xml and b.xml who both need to access an
> entity defined in c.ent how do I go about it?
>
> Ideally I'd like a syntax similar to:
>
> --- a.xml (or b.xml) ---
> <!DOCTYPE ... [
> #include c.ent <!-- makes all entities in c.ent available in a.xml
> -->
> ]>


Hmmm. maybe I don't understand your goal or maybe I'm underestimating your
XML skills, but isn't external DTD (that will contain your entity
declarations) enough?

<!DOCTYPE rootname SYSTEM "external.dtd">

external DTD:

<!ENTITY name1 "value1">
<!ENTITY name2 "value2">


Toni Uusitalo


>
> &c-ent;
> --- end xml file ---
>
> --- c.ent ---
> <!ENTITY c-ent "entity from c.ent">
> --- end c.ent ---
>
> Any ideas if/how I can achieve this without putting the entities
> within the DTD itself (which is not an option)?
>
> Thanks,
>
> Matt.



 
Reply With Quote
 
 
 
 
Matthew Burgess
Guest
Posts: n/a
 
      07-28-2003
"Toni Uusitalo" <> wrote in message news:<daXUa.2179$> ...
> "Matthew Burgess" <> wrote in message
> news: m...
> > I'm not sure that XML allows me to do what I want, but here goes:
> >
> > Given that I have files a.xml and b.xml who both need to access an
> > entity defined in c.ent how do I go about it?
> >
> > Ideally I'd like a syntax similar to:
> >
> > --- a.xml (or b.xml) ---
> > <!DOCTYPE ... [
> > #include c.ent <!-- makes all entities in c.ent available in a.xml
> > -->
> > ]>

>
> Hmmm. maybe I don't understand your goal or maybe I'm underestimating your
> XML skills, but isn't external DTD (that will contain your entity
> declarations) enough?
>
> <!DOCTYPE rootname SYSTEM "external.dtd">
>
> external DTD:
>
> <!ENTITY name1 "value1">
> <!ENTITY name2 "value2">
>
>
> Toni Uusitalo


I managed to do it this way:

--- a.xml/b.xml --
<!DOCTYPE ... [
<!ENTITY % c-entities SYSTEM "path/to/c.ent">
%c-entities;
]>
<!-- a.xml/b.xml can now use any entity defined in c.ent -->
--- end a.xml/b.xml ---

Thanks,

Matt.
 
Reply With Quote
 
Toni Uusitalo
Guest
Posts: n/a
 
      07-28-2003

"Matthew Burgess" <> wrote in message
news: om...

> I managed to do it this way:
>
> --- a.xml/b.xml --
> <!DOCTYPE ... [
> <!ENTITY % c-entities SYSTEM "path/to/c.ent">
> %c-entities;
> ]>
> <!-- a.xml/b.xml can now use any entity defined in c.ent -->
> --- end a.xml/b.xml ---


Yes, it was parameter entities was what you were after, BTW W3C has
http://www.w3.org/2003/entities page which contains a lot of entity
definitions for XML/XHTML.

Toni Uusitalo


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Build JDOM documents containing unicode entities Tom XML 0 09-10-2005 02:22 PM
Build JDOM documents containing unicode entities Tom Java 0 09-10-2005 02:22 PM
Multiple Input XML documents to produce one output XML SV XML 1 08-16-2005 10:37 AM
HTML::Entities::encode() returning wrong(?) entities Jim Higson Perl Misc 3 07-25-2004 09:13 PM
Using XHTML entities in XML documents: Legal? Peter C. Chapin XML 4 07-06-2003 02:10 AM



Advertisments