Solved

Expat and XML

Posted on 2004-04-22
3
221 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
ID: 10889287
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

920 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

14 Experts available now in Live!

Get 1:1 Help Now