|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Using JAXP API and SAX parser, how to change an attribute value in an XML file
Hello,
When using JAXP API with SAX parser(xerces), how can I manipulate the XML file? Specifically, how can I change an attribute value of an element? I could reach the element and print its value, but failed to find a method to change it. Can anyone please help me? Thanks in advance. Here is a code fragment.......... ______________________________________________ public void startElement(String namespace, String eleName, String raw, Attributes attributes) throws SAXException{ if(attributes!=null){ for(int i=0;i<attributes.getLength();++i){ if(attributes.getLocalName(i).equals("credrating")){ credrating=attributes.getValue(i); attributes.setValue(); } designation="not good"; if((attributes.getLocalName(i).equals("good"))&&(attributes.getValue(i).equals("Yes"))) designation="good"; } } } } _____________________________________________ I wanted to change the value of the attribute "creditrating" |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Using JAXP API and SAX parser, how to change an attribute value in an XML file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|