[Home] [By Thread] [By Date] [Recent Entries]

  • To: xml-dev@l...
  • Subject: Question of SAX Fileter
  • From: "Dong ST" <suwater@m...>
  • Date: Mon, 06 Jan 2003 16:21:01 +0800
  • Bcc:

hi,everyone!

I m a newbie of using SAX.I need alter a attribute value use SAX.
Ex. 
the xml document frag is below:

.....
<theElement link ="here"/>
.....

I want to alter the attribute link's value to "there", How can i do
this throw SAX Filter.

I know I can alter a element tage used SAX Filter. Like the code below.
#################################################
public class XFormFilter extends XMLFilterImpl {

  public XFormFilter() {
  }

  public XFormFilter(XMLReader parent)
  {
    super(parent);
  }

  public void startElement (String uri,
                            String localName,
                            String qName,
                            Attributes atts)
      throws SAXException
  {
   if(localName=="theElement"){
       //alter the local name.
       localName ="thatElement";
      }
    }

    super.startElement(uri, localName, qName, atts);
  }
################################################################

someone help me, and thanks in advance.


Jack 




_________________________________________________________________
ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£ http://www.hotmail.com 


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member