473,473 Members | 2,207 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Multi level embedding of xml files

The application I am writing uses XML files for validation. I've been
able to set up my xml files so that I can share validation for common
fields using external entities. eg

<?xml version="1.0"?>
<!DOCTYPE foo [
<!ENTITY ch1 SYSTEM "http://www.wiz.org/project/chap1.xml">
<!ENTITY ch2 SYSTEM "http://www.wiz.org/project/chap2.xml">
<!ENTITY ch3 SYSTEM "http://www.wiz.org/project/chap3.xml">

]>

<foo>
.... document instance here ...
</foo>

....
<foo>

<BLIVET>&ch1;</BLIVET>

<BLIVET>&ch2;</BLIVET>

<BLIVET>&ch3;</BLIVET>

</foo>

This works fine but I would like to extend it so that I can include
smaller chunks of xml in the included xml file. The problem I have is
with the DOCTYPE declaration in the sub xml file which I need to
include the sub-sub xml file as I don't want this included in my top
level document.

Is it possible to do what I want to do?

Regards

Shaun

Jul 20 '05 #1
2 1448
In article <11**********************@c13g2000cwb.googlegroups .com>,
<ca************@gmail.com> wrote:
This works fine but I would like to extend it so that I can include
smaller chunks of xml in the included xml file. The problem I have is
with the DOCTYPE declaration in the sub xml file which I need to
include the sub-sub xml file as I don't want this included in my top
level document.

Is it possible to do what I want to do?


No, external entities are not complete XML files and can't have DTDs.
You will have to define the entities in the top level file. You could
modularize the top-level DTD using parameter entities in the same way
as you have modularized the document itself: put the small chunk
entity definitions in separate files like "chap1.dtd", and include
them as external parameter entities in the top-level DTD like this:

<!DOCTYPE foo [
<!ENTITY ch1 SYSTEM "http://www.wiz.org/project/chap1.xml">
<!ENTITY % ch1-ents SYSTEM "http://www.wiz.org/project/chap1.dtd">
%ch1-ents;
<!ENTITY ch2 SYSTEM "http://www.wiz.org/project/chap2.xml">
<!ENTITY % ch2-ents SYSTEM "http://www.wiz.org/project/chap2.dtd">
%ch2-ents;
....

Each of chap1.dtd, chap2.dtd, ... could use more parameter entities to
cut it into even smaller chunks.

-- Richard
Jul 20 '05 #2
In article <ct***********@pc-news.cogsci.ed.ac.uk>,
Richard Tobin <ri*****@cogsci.ed.ac.uk> wrote:

I forgot to say:
<!ENTITY ch1 SYSTEM "http://www.wiz.org/project/chap1.xml">
<!ENTITY % ch1-ents SYSTEM "http://www.wiz.org/project/chap1.dtd">
%ch1-ents;


You could put the definition of ch1 itself in chap1.dtd too.

-- Richard

Jul 20 '05 #3

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

Similar topics

0
by: Atul Kshirsagar | last post by:
I am embedding python in my C++ application. I am using Python *2.3.2* with a C++ extention DLL in multi-threaded environment. I am using SWIG-1.3.19 to generate C++ to Python interface. Now to...
3
by: Phil Frost | last post by:
Greetings all. I'm attempting to embed a python interpreter at a very low level in an OS I am writing. Currently I'm stuck with build issues. Firstly, as there is no working C compiler in our OS, I...
0
by: Mustafa Demirhan | last post by:
Hello, I am trying to add Python scripting support to one of my applications and I really need some help regarding the thread terminations. The application is a multi-threaded Windows...
0
by: adsheehan | last post by:
Hi, I am embedding Python into a multi-threaded application running on Solaris. Python will enable end users to customize and re-program many aspects of the application. I expect that the C++...
1
by: CW | last post by:
I have been using (vertical) data list to simulate menus on left pane of pages (I don't use drop-down and pull-down menus because javascript must be enabled). However, the problem with data list is...
23
by: Kaz Kylheku | last post by:
I've been reading the recent cross-posted flamewar, and read Guido's article where he posits that embedding multi-line lambdas in expressions is an unsolvable puzzle. So for the last 15 minutes...
3
by: cjb | last post by:
Is there a way to get Directory.GetFiles to return multi-language file names? I haven't found any overloads that allow any such parameter. The way I am using it now is: foreach (string d in...
11
by: rossum | last post by:
I want to declare a const multi-line string inside a method, and I am having some problems using Environment.NewLine. I started out with: class foo { public void PrintStuff() { const...
6
by: dbuchanan | last post by:
There are three parts to this 1.) How do I cascade menus? 2.) And, how do I cascade menus with a multi-select CheckBoxList?
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...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...
1
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.