Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > how to make use of multiple dtd in a single xml file...

Reply
Thread Tools

how to make use of multiple dtd in a single xml file...

 
 
prasannadhoj@gmail.com
Guest
Posts: n/a
 
      02-24-2007
Dear all,

I am newbie in XML world , and i've an issue, i want to use 3 dtd
files in my xml.
All these 3 dtd have their own root element.

My idea was to keep one file Internal , 2nd one external in main xml
file, and third dtd to call in 2nd dtd using parameterized entity. but
i am not able to do so cause , here the root of all files comes into
picture.? Now, my questions is how to resolve this Root element from
these 3 dtds .
Another issue one of the DTDs have common element , which will makes
me uneasy always "with error DUPLICATE ELEMENT declaration not
allowed? now , xml name space comes into picture, but how do i use it
in my xml along with the dtd?
Any suggestion ,advice will be really appreciate
Thanks in Advance .

keta.

 
Reply With Quote
 
 
 
 
Peter Flynn
Guest
Posts: n/a
 
      02-24-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Dear all,
>
> I am newbie in XML world , and i've an issue, i want to use 3 dtd
> files in my xml.


See the XML FAQ at http://xml.silmaril.ie/developers/dtdincludes/

> All these 3 dtd have their own root element.


There is no problem in a DTD having more than one root element type.
Lots of them do this (DocBook, for example).

> My idea was to keep one file Internal , 2nd one external in main xml
> file, and third dtd to call in 2nd dtd using parameterized entity. but
> i am not able to do so cause , here the root of all files comes into
> picture.? Now, my questions is how to resolve this Root element from
> these 3 dtds .


You will need to parameterize them so that you can turn portions of them
on or off in the internal subset of a document or in an external
"driver" DTD. This is often a non-trivial task and requires some
in-depth knowledge.

> Another issue one of the DTDs have common element , which will makes
> me uneasy always "with error DUPLICATE ELEMENT declaration not
> allowed?


You must arrange things so that this does not happen. Parameterization
is the normal method.

> now , xml name space comes into picture, but how do i use it
> in my xml along with the dtd?


DTDs are not namespace-sensitive. You can sometimes fake it simply by
parameterizing the prefixing of a string plus a colon to element type
declarations, but it's messy.

Why did you want to combine three DTDs? If it's significantly important,
I suggest you rewrite them into one DTD.

///Peter
--
XML FAQ: http://xml.silmaril.ie/
 
Reply With Quote
 
 
 
 
Joe Kesselman
Guest
Posts: n/a
 
      02-24-2007
Peter Flynn wrote:
> DTDs are not namespace-sensitive.


The Namespaces working group looked at what it would take to make DTDs
tolerate that concept and decided there simply was no way to make the
two ideas compatable.

The advice ever since has been: If you care about namespaces, dump DTDs
and switch to XML Schmas (or give up on validation and just use
well-formed docs).

(Schemas also handle mix-and-match/modular language specs a bit more
elegantly than DTDs can.)

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
 
Reply With Quote
 
Peter Flynn
Guest
Posts: n/a
 
      02-24-2007
Joe Kesselman wrote:
> Peter Flynn wrote:
>> DTDs are not namespace-sensitive.

>
> The Namespaces working group looked at what it would take to make DTDs
> tolerate that concept and decided there simply was no way to make the
> two ideas compatible.
>
> The advice ever since has been: If you care about namespaces, dump DTDs
> and switch to XML Schemas (or give up on validation and just use
> well-formed docs).


Personally I'd recommend RelaxNG, from which you can generate both DTD
syntax and Schema syntax. But if the OP is unable to merge three
(unparamaterized) DTDs, I think switching direct to W3C Schemas at too
early a stage is possibly going to cause even more problems. Ultimately
it's understanding the concepts of a hierarchical model which need to be
mastered, and then the syntax you express it in.

///Peter
 
Reply With Quote
 
prasannadhoj@gmail.com
Guest
Posts: n/a
 
      02-27-2007
Thank you, Peter.

As you said in the first reply, i modified the DTD, something like
this, i made 1 dtd file as "a.mod" or "a.ent" and called this file to
"b.dtd" and called in my xml file then declared the third dtd in
internal subset, added one my own Root element and keep all other
roots in my root element, then i validate my xml file with the all the
dtds.It works.

but i've seen and i would like to know why people makes " . ent" or
" .mod" file and though they contains elements, entities,attribute
list etc. just like any other dtd?


Cheer !
Thanks again.

 
Reply With Quote
 
Peter Flynn
Guest
Posts: n/a
 
      03-04-2007
(E-Mail Removed) wrote:
> Thank you, Peter.
>
> As you said in the first reply, i modified the DTD, something like
> this, i made 1 dtd file as "a.mod" or "a.ent" and called this file to
> "b.dtd" and called in my xml file then declared the third dtd in
> internal subset, added one my own Root element and keep all other
> roots in my root element, then i validate my xml file with the all the
> dtds.It works.
>
> but i've seen and i would like to know why people makes " . ent" or
> " .mod" file and though they contains elements, entities,attribute
> list etc. just like any other dtd?


Because they're not "just like any other DTD" -- or at least they
shouldn't be.

Have a look at the .mod files in DocBook, or the .dtd and .ent files
in TEI.

They are essentially fragments which can be combined into a DTD.
IMHO only files which can be used in a SYSTEM identifier should
actually end in .dtd (but others may disagree).

///Peter
 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
XML file from one DTD to another DTD test Java 2 07-28-2006 08:48 PM
How to specify DTD to DTD.getDTD for DocumentParser? Ronald Fischer Java 4 03-17-2005 09:37 AM
Removing the dtd name when using print(...) on the dtd generated class Joseph Tilian Java 0 12-21-2004 02:58 PM
Including a dtd into another dtd... possible? Asfand Yar Qazi XML 1 09-19-2003 12:10 PM



Advertisments