dcsimg
Sax Parser: cannot store attributes!?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   mc71_mc71
Posted On:   Thursday, February 20, 2003 12:40 AM

Hi,


I am a newbie to Java and Xml. I have problems in saving the attributes after the callback to the startElement method has been done:



public void startElement(String uri, String localName, String qName, Attributes atts)


Attributes lastatts = atts; <--- This won't work


How can I copy the contents of atts? Do I have to clone? if yes can you show me the implementation. Thanks



mc71

Re: Sax Parser: cannot store attributes!?

Posted By:   Bahman_Barzideh  
Posted On:   Thursday, February 20, 2003 05:34 AM

process your attributes in the call. something like:

if (attributes != null) {
for (int cnt = 0; cnt < attributes.getLength (); cnt++) {
String attributeName = attributes.getQName (cnt);
String attributeValue = attributes.getValue (cnt);
do something with attributeName and attributeValue
}
}
About | Sitemap | Contact