Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Element Type not declared

Status
Not open for further replies.

tinac99

Programmer
Jan 17, 2002
58
US
Hi,

I have the following xml file:
xml filename: ise_1.xml
-----------------------
<?xml version="1.0" encoding="UTF-8"?>
<UnavailableSchedules>
<UnavailableSchedule ReasonCode="V">
<OrganizationAgencyName>ANAHEIM POLICE DEPT.</OrganizationAgencyName>
<IdentificationID>#1</IdentificationID>
<PersonGivenName>NANCY</PersonGivenName>
<PersonSurName>CARPIO</PersonSurName>
<StartDate>05/1/2008</StartDate>
<EndDate>2008-05-02</EndDate>
</UnavailableSchedule>
</UnavailableSchedules>

In my java file, I have:

import org.jdom.* ;
import org.jdom.input.*;
import org.jdom.output.* ;

import java.io.Reader;
import java.io.StringReader;

import java.util.*;
import java.io.*;

import java.io.InputStream;

public class OfficerUnavailabilityWebServiceClient
{
public static void run(StringBuilder sb)
{
try
{
SAXBuilder builder = new SAXBuilder(true);
Document doc = builder.build(new File("C:\\ise_1.xml"));

Element root = doc.getRootElement();
}
catch (Throwable t)
{
System.out.print("inside catch Throwable:" + t );
}
}

}

----------------------------------

The code is generating an error on the build, stating:
inside catch Throwable: org.jdom.JDOMException: Error on line 2 of doucment file:/C:/ise_1.xml: Element type "UnavailableSchedules" is not declared.

I'm using Java 1.6 and Eclipse 3.1.2.

Please help.
 
I'd try turning off validation, i.e., passig a false value to the constructor.

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top