Why do you need to cast an attribute node to Element?. If you want to change 
the 
value of an attribute you can do it as:

Element element;
....
NamedNodeMap attributes = element.getAttributes();
Node attribute = attributes.getNamedItem("name of attribute to change");
attribute.setNodeValue("new value");

Hope this helps.

Cheers,
Rahul.

> From: Shashank <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> 
> 
> 
> Casting  org.w3c.Node(s) to Element is giving ClassCastException
> 
> If I try printing Class of this Node (which I try casting to type Element)  it
> prints
> 
>  class Type is               org.apache.xerces.dom.DeferredAttrNSImpl
> 
> 
> java.lang.ClassCastException: org.apache.xerces.dom.DeferredAttrNSImpl
> 
> 
> 
> 
> 
> 
> 
> Rahul Srivastava wrote:
> 
> > The attributes of an element node are again  org.w3c.Node(s). So, you can 
use the
> > same set of APIs to modify the attribute as for elements.
> >
> > :-)
> > Cheers,
> > Rahul.
> >
> > > From: Shashank <[EMAIL PROTECTED]>
> > >
> > > Hi !
> > >
> > > I am using xerces parser for parsing XML file and reading and changing
> > > Node value.
> > >
> > > but how to change the attribute of this Node.  I didn't find correct
> > > API.
> > >
> > > I can read the value of Node's attribute, but then how to change this
> > > value.
> > >
> > > take care,
> > > Shashank
> > >
> > > --
> > >
> > > -----------------------------------------------------------
> > > Shashank
> > > iCMG
> > > India Development Center
> > > Millennium Towers
> > > Queens Road, Bangalore - 51
> > > Ph:91-80-286 5620 Fax:91-80-286 5623
> > > -------------------------------------------------------------
> > > Architecting Software Components for EAI
> > >         http://www.iCMGworld.com/
> > > -------------------------------------------------------------
> > > The information transmitted is intended only for the person or entity to
> > >
> > > which it is addressed and may contain confidential and/or privileged
> > > material.  Any review, retransmission, dissemination or other use of, or
> > >
> > > taking of any action in reliance upon, this information by persons or
> > > entities other than the intended recipient is prohibited. If you are not
> > >
> > > the intended recipient, please contact the sender by reply e-mail and
> > > destroy all copies of the original message.
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> 
> --
> 
> -----------------------------------------------------------
> Shashank
> iCMG
> India Development Center
> Millennium Towers
> Queens Road, Bangalore - 51
> Ph:91-80-286 5620 Fax:91-80-286 5623
> -------------------------------------------------------------
> Architecting Software Components for EAI
>         http://www.iCMGworld.com/
> -------------------------------------------------------------
> The information transmitted is intended only for the person or entity to
> which it is addressed and may contain confidential and/or privileged
> material.  Any review, retransmission, dissemination or other use of, or
> taking of any action in reliance upon, this information by persons or
> entities other than the intended recipient is prohibited. If you are not
> the intended recipient, please contact the sender by reply e-mail and
> destroy all copies of the original message.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to