• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • Last Modified:

Expat and XML

I can't seem to parse an XML file with an empty tag. I have the sample xml file:

   <Math subject = "calculus" />

I wanted to parse it like this:
Name   : result
Value   : 90/100  
Attribute: ""

Name   : Math
Value   : ""
Attribute: calculus

I have parsed the result tag but I can't seem to parse the empty tag with EXPAT. Can anybody please help me?
1 Solution
I guess your CharacterDataHandler doesn't work in second case.
Solution will be simple: CharacterDataHandler only appends data to internal buffer; StartElementHandler initialize that buffer to empty string, stores name and attribute; EndElementHandler displays everything: "Name", "Value" (from string buffer) and "Attribute"
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now