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 Masanori Hayashi <ha...@necst.nec.co.jp> on 2009/04/20 11:05:32 UTC

Duplicate "xmlns" attributes

Hello,

I encountered a suspicious phenomenon of Xerces-J 2.9.1.
When I parsed the XML below with Xerces-J 2.9.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/

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 xercesImpl.jar(2.9.1) and xml-apis.jar(2.9.1) to CLASSPATH.)

My test environment is below:
  Java  : jdk1.6.0 update 12
  Xerces: Xerces-J 2.9.1
  OS    : Windows XP

I had tested this problem with older versions of Xerces, too.
And, I got following results:

Xerces 2.9.1 --> problem occurred
Xerces 2.9.0 --> problem occurred
Xerces 2.8.1 --> problem occurred
Xerces 2.8.0 --> problem not occurred
Xerces 2.7.1 --> problem not occurred

Thanks,
Masanori Hayashi

Re: Duplicate "xmlns" attributes

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

Thank you very much for your help.
All of my issues have been resolved.

Thanks again,
Masanori Hayashi

> Hi Masanori,
> 
> Xalan-J 2.7.x should work with any XML parser that supports at least JAXP
> 1.3. Aside from that it shouldn't matter which version of Xerces you use
> with it. They should all be compatible.
> 
> Thanks.
> 
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
> 
> Masanori Hayashi <ha...@necst.nec.co.jp> wrote on 04/21/2009 12:50:06
> AM:
> 
> > Hi Michael,
> >
> > I tried the latest build of Xerces-J and I got the expected result.
> > Thank you so much!
> >
> > (I found the latest build of Xerces-J on
> > http://vmgump.apache.org/gump/public-jars/xerces/jars/
> > instead of
> > http://vmgump.apache.org/gump/public-jars/xml-xerces2/jars/ .)
> >
> > And I have an another question.
> > I'd like to use the latest build of Xerces-J (or version 2.10.0) with
> > Xalan-J 2.7.1.
> > But I'm worrying if there might be the similar problems.
> > Does the latest Xerces-J support Xalan-J 2.7.1?
> > If you have any information, could you please provide me with it?
> >
> > Thanks,
> > Masanori Hayashi
> >
> >
> > > Hi Masanori,
> > >
> > > This particular issue has already been fixed. It will be in Xerces-J
> > > 2.10.0. If you need something sooner you can try the latest build here
> [1].
> > >
> > > Thanks.
> > >
> > > [1] http://vmgump.apache.org/gump/public-jars/xml-xerces2/jars/
> > >
> > > Michael Glavassevich
> > > XML Parser Development
> > > IBM Toronto Lab
> > > E-mail: mrglavas@ca.ibm.com
> > > E-mail: mrglavas@apache.org
> > >
> > > Masanori Hayashi <ha...@necst.nec.co.jp> wrote on 04/20/2009
> 05:05:32
> > > AM:
> > >
> > > > Hello,
> > > >
> > > > I encountered a suspicious phenomenon of Xerces-J 2.9.1.
> > > > When I parsed the XML below with Xerces-J 2.9.1, using
> > > getAttributesmethod 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/
> > > >
> > > > 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 xercesImpl.jar(2.9.1) and xml-apis.jar(2.9.
> > > > 1) to CLASSPATH.)
> > > >
> > > > My test environment is below:
> > > >   Java  : jdk1.6.0 update 12
> > > >   Xerces: Xerces-J 2.9.1
> > > >   OS    : Windows XP
> > > >
> > > > I had tested this problem with older versions of Xerces, too.
> > > > And, I got following results:
> > > >
> > > > Xerces 2.9.1 --> problem occurred
> > > > Xerces 2.9.0 --> problem occurred
> > > > Xerces 2.8.1 --> problem occurred
> > > > Xerces 2.8.0 --> problem not occurred
> > > > Xerces 2.7.1 --> problem not occurred
> > > >
> > > > Thanks,
> > > > Masanori Hayashi
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> > > > For additional commands, e-mail: j-users-help@xerces.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> > For additional commands, e-mail: j-users-help@xerces.apache.org


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


Re: Duplicate "xmlns" attributes

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

Xalan-J 2.7.x should work with any XML parser that supports at least JAXP
1.3. Aside from that it shouldn't matter which version of Xerces you use
with it. They should all be compatible.

Thanks.

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

Masanori Hayashi <ha...@necst.nec.co.jp> wrote on 04/21/2009 12:50:06
AM:

> Hi Michael,
>
> I tried the latest build of Xerces-J and I got the expected result.
> Thank you so much!
>
> (I found the latest build of Xerces-J on
> http://vmgump.apache.org/gump/public-jars/xerces/jars/
> instead of
> http://vmgump.apache.org/gump/public-jars/xml-xerces2/jars/ .)
>
> And I have an another question.
> I'd like to use the latest build of Xerces-J (or version 2.10.0) with
> Xalan-J 2.7.1.
> But I'm worrying if there might be the similar problems.
> Does the latest Xerces-J support Xalan-J 2.7.1?
> If you have any information, could you please provide me with it?
>
> Thanks,
> Masanori Hayashi
>
>
> > Hi Masanori,
> >
> > This particular issue has already been fixed. It will be in Xerces-J
> > 2.10.0. If you need something sooner you can try the latest build here
[1].
> >
> > Thanks.
> >
> > [1] http://vmgump.apache.org/gump/public-jars/xml-xerces2/jars/
> >
> > Michael Glavassevich
> > XML Parser Development
> > IBM Toronto Lab
> > E-mail: mrglavas@ca.ibm.com
> > E-mail: mrglavas@apache.org
> >
> > Masanori Hayashi <ha...@necst.nec.co.jp> wrote on 04/20/2009
05:05:32
> > AM:
> >
> > > Hello,
> > >
> > > I encountered a suspicious phenomenon of Xerces-J 2.9.1.
> > > When I parsed the XML below with Xerces-J 2.9.1, using
> > getAttributesmethod 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/
> > >
> > > 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 xercesImpl.jar(2.9.1) and xml-apis.jar(2.9.
> > > 1) to CLASSPATH.)
> > >
> > > My test environment is below:
> > >   Java  : jdk1.6.0 update 12
> > >   Xerces: Xerces-J 2.9.1
> > >   OS    : Windows XP
> > >
> > > I had tested this problem with older versions of Xerces, too.
> > > And, I got following results:
> > >
> > > Xerces 2.9.1 --> problem occurred
> > > Xerces 2.9.0 --> problem occurred
> > > Xerces 2.8.1 --> problem occurred
> > > Xerces 2.8.0 --> problem not occurred
> > > Xerces 2.7.1 --> problem not occurred
> > >
> > > Thanks,
> > > Masanori Hayashi
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> > > For additional commands, e-mail: j-users-help@xerces.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org

Re: Duplicate "xmlns" attributes

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

I tried the latest build of Xerces-J and I got the expected result.
Thank you so much!

(I found the latest build of Xerces-J on
http://vmgump.apache.org/gump/public-jars/xerces/jars/
instead of
http://vmgump.apache.org/gump/public-jars/xml-xerces2/jars/ .)

And I have an another question.
I'd like to use the latest build of Xerces-J (or version 2.10.0) with 
Xalan-J 2.7.1.
But I'm worrying if there might be the similar problems.
Does the latest Xerces-J support Xalan-J 2.7.1?
If you have any information, could you please provide me with it?

Thanks,
Masanori Hayashi


> Hi Masanori,
> 
> This particular issue has already been fixed. It will be in Xerces-J
> 2.10.0. If you need something sooner you can try the latest build here [1].
> 
> Thanks.
> 
> [1] http://vmgump.apache.org/gump/public-jars/xml-xerces2/jars/
> 
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
> 
> Masanori Hayashi <ha...@necst.nec.co.jp> wrote on 04/20/2009 05:05:32
> AM:
> 
> > Hello,
> >
> > I encountered a suspicious phenomenon of Xerces-J 2.9.1.
> > When I parsed the XML below with Xerces-J 2.9.1, using
> getAttributesmethod 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/
> >
> > 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 xercesImpl.jar(2.9.1) and xml-apis.jar(2.9.
> > 1) to CLASSPATH.)
> >
> > My test environment is below:
> >   Java  : jdk1.6.0 update 12
> >   Xerces: Xerces-J 2.9.1
> >   OS    : Windows XP
> >
> > I had tested this problem with older versions of Xerces, too.
> > And, I got following results:
> >
> > Xerces 2.9.1 --> problem occurred
> > Xerces 2.9.0 --> problem occurred
> > Xerces 2.8.1 --> problem occurred
> > Xerces 2.8.0 --> problem not occurred
> > Xerces 2.7.1 --> problem not occurred
> >
> > Thanks,
> > Masanori Hayashi
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> > For additional commands, e-mail: j-users-help@xerces.apache.org


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


Re: Duplicate "xmlns" attributes

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

This particular issue has already been fixed. It will be in Xerces-J
2.10.0. If you need something sooner you can try the latest build here [1].

Thanks.

[1] http://vmgump.apache.org/gump/public-jars/xml-xerces2/jars/

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

Masanori Hayashi <ha...@necst.nec.co.jp> wrote on 04/20/2009 05:05:32
AM:

> Hello,
>
> I encountered a suspicious phenomenon of Xerces-J 2.9.1.
> When I parsed the XML below with Xerces-J 2.9.1, using
getAttributesmethod 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/
>
> 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 xercesImpl.jar(2.9.1) and xml-apis.jar(2.9.
> 1) to CLASSPATH.)
>
> My test environment is below:
>   Java  : jdk1.6.0 update 12
>   Xerces: Xerces-J 2.9.1
>   OS    : Windows XP
>
> I had tested this problem with older versions of Xerces, too.
> And, I got following results:
>
> Xerces 2.9.1 --> problem occurred
> Xerces 2.9.0 --> problem occurred
> Xerces 2.8.1 --> problem occurred
> Xerces 2.8.0 --> problem not occurred
> Xerces 2.7.1 --> problem not occurred
>
> Thanks,
> Masanori Hayashi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org