Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   how to make use of multiple dtd in a single xml file... (http://www.velocityreviews.com/forums/t392878-how-to-make-use-of-multiple-dtd-in-a-single-xml-file.html)

prasannadhoj@gmail.com 02-24-2007 01:40 PM

how to make use of multiple dtd in a single xml file...
 
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.


Peter Flynn 02-24-2007 08:00 PM

Re: how to make use of multiple dtd in a single xml file...
 
prasannadhoj@gmail.com 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/

Joe Kesselman 02-24-2007 09:51 PM

Re: how to make use of multiple dtd in a single xml file...
 
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

Peter Flynn 02-24-2007 10:11 PM

Re: how to make use of multiple dtd in a single xml file...
 
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

prasannadhoj@gmail.com 02-27-2007 04:03 PM

Re: how to make use of multiple dtd in a single xml file...
 
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.


Peter Flynn 03-04-2007 01:20 AM

Re: how to make use of multiple dtd in a single xml file...
 
prasannadhoj@gmail.com 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


All times are GMT. The time now is 02:06 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.