Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > How to mix use namespace and DTD?

Reply
Thread Tools

How to mix use namespace and DTD?

 
 
jacksu
Guest
Posts: n/a
 
      03-03-2008
I need namespace because I need to define other namespace ("http://
www.springframework.org/schema/aop") within root name space "http://
www.springframework.org/schema/beans").

and at the same time, I need entity feature in DTD, so that I could
use "entity" function to separate xml files into several pieces.

Here is what I am struggling with:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
"http://www.springframework.org/dtd/spring-beans-2.0.dtd" [
<!ENTITY module1 SYSTEM "module1.inc">
<!ENTITY module2 SYSTEM "module2.inc">
]>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlnssi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schem...-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"
>

 
Reply With Quote
 
 
 
 
Joseph Kesselman
Guest
Posts: n/a
 
      03-03-2008
With great difficulty. Namespaces were designed with the knowledge that
they would be largely incompatable with DTDs.

Switch to XML Schema. Or accept a lot of pain. See past discussion in
this newsgroup and on various websites.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
 
Reply With Quote
 
 
 
 
Richard Tobin
Guest
Posts: n/a
 
      03-03-2008
In article <47cc55fd$1@kcnews01>,
Joseph Kesselman <(E-Mail Removed)> wrote:

>With great difficulty. Namespaces were designed with the knowledge that
>they would be largely incompatable with DTDs.


DTDs themselves are not incompatible with namespaces. DTD validity
and other aspects of element and attribute declarations are hard to
combine with namespaces. But if you just want some entity
declarations, it shouldn't be a problem. Just don't try to validate,
and don't bother declaring anything except the entities.

This is a perfectly well-formed document entity:

<!DOCTYPE dummy [
<!ENTITY ent SYSTEM "ent.xml">
]>
<bar>&ent;</bar>

You don't even have to get the root element name right in the DOCTYPE
statement.

-- Richard
--
:wq
 
Reply With Quote
 
Joseph Kesselman
Guest
Posts: n/a
 
      03-03-2008
Richard Tobin wrote:
> DTDs themselves are not incompatible with namespaces. DTD validity
> and other aspects of element and attribute declarations are hard to
> combine with namespaces.


I agree, that's a better phrasing. Sorry; explain this a few hundred
times and it's too easy to start firing off the standard brain-dump
without reading carefully enough.

I still suggest moving to a Schema environment plus XInclude or
something like that -- among other things, XInclude is namespace-aware
and thus will properly preserve namespaces when assembling a composite
document, rather than having the risk that a default attribute
declaration or something of that sort will produce a different meaning
than you intended.


--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
 
Reply With Quote
 
Peter Flynn
Guest
Posts: n/a
 
      03-03-2008
Joseph Kesselman wrote:
> With great difficulty. Namespaces were designed with the knowledge that
> they would be largely incompatible with DTDs.
>
> Switch to XML Schema. Or accept a lot of pain.


'and', not 'or'

///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
Mix different enctypes and use one single request type? Jimi HullegŚrd Java 0 06-22-2005 03:28 PM
Can I use OODoc to create a paragraph with a mix of bold and normal text? Dave Perl Misc 2 06-01-2005 07:02 PM
use constant and BEGIN don't mix? J Krugman Perl Misc 3 05-01-2004 08:42 AM
Help:Why can't I use namespace System.Web? It is said that this namespace doesn't exist. But it should exist. »żĻ‚ ASP .Net 1 07-29-2003 04:31 PM



Advertisments