DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2010
    Posts
    2

    SAX - missing element in XML document

    Hello,
    I have a question. Here is simple SAX Java example: http://www.roseindia.net/xml/sax/EmployeeDetails.shtml
    The XML file contains Employees (with Emp_Id, Emp_Name and Emp_E-mail). I have situation when for example Emp_Name element is missing. Is it possible find out in Java console please?

    I tried this:
    Code:
    if (name){
       System.out.println("Name:   " + str);
       name = false;
    }
    else
    {
       System.out.println("Name is missing");
    }
    But this solution writes "Name is missing" every time. Thank you very much, best regards Tomas

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,649
    If the element is missing, isn't is supposed to print that out?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Sep 2010
    Posts
    2
    Hi Hack,
    I need save the XML data to CSV file and missing element = null value

Similar Threads

  1. Replies: 1
    Last Post: 09-08-2008, 11:53 AM
  2. Parsing an XML document using SAX API
    By river22_34 in forum XML
    Replies: 3
    Last Post: 02-03-2008, 05:12 AM
  3. XML Security
    By HSIN NING in forum Web
    Replies: 0
    Last Post: 08-21-2000, 12:21 AM
  4. XML Security
    By HSIN NING in forum XML
    Replies: 0
    Last Post: 08-21-2000, 12:17 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links