473,385 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Include an xml file into another

Hi
I have a question regarding including an xml file into another.
I have googled and found this:

Mainfile.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE adocname[
<!ENTITY anincludedfile1 SYSTEM "anincludedfile1.xml">
<!ENTITY anincludedfile2 SYSTEM "anincludedfile2.xml">
]>
<arootnode>
&anincludedfile1;
&anincludedfile2;
</arootnode>

anincludedfile1.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<anode name="test1" />

anincludedfile2.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<anode name="test2" />
So far noproblem, everything works great.

But here is my problem, I would like anincludedfile1.xml to include
another xmlfile and that file might include another ant so forth.
In reallity I will probably not be very many levels but I would prefer
not having any limitations.
Applying the same technique on the other files will render an error
somethng like "You can only have one doctype".

Please help me.
/Jimmy

Aug 8 '06 #1
2 3533


jm*****@hotmail.com wrote:

I have a question regarding including an xml file into another.
I have googled and found this:

Mainfile.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE adocname[
<!ENTITY anincludedfile1 SYSTEM "anincludedfile1.xml">
<!ENTITY anincludedfile2 SYSTEM "anincludedfile2.xml">
]>
But here is my problem, I would like anincludedfile1.xml to include
another xmlfile and that file might include another ant so forth.
In reallity I will probably not be very many levels but I would prefer
not having any limitations.
Applying the same technique on the other files will render an error
somethng like "You can only have one doctype".
I don't think you can solve that with external entities. Also note that
external entities are not read by non validating parsers so for instance
if you loaded your Mainfile.xml in a browser like Mozilla which uses the
Expat parser it would not load the external entities at all.

XInclude <http://www.w3.org/TR/xinclude/might do what you want in
terms of levels but it is a new specification and has not much support
either. So unless you know you are going to process your Mainfile.xml
with a certain parser that supports XInclude there is not much use in
applying it as lots of XML parsers/tools others might use to process
your XML will not process XInclude instructions.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 8 '06 #2
jm*****@hotmail.com wrote:
Hi
I have a question regarding including an xml file into another.
I have googled and found this:

Mainfile.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE adocname[
<!ENTITY anincludedfile1 SYSTEM "anincludedfile1.xml">
<!ENTITY anincludedfile2 SYSTEM "anincludedfile2.xml">
]>
<arootnode>
&anincludedfile1;
&anincludedfile2;
</arootnode>

anincludedfile1.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<anode name="test1" />

anincludedfile2.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<anode name="test2" />
So far noproblem, everything works great.

But here is my problem, I would like anincludedfile1.xml to include
another xmlfile and that file might include another ant so forth.
In reallity I will probably not be very many levels but I would prefer
not having any limitations.
Applying the same technique on the other files will render an error
somethng like "You can only have one doctype".
Files included by this method must not have their own DocType
Declaration (XML Spec, section 4.3.2, production [78]).

///Peter
--
XML FAQ: http://xml.silmaril.ie/
Aug 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Vojma | last post by:
I have a problem At my site I have designed a framework with tabs as below (tabs_1.asp) +----+ +------+ +-------+ | MC | | Cars | | Boats | + +------------------------- then, into...
10
by: Toke H?iland-J?rgensen | last post by:
Hello. I am quite new to the c++ language, and am still trying to learn it. I recently discovered how using include files would allow me to split up my code into smaller segments, instead of having...
6
by: Puzzled | last post by:
This is a weird problem, but perhaps someone else has seen it before (I hope!) If I use a fully qualified include call include ( 'http://localhost/subtree/filename.php') I get an 'undefined...
60
by: Derrick Coetzee | last post by:
It seems like, in every C source file I've ever seen, there has been a very definite include order, as follows: - include system headers - include application headers - include the header...
9
by: bill | last post by:
Forget the exact definition of difference between, #include <foo.h> and #include "bar.h" Normally foo.h is a standard header file, so it's path is not defined in compiler option, but I...
5
by: David Mathog | last post by:
One thing that can make porting C code from one platform to another miserable is #include. In particular, the need to either place the path to an included file within the #include statement or to...
11
by: MBS | last post by:
I am playing around with some PHP code. I want to put in an include() function so I can include existing HTML code and output it to the browser. Lo and behold PHP does not support relative paths...
14
by: @sh | last post by:
Guys, We're in the midst of building a new site and have some decisions to make RE the meta data, i.e. Title, Keywords and Description. We need to allow other non development staff to update...
11
by: cybervigilante | last post by:
I can't seem to change the include path on my local winmachine no matter what I do. It comes up as includ_path .;C:\php5\pear in phpinfo() but there is no such file. I installed the WAMP package...
19
by: Earl Partridge | last post by:
FP 2000 I have a single Include file that I want to use on multiple sites. I'm trying to use the following (or some variation) but can't make it work. <!--#INCLUDE...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.