You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Chris Bizon <bi...@webslingerZ.com> on 2002/05/02 21:10:08 UTC

attribute with same name as prefix?

Hi all,

  I'm running into a problem trying to do some validation with xerces
(though this might not actually be a xerces problem).  The problem shows
up when I have an attribute that has the same name as a namespace prefix,
for instance:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo:bar SYSTEM 'bar.dtd'>
<foo:bar foo="fail" xmlns:foo="namespaceURI"/>

with this DTD:

<?xml encoding="UTF-8"?>

<!ELEMENT foo:bar EMPTY>
<!ATTLIST foo:bar
  foo       CDATA #IMPLIED
  xmlns:foo CDATA #IMPLIED
  >

Produces the following error (say by running SAXWriter in 1.4.4)
[Error] bar.xml:4:47: Attribute "xmlns:foo" was already specified for
element "foo:bar".

In 2.0.1 the error is instead
[Fatal Error] bar.xml:4:47: Attribute "foo" bound to namespace "null" was
already specified for element "foo:bar".

It looks like xerces is having trouble distingusing between the two foo
attributes.  While this obviously isn't the clearest way to define our
XML, I thought it was legal.

Any help appreciated,
Chris


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