Search code examples
javaxml-parsingattributessaxsaxparser

How to clone attributes of a SAX Parser


While using SAX Parser in Java, we have attributes as one of the parameters in the startElement method.

Can someone please let me know how to clone this attributes so that it can be stored in a HashMap<String, Attributes>.


Solution

  • new AttributesImpl(Attributes atts)

    Copy an existing Attributes object. This constructor is especially useful inside a startElement event.