Solved

Expat and XML

Posted on 2004-04-22
3
219 Views
Last Modified: 2013-11-19
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
Comment
Question by:daljv
3 Comments
 
LVL 10

Accepted Solution

by:
Yury_Delendik earned 500 total points
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
c#, split 12 77
Problem to event 3 47
XSLT: how to increment number value if attribute present 4 24
c# code 19 56
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now