473,657 Members | 2,686 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 "anincludedfile 1.xml">
<!ENTITY anincludedfile2 SYSTEM "anincludedfile 2.xml">
]>
<arootnode>
&anincludedfile 1;
&anincludedfile 2;
</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 3553


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 "anincludedfile 1.xml">
<!ENTITY anincludedfile2 SYSTEM "anincludedfile 2.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 "anincludedfile 1.xml">
<!ENTITY anincludedfile2 SYSTEM "anincludedfile 2.xml">
]>
<arootnode>
&anincludedfile 1;
&anincludedfile 2;
</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
4030
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 tabs_1.asp I include another page
10
2528
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 class definitions etc. in one big file (yay, major discovery...). My problem is this: When I define a class in one include file, and then try to instantiate it in another, I get compile-time errors saying the type is invalid. If i move the...
6
1896
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 function' error when calling a routine that's defined in that file.
60
8269
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 associated with this source file For example, in a file hello.c: #include <stdio.h>
9
13101
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 am curious how compiler find it.
5
2506
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 very carefully define the order in which paths are searched with command line options on the compiler. Both can cause problems, especially when dealing with complex software distributions. It occurs ot me that by extending the C include...
11
2258
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 with the include() function! (How shortsighted can you get?) Is there any way at all to use relative paths with include()? Any hacks? If I use an absolute filepath, everything is fine. But I don't want to do that--I can't do that. I want...
14
1438
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 such fields, there will be an administration panel available to do this. Seen as the site is very popular and receives many hits we're looking very carefully at CPU load and memory use, therefore need some advice regarding
11
26599
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 and PEAR is in c:\wamp\php\pear I modified php.ini in the c:\wamp\php directory to reflect the actual path, but even stopping and restarting my server shows the c: \php5\pear path. I can't change it no matter what I do I also tried the...
19
2156
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 FILE="www.myothersite.com/FavLinks.inc"--> Earl
0
8407
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8319
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8612
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7347
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6175
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4171
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2739
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.