You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Juergen Hermann <jh...@web.de> on 2001/03/28 12:18:56 UTC

Problem with validation and namespaces

Hi!

Given these files

==> sample.dtd <==
<?xml version="1.0" encoding="ISO-8859-1"?>
<!ELEMENT spam:sample EMPTY>
<!ATTLIST spam:sample
    xmlns:spam CDATA #FIXED "http://www.cinetic.de/2000/"
>

==> sample.xml <==
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE spam:sample SYSTEM "sample.dtd">
<spam:sample/>

==> sample2.dtd <==
<?xml version="1.0" encoding="ISO-8859-1"?>
<!ELEMENT spam:sample EMPTY>
<!ATTLIST spam:sample xmlns:spam CDATA #REQUIRED>

==> sample2.xml <==
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE spam:sample SYSTEM "sample2.dtd">
<spam:sample xmlns:spam="http://www.cinetic.de/2000/"/>

I get this behaviour (using plain Xerces 1.4):

--> DOMPrint -v=always sample.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
 
<!DOCTYPE spam:sample SYSTEM "sample.dtd">
<spam:sample xmlns:spam="http://www.cinetic.de/2000/"/>
 
--> DOMPrint -v=always -n sample.xml
An error occured during parsing
   Message:

[this is a DOMException : 14 (NAMESPACE_ERR)]

--> DOMPrint -v=always sample2.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
 
<!DOCTYPE spam:sample SYSTEM "sample2.dtd">
<spam:sample xmlns:spam="http://www.cinetic.de/2000/"/>
 
--> DOMPrint -v=always -n sample2.xml
Error at file "/export/home/jhe/tmp/sample2.xml", line 3, column 56
   Message: Required attribute 'xmlns:spam' was not provided
An error occured during parsing


The only way to get this working is to never mention the xmlns:spam 
attribute in the DTD and just use it in the root element. Is this 
what I should expect? AFAIR, the XHTML specs use #FIXED attributes in 
the DTD for the namespace, and that would not work with Xerces.

If it's my fault, then this should go to the FAQ, since the symptom
(DOMException 14) is not helpful in finding the cure.


Ciao, Jürgen

--
Jürgen Hermann, Developer (jhe@webde-ag.de)
WEB.DE AG, http://webde-ag.de/



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Problem with validation and namespaces

Posted by Dean Roddey <dr...@charmedquark.com>.
I'm not sure what's going on there. All of that stuff used to work fine, so
I'm kind of suspicious that perhaps some recent changes to fix something in
attribute handling has broken this. Can someone go back to 1.3 or something
and confirm whether this is broken there? I'm taking a wild guess that it
might work, in which case finding the culprit becomes a diff of the
attribute processing code.

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"I'm not sure how I feel about ambivalence"


----- Original Message -----
From: "Juergen Hermann" <jh...@web.de>
To: "Xerces-C++ Development" <xe...@xml.apache.org>
Sent: Wednesday, March 28, 2001 2:18 AM
Subject: Problem with validation and namespaces


> Hi!
>
> Given these files
>
> ==> sample.dtd <==
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!ELEMENT spam:sample EMPTY>
> <!ATTLIST spam:sample
>     xmlns:spam CDATA #FIXED "http://www.cinetic.de/2000/"
> >
>
> ==> sample.xml <==
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE spam:sample SYSTEM "sample.dtd">
> <spam:sample/>
>
> ==> sample2.dtd <==
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!ELEMENT spam:sample EMPTY>
> <!ATTLIST spam:sample xmlns:spam CDATA #REQUIRED>
>
> ==> sample2.xml <==
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE spam:sample SYSTEM "sample2.dtd">
> <spam:sample xmlns:spam="http://www.cinetic.de/2000/"/>
>
> I get this behaviour (using plain Xerces 1.4):
>
> --> DOMPrint -v=always sample.xml
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <!DOCTYPE spam:sample SYSTEM "sample.dtd">
> <spam:sample xmlns:spam="http://www.cinetic.de/2000/"/>
>
> --> DOMPrint -v=always -n sample.xml
> An error occured during parsing
>    Message:
>
> [this is a DOMException : 14 (NAMESPACE_ERR)]
>
> --> DOMPrint -v=always sample2.xml
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <!DOCTYPE spam:sample SYSTEM "sample2.dtd">
> <spam:sample xmlns:spam="http://www.cinetic.de/2000/"/>
>
> --> DOMPrint -v=always -n sample2.xml
> Error at file "/export/home/jhe/tmp/sample2.xml", line 3, column 56
>    Message: Required attribute 'xmlns:spam' was not provided
> An error occured during parsing
>
>
> The only way to get this working is to never mention the xmlns:spam
> attribute in the DTD and just use it in the root element. Is this
> what I should expect? AFAIR, the XHTML specs use #FIXED attributes in
> the DTD for the namespace, and that would not work with Xerces.
>
> If it's my fault, then this should go to the FAQ, since the symptom
> (DOMException 14) is not helpful in finding the cure.
>
>
> Ciao, Jürgen
>
> --
> Jürgen Hermann, Developer (jhe@webde-ag.de)
> WEB.DE AG, http://webde-ag.de/
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org