Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Expat and XML

Posted on 2004-04-22
3
Medium Priority
?
235 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 10

Accepted Solution

by:
Yury_Delendik earned 2000 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

RHCE - Red Hat OpenStack Prep Course

This course will provide in-depth training so that students who currently hold the EX200 & EX210 certifications can sit for the EX310 exam. Students will learn how to deploy & manage a full Red Hat environment with Ceph block storage, & integrate Ceph into other OpenStack service

Question has a verified solution.

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

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
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.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

671 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