473,395 Members | 2,436 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,395 software developers and data experts.

concatenate several xml files into one big xml/html file?

I have a rather basic question to ask. It reflects a lack of
understanding of how you solve problems with xml. But bear with me.

I'm a technical writer interested in producing good source code files.
The files will be created using an desktop xml editor, valid, etc. I
want to find a way to create a master document using relevant
portions of these multiple xml files which can then be converted into
a usable format.

The real situation I am dealing with.

I have recipes using this xml dtd
http://www.happy-monkey.net/recipebook/

However the xml dtd is not exactly what I need. For example, I want
to includes chapters with text and things unrelated to recipes. And
then I want other chapters which are only recipes. Then I want
chapters which contain recipes.

So I want to run an xslt scipt to run down the list of recipebook xml
files and make a long file which I can then embed it into a xml
dialect more suitable for publishing (such as docbook).

But what if I add another recipe? What if I add need to add another no-
recipe chapter.

The problem is: I have no idea how to get started. Is the solution
generally to create my own dtd/schema which a specialized tag for
importing data from other dtds.

I appreciate the concept of xml; but I've never understood how xml
solves these kinds of problems. Hopefully someone from this group can
offer a few hints (or at least URLs)

Robert Nagle
http://www.imaginaryplanet.net/weblogs/idiotprogrammer/
Houston, Texas

Mar 3 '07 #1
4 5866
Hello, does anyone want to give this question an old college try?

Maybe my question can be boiled down to this:

is it better to try to embed one flavor of xml within another? Or is
better to create a custom xml/schema that takes into account your
unique situation?
Thanks..

rj

On Mar 3, 2:07 pm, "idiotprogrammer" <idiotprogram...@gmail.com>
wrote:
I have a rather basic question to ask. It reflects a lack of
understanding of how you solve problems with xml. But bear with me.

I'm a technical writer interested in producing good source code files.
The files will be created using an desktop xml editor, valid, etc. I
want to find a way to create a master document using relevant
portions of these multiple xml files which can then be converted into
a usable format.

The real situation I am dealing with.

I have recipes using this xml dtdhttp://www.happy-monkey.net/recipebook/

However the xml dtd is not exactly what I need. For example, I want
to includes chapters with text and things unrelated to recipes. And
then I want other chapters which are only recipes. Then I want
chapters which contain recipes.

So I want to run an xslt scipt to run down the list of recipebook xml
files and make a long file which I can then embed it into a xml
dialect more suitable for publishing (such as docbook).

But what if I add another recipe? What if I add need to add another no-
recipe chapter.

The problem is: I have no idea how to get started. Is the solution
generally to create my own dtd/schema which a specialized tag for
importing data from other dtds.

I appreciate the concept of xml; but I've never understood how xml
solves these kinds of problems. Hopefully someone from this group can
offer a few hints (or at least URLs)

Robert Naglehttp://www.imaginaryplanet.net/weblogs/idiotprogrammer/
Houston, Texas

Mar 5 '07 #2
idiotprogrammer wrote:
is it better to try to embed one flavor of xml within another? Or is
better to create a custom xml/schema that takes into account your
unique situation?
It Depends.

If there's an XML-based and moderately-well-standardized language which
naturally describes what you want to describe, you probably don't want
to reinvent the wheel. One of the purposes of namespaces is specifically
to allow independently-developed grammars to be intermixed without the
risk of their trying to assign conflicting meanings to the same tokens.
(Note, however, that DTDs are inherently incompatable with namespaces;
if you want to do modern XML design you're sorta forced toward XML
Schemas... or toward one of their less-standard competetors)

On the other hand, if there isn't an existing language which is a good
fit, or if you don't trust the one you've found to be stable enough for
your needs, or if has features which would constitute a security risk in
your environment, you may want to reimplement and make that part of your
own custom grammar. As suggested above, the lack of namespace support in
DTDs makes collisions more common and is more likely to force
reimplementation as a result.

In other words, it's the same answer as with any other code reuse
question. Reuse can be a great productivity enhancer when the right
tools and libraries are available, or it can be a pain in the arse when
they aren't.
--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Mar 5 '07 #3
So schemas allow you to incorporate different namespaces, but DTD's do
not. That is useful information.

I'll try it out.

rj

On Mar 5, 9:21 am, Joseph Kesselman <keshlam-nos...@comcast.net>
wrote:
idiotprogrammer wrote:
is it better to try to embed one flavor of xml within another? Or is
better to create a custom xml/schema that takes into account your
unique situation?

It Depends.

If there's an XML-based and moderately-well-standardized language which
naturally describes what you want to describe, you probably don't want
to reinvent the wheel. One of the purposes of namespaces is specifically
to allow independently-developed grammars to be intermixed without the
risk of their trying to assign conflicting meanings to the same tokens.
(Note, however, that DTDs are inherently incompatable with namespaces;
if you want to do modern XML design you're sorta forced toward XML
Schemas... or toward one of their less-standard competetors)

On the other hand, if there isn't an existing language which is a good
fit, or if you don't trust the one you've found to be stable enough for
your needs, or if has features which would constitute a security risk in
your environment, you may want to reimplement and make that part of your
own custom grammar. As suggested above, the lack of namespace support in
DTDs makes collisions more common and is more likely to force
reimplementation as a result.

In other words, it's the same answer as with any other code reuse
question. Reuse can be a great productivity enhancer when the right
tools and libraries are available, or it can be a pain in the arse when
they aren't.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden

Mar 5 '07 #4
idiotprogrammer wrote:
So schemas allow you to incorporate different namespaces, but DTD's do
not.
DTDs basically don't support namespaces at all. The best you can do with
a DTD is force specific prefix bindings and/or the default namespace.

I agree that schemas are harder to learn than DTDs. Unfortunately, I
really think DTDs are reaching the end of their useful lifespan.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Mar 5 '07 #5

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

Similar topics

5
by: gwarning! | last post by:
Goal: Have multiple text files, each of various lengths, be concatenated together into one final consolidated text file. Problem: Since the names of the files to be concatenated can change from...
3
by: Dave | last post by:
I need to concatenate serveral text files into a larger file. I borrowed some code and patched together a batch file that runs in the command processor and looks like this: echo off chdir...
14
by: J.S. | last post by:
In a Windows Form application, which is the better method to concatenate large blocks of code? 1. Reading the text from text files. 2. Adding the text to the VB file itself? Thanks! J.S. ...
4
by: Wladimir Borsov | last post by:
Ok, think of let say 10 different web pages on the internet. Each of them are usual html web pages. Nothing special. What I want to do now is to create a new meta resp. grouping web page which...
1
by: sham | last post by:
Hi to all, Is it possible with the .net framework to concatenate xml files? I have a number of xml files on disk and want to create one file which will have the format : <files> <file...
2
by: ffimbel | last post by:
Hi, I would like to find out the fastest way to concatenate large (200 or 300MB) and numerous (500 - 700) files (Postscript files) into a single one (which can ends up being several GigaB)...
3
by: alice | last post by:
I've been trying for a long time to figure this out, to have a page with several MP3 clips, and each one having a custom start and stop button next to them to play the track. I finally found a bit...
1
by: kgk | last post by:
I would like to concatenate several file-like objects to create a single file-like object. I've looked at fileinput, however this returns a fileinput object that is not very file-like. ...
2
by: Bint | last post by:
is there any way to concatenate files in PHP? thanks B
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:
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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...

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.