Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 236
  • Last Modified:

Expat and XML

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

<Notes>
<score>
   <result>90/100</result>
   <Math subject = "calculus" />
</score>
</Notes>

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?
0
daljv
Asked:
daljv
1 Solution
 
Yury_DelendikCommented:
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"
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

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