You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by 林 昌紀 <ha...@necst.nec.co.jp> on 2009/04/16 10:50:01 UTC

Duplicate "xmlns" attributes

Hello,

I encountered a suspicious phenomenon of Xalan-j 2.7.1.
When I parsed the XML below with Xalan-j 2.7.1, using getAttributes 
method of Node A, I got 2 "xmlns" attributes in the result.
There should be only 1 "xmlns" attribute in the result, I suppose.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE A [
	<!ATTLIST A xmlns CDATA #FIXED 'http://test.xmlns.com/test#'>
]>
<A>
  <A1>test</A1>
</A>

For example, if I build and run the attached program (Test.java), 
I get the result below. (2 xmlns attributes)

Attr 0:
 NodeName  = xmlns
 NodeValue = http://test.xmlns.com/test#
 NameSpace = http://www.w3.org/2000/xmlns/
Attr 1:
 NodeName  = xmlns
 NodeValue = http://test.xmlns.com/test#
 NameSpace = null

But expected result is:

Attr 0:
 NodeName  = xmlns
 NodeValue = http://test.xmlns.com/test#
 NameSpace = http://www.w3.org/2000/xmlns/

This problem occurred only when I use Xalan-j 2.7.1.
When I use Xalan-j 2.7.0, this problem never occurs.

Is there anyone who knows about this problem?
Is there any workaround?

I have attached the sample program and the XML file.
(Please add the path of xalan.jar(2.7.1) to CLASSPATH.)

My test environment is below:
  Java : jdk1.6.0 update 12
  Xalan: Xalan-j 2.7.1 (Xerces 2.9.0)
  OS   : Windows XP

Thanks,
Masanori Hayashi

---
Masanori Hayashi <ha...@necst.nec.co.jp>



Re: Duplicate "xmlns" attributes

Posted by Masanori Hayashi <ha...@necst.nec.co.jp>.

> Your code appears to be using only the Xerces XML parser, not the Xalan 
> XPath/XSLT processor.  To get help with it, your best best is to as over 
> in the Xerces users list.
> 
> Before doing so, you may want to make very sure that you're using a 
> current version of Xerces, since I find it very hard to believe that this 
> bug would be present in current code.
> 

Thank you for your kind advice.
I'll investigate this problem with the latest Xerces.

Thanks,
Masanori Hayashi

> 
> 
> ______________________________________
> "... Three things see no end: A loop with exit code done wrong,
> A semaphore untested, And the change that comes along. ..."
>   -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish (
> http://www.ovff.org/pegasus/songs/threes-rev-11.html)


Re: Duplicate "xmlns" attributes

Posted by ke...@us.ibm.com.
Your code appears to be using only the Xerces XML parser, not the Xalan 
XPath/XSLT processor.  To get help with it, your best best is to as over 
in the Xerces users list.

Before doing so, you may want to make very sure that you're using a 
current version of Xerces, since I find it very hard to believe that this 
bug would be present in current code.



______________________________________
"... Three things see no end: A loop with exit code done wrong,
A semaphore untested, And the change that comes along. ..."
  -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish (
http://www.ovff.org/pegasus/songs/threes-rev-11.html)

Re: Duplicate "xmlns" attributes

Posted by 林 昌紀 <ha...@necst.nec.co.jp>.
Hi Michael,

I'm Sorry, I forgot to attach the related files.
I have attached them.

Thanks.

---
Masanori Hayashi <ha...@necst.nec.co.jp>

> Hello,
> 
> Your post doesn't have the test program you mentioned. Perhaps you forgot
> to attach it?
> 
> Thanks.
> 
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
> 
> 林 昌紀 <ha...@necst.nec.co.jp> wrote on 04/16/2009 04:50:01 AM:
> 
> >
> > Hello,
> >
> > I encountered a suspicious phenomenon of Xalan-j 2.7.1.
> > When I parsed the XML below with Xalan-j 2.7.1, using getAttributes
> > method of Node A, I got 2 "xmlns" attributes in the result.
> > There should be only 1 "xmlns" attribute in the result, I suppose.
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE A [
> >    <!ATTLIST A xmlns CDATA #FIXED 'http://test.xmlns.com/test#'>
> > ]>
> > <A>
> >   <A1>test</A1>
> > </A>
> >
> > For example, if I build and run the attached program (Test.java),
> > I get the result below. (2 xmlns attributes)
> >
> > Attr 0:
> >  NodeName  = xmlns
> >  NodeValue = http://test.xmlns.com/test#
> >  NameSpace = http://www.w3.org/2000/xmlns/
> > Attr 1:
> >  NodeName  = xmlns
> >  NodeValue = http://test.xmlns.com/test#
> >  NameSpace = null
> >
> > But expected result is:
> >
> > Attr 0:
> >  NodeName  = xmlns
> >  NodeValue = http://test.xmlns.com/test#
> >  NameSpace = http://www.w3.org/2000/xmlns/
> >
> > This problem occurred only when I use Xalan-j 2.7.1.
> > When I use Xalan-j 2.7.0, this problem never occurs.
> >
> > Is there anyone who knows about this problem?
> > Is there any workaround?
> >
> > I have attached the sample program and the XML file.
> > (Please add the path of xalan.jar(2.7.1) to CLASSPATH.)
> >
> > My test environment is below:
> >   Java : jdk1.6.0 update 12
> >   Xalan: Xalan-j 2.7.1 (Xerces 2.9.0)
> >   OS   : Windows XP
> >
> > Thanks,
> > Masanori Hayashi
> >
> > ---
> > Masanori Hayashi <ha...@necst.nec.co.jp>

Re: Duplicate "xmlns" attributes

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hello,

Your post doesn't have the test program you mentioned. Perhaps you forgot
to attach it?

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

林 昌紀 <ha...@necst.nec.co.jp> wrote on 04/16/2009 04:50:01 AM:

>
> Hello,
>
> I encountered a suspicious phenomenon of Xalan-j 2.7.1.
> When I parsed the XML below with Xalan-j 2.7.1, using getAttributes
> method of Node A, I got 2 "xmlns" attributes in the result.
> There should be only 1 "xmlns" attribute in the result, I suppose.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE A [
>    <!ATTLIST A xmlns CDATA #FIXED 'http://test.xmlns.com/test#'>
> ]>
> <A>
>   <A1>test</A1>
> </A>
>
> For example, if I build and run the attached program (Test.java),
> I get the result below. (2 xmlns attributes)
>
> Attr 0:
>  NodeName  = xmlns
>  NodeValue = http://test.xmlns.com/test#
>  NameSpace = http://www.w3.org/2000/xmlns/
> Attr 1:
>  NodeName  = xmlns
>  NodeValue = http://test.xmlns.com/test#
>  NameSpace = null
>
> But expected result is:
>
> Attr 0:
>  NodeName  = xmlns
>  NodeValue = http://test.xmlns.com/test#
>  NameSpace = http://www.w3.org/2000/xmlns/
>
> This problem occurred only when I use Xalan-j 2.7.1.
> When I use Xalan-j 2.7.0, this problem never occurs.
>
> Is there anyone who knows about this problem?
> Is there any workaround?
>
> I have attached the sample program and the XML file.
> (Please add the path of xalan.jar(2.7.1) to CLASSPATH.)
>
> My test environment is below:
>   Java : jdk1.6.0 update 12
>   Xalan: Xalan-j 2.7.1 (Xerces 2.9.0)
>   OS   : Windows XP
>
> Thanks,
> Masanori Hayashi
>
> ---
> Masanori Hayashi <ha...@necst.nec.co.jp>