XML-0108: (Fatal Error) Start of root element expected.

Posted on 2005-03-01
Medium Priority
Last Modified: 2011-10-03
i ahve a oracle data base
i am trying to Load XMl into the Database

This is my program

import java.sql.*;
import oracle.xml.sql.dml.OracleXMLSave;
import java.util.*;
import oracle.jdbc.driver.*;

public class testInsert
   public static void main(String argv[])
     throws SQLException
     DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
     Connection con = DriverManager.getConnection("jdbc:oracle:thin:@DLS702:1521:OMS", "scott", "tiger");
     OracleXMLSave sav = new OracleXMLSave(con, "emp");

this is the xml
<?xml version="1.0" >
   <ROW num="1">
      <HIREDATE>6/9/1981 0:0:0</HIREDATE>
   <ROW num="2">
      <HIREDATE>11/17/1981 0:0:0</HIREDATE>
   <ROW num="3">
      <HIREDATE>1/23/1982 0:0:0</HIREDATE>

how ever when i run it i get this error
<Line 1, Column 1>: XML-0108: (Fatal Error) Start of root element expected.
Exception in thread "main" oracle.xml.sql.OracleXMLSQLException: Start of root element expected.
        at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:2204)
        at oracle.xml.sql.dml.OracleXMLSave.insertXML(OracleXMLSave.java:1276)
        at testInsert.main(testInsert.java:14)

what could be the reason and if any solution?
Question by:violet1306
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
  • 2
  • 2
LVL 27

Expert Comment

ID: 13439365
I don't know if this is a question typo but :-

<?xml version="1.0" >

should read :-

<?xml version="1.0"?>

Note the second question mark.

Author Comment

ID: 13446681
i tried  this , it didn't work  ?

is it because of the oracle version that i am using?
LVL 27

Accepted Solution

BigRat earned 500 total points
ID: 13448171
Ooops, missed it first time round.

The method insertXML with a *string* parameter expects an XML document in the string. The overloaded insertXML method does NOT take a filename. You must create a java.io.InputStream object and pass that instead.

Author Comment

ID: 13456090
thanx it worked

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Make the most of your online learning experience.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses
Course of the Month7 days, 20 hours left to enroll

765 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