users@jaxb.java.net

SAXParseException: unexpected root element

From: Brad Siegfreid <brad_at_iridiumdesign.com>
Date: Wed, 15 Jan 2003 20:03:34 -0600

Hello all.

This is my first post so please bear with me if this question is
redundant. I've searched the developer forums at java.sun.com and found
others with a similar issue but no answers. After a week of banging my
head I'm turning to you.

I've posted the files I'm working with at:

http://www.iridiumdesign.com/xs/preferences.xsd
http://www.iridiumdesign.com/test/preferences-test.xml

Using the dom.Writer app from the Xerces 2.2.1 sample files I've worked
out (at least I think so) any issues with my schema and xml files. The
file seems to validate from the command line.

However, when I load the files into my web server and start Resin its
showing the following error. I've loaded the latest versions of Xerces
and JAXP and I'm running on Java 1.3.1 on Mac OS X 10.2.3.

org.xml.sax.SAXParseException: unexpected root element pref:preferences
        at
com.sun.xml.bind.unmarshaller.SAXUnmarshallerHandlerImpl.startElement(SA
XUnmarshallerHandlerImpl.java:81)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
Source)
        at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
  Source)
        at
org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scan
RootElementHook(Unknown Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDis
patcher.dispatch(Unknown Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unkno
wn Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at
com.sun.xml.bind.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImp
l.java:139)
        at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmars
hallerImpl.java:129)
        at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmars
hallerImpl.java:166)
        at com.iridiumdesign.ControlServlet.init(ControlServlet.java:85)
        at
com.caucho.server.http.Application.createServlet(Application.java:3103)
        at
com.caucho.server.http.Application.loadServlet(Application.java:3054)
        at
com.caucho.server.http.Application.initServlets(Application.java:1914)
        at com.caucho.server.http.Application.init(Application.java:1827)
        at com.caucho.server.http.VirtualHost.init(VirtualHost.java:720)
        at
com.caucho.server.http.ServletServer.initHosts(ServletServer.java:853)
        at
com.caucho.server.http.ServletServer.initInternal(ServletServer.java:698
)
        at com.caucho.server.http.ServletServer.init(ServletServer.java:509)
        at com.caucho.server.http.ResinServer.init(ResinServer.java:377)
        at com.caucho.server.http.ResinServer.main(ResinServer.java:1137)
        at com.caucho.server.http.HttpServer.main(HttpServer.java:103)
--------------- linked to ------------------
javax.xml.bind.UnmarshalException
  - with linked exception:
[org.xml.sax.SAXParseException: unexpected root element
pref:preferences]
        at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException
(AbstractUnmarshallerImpl.java:284)
        at
com.sun.xml.bind.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImp
l.java:143)
        at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmars
hallerImpl.java:129)
        at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmars
hallerImpl.java:166)
        at com.iridiumdesign.ControlServlet.init(ControlServlet.java:85)
        at
com.caucho.server.http.Application.createServlet(Application.java:3103)
        at
com.caucho.server.http.Application.loadServlet(Application.java:3054)
        at
com.caucho.server.http.Application.initServlets(Application.java:1914)
        at com.caucho.server.http.Application.init(Application.java:1827)
        at com.caucho.server.http.VirtualHost.init(VirtualHost.java:720)
        at
com.caucho.server.http.ServletServer.initHosts(ServletServer.java:853)
        at
com.caucho.server.http.ServletServer.initInternal(ServletServer.java:698
)
        at com.caucho.server.http.ServletServer.init(ServletServer.java:509)
        at com.caucho.server.http.ResinServer.init(ResinServer.java:377)
        at com.caucho.server.http.ResinServer.main(ResinServer.java:1137)
        at com.caucho.server.http.HttpServer.main(HttpServer.java:103)