We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

parsing xml (SAX) problem

static86
static86 asked
on
Medium Priority
283 Views
Last Modified: 2012-05-11
Hi,
I'm trying to get value type of Employee but it seem like the startElement([..]) is not read ("aaaa" is not printed).

SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();

              sp.parse("http://www.totheriver.com/learn/xml/code/employees.xml", this);

----------------------
public void startElement(String uri, String localName, String qName,
            Attributes attributes) throws SAXException {
        //reset
            System.out.println("aaaaa");

       if(qName.equalsIgnoreCase("Employee")) {
   
           String s = attributes.getValue("type").toString();
            System.out.println(attributes.getValue("type"));

        }
    }

Open in new window


Comment
Watch Question

Awarded 2011
Awarded 2011
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
Thanks, it worked! I it was, probably the matter of imports.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.