You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Peter Len <pe...@earthlink.net> on 2004/11/10 18:46:16 UTC

XmlObject.Factory.parse(myXSDFile) error

Hello,

I was trying to get an instance of a SystemTypeSchema using the example 
code in the API:

SchemaTypeSystem sts = XmlBeans.compileXsd(new XmlObject[]
    { XmlObject.Factory.parse(myXSDFile) },
    XmlBeans.getBuiltinTypeSystem(),
    null);

However, the operation "XmlObject.Factory.parse(myXSDFile)" is throwing the error: 
       org.apache.xmlbeans.XmlException: error: Document root element is missing.

Not sure why this is happening.  The XSD file itself looks fine and is valid in XMLSpy so I don't know what I am missing. 

In trying to debug this I loaded my xsd file in a Dom4j parser.  Dom4j didn't have any problems loading the
document (reading the XSD file as XML) and listing 'schema' as the root element. 

Below is the contents of the xsd file:

<?xml version="1.0" encoding="UTF-8" ?>
- 
<mailbox:///C%7C/DOCUMENTS%20AND%20SETTINGS/PLEN/APPLICATION%20DATA/Mozilla/Profiles/default/l7ews7wm.slt/Mail/pop.earthlink.net/Inbox?number=46999930#> 
<xs:schema targetNamespace="urn:monitor.ia.vkb.dia.mil" 
elementFormDefault="qualified" attributeFormDefault="unqualified" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns="urn:monitor.ia.vkb.dia.mil">
- 
<mailbox:///C%7C/DOCUMENTS%20AND%20SETTINGS/PLEN/APPLICATION%20DATA/Mozilla/Profiles/default/l7ews7wm.slt/Mail/pop.earthlink.net/Inbox?number=46999930#> 
<xs:element name="Document" type="DocumentType">
- 
<mailbox:///C%7C/DOCUMENTS%20AND%20SETTINGS/PLEN/APPLICATION%20DATA/Mozilla/Profiles/default/l7ews7wm.slt/Mail/pop.earthlink.net/Inbox?number=46999930#> 
<xs:annotation>
  <xs:documentation>This is the main area to send a document to the IA 
to be translated into the VKB resource schema as a NEW 
resource.</xs:documentation>
  </xs:annotation>
  </xs:element>
- 
<mailbox:///C%7C/DOCUMENTS%20AND%20SETTINGS/PLEN/APPLICATION%20DATA/Mozilla/Profiles/default/l7ews7wm.slt/Mail/pop.earthlink.net/Inbox?number=46999930#> 
<xs:element name="Translate" type="TranslateType">
- 
<mailbox:///C%7C/DOCUMENTS%20AND%20SETTINGS/PLEN/APPLICATION%20DATA/Mozilla/Profiles/default/l7ews7wm.slt/Mail/pop.earthlink.net/Inbox?number=46999930#> 
<xs:annotation>
  <xs:documentation>This is the main area to send a document of a 
particular schema (DDMS, ICMSP) to be translated into VKB resource web 
service message for a new add or update.</xs:documentation>
  </xs:annotation>
  </xs:element>
- 
<mailbox:///C%7C/DOCUMENTS%20AND%20SETTINGS/PLEN/APPLICATION%20DATA/Mozilla/Profiles/default/l7ews7wm.slt/Mail/pop.earthlink.net/Inbox?number=46999930#> 
<xs:complexType name="DocumentType">
- 
<mailbox:///C%7C/DOCUMENTS%20AND%20SETTINGS/PLEN/APPLICATION%20DATA/Mozilla/Profiles/default/l7ews7wm.slt/Mail/pop.earthlink.net/Inbox?number=46999930#> 
<xs:sequence>
- 
<mailbox:///C%7C/DOCUMENTS%20AND%20SETTINGS/PLEN/APPLICATION%20DATA/Mozilla/Profiles/default/l7ews7wm.slt/Mail/pop.earthlink.net/Inbox?number=46999930#> 
<xs:element name="schema" type="SchemaName">
- 
<mailbox:///C%7C/DOCUMENTS%20AND%20SETTINGS/PLEN/APPLICATION%20DATA/Mozilla/Profiles/default/l7ews7wm.slt/Mail/pop.earthlink.net/Inbox?number=46999930#> 
<xs:annotation>
  <xs:documentation>This represents which schema name that the sent XML 
document is in.</xs:documentation>
  </xs:annotation>
  </xs:element>
- 
<mailbox:///C%7C/DOCUMENTS%20AND%20SETTINGS/PLEN/APPLICATION%20DATA/Mozilla/Profiles/default/l7ews7wm.slt/Mail/pop.earthlink.net/Inbox?number=46999930#> 
<xs:element name="org_name" type="xs:string">
- 
<mailbox:///C%7C/DOCUMENTS%20AND%20SETTINGS/PLEN/APPLICATION%20DATA/Mozilla/Profiles/default/l7ews7wm.slt/Mail/pop.earthlink.net/Inbox?number=46999930#> 
<xs:annotation>
  <xs:documentation>The name of the organization making this 
request.</xs:documentation>
  </xs:annotation>
  </xs:element>
  </xs:sequence>
  </xs:complexType>
- 
<mailbox:///C%7C/DOCUMENTS%20AND%20SETTINGS/PLEN/APPLICATION%20DATA/Mozilla/Profiles/default/l7ews7wm.slt/Mail/pop.earthlink.net/Inbox?number=46999930#> 
<xs:complexType name="TranslateType">
- 
<mailbox:///C%7C/DOCUMENTS%20AND%20SETTINGS/PLEN/APPLICATION%20DATA/Mozilla/Profiles/default/l7ews7wm.slt/Mail/pop.earthlink.net/Inbox?number=46999930#> 
<xs:sequence>
- 
<mailbox:///C%7C/DOCUMENTS%20AND%20SETTINGS/PLEN/APPLICATION%20DATA/Mozilla/Profiles/default/l7ews7wm.slt/Mail/pop.earthlink.net/Inbox?number=46999930#> 
<xs:element name="mode" type="ResourceMode" minOccurs="1" 
maxOccurs="unbounded">
- 
<mailbox:///C%7C/DOCUMENTS%20AND%20SETTINGS/PLEN/APPLICATION%20DATA/Mozilla/Profiles/default/l7ews7wm.slt/Mail/pop.earthlink.net/Inbox?number=46999930#> 
<xs:annotation>
  <xs:documentation>This field will indicate whether this translation is 
for a new add, delete, or an update.</xs:documentation>
  </xs:annotation>
  </xs:element>
  </xs:sequence>
  </xs:complexType>
- 
<mailbox:///C%7C/DOCUMENTS%20AND%20SETTINGS/PLEN/APPLICATION%20DATA/Mozilla/Profiles/default/l7ews7wm.slt/Mail/pop.earthlink.net/Inbox?number=46999930#> 
<xs:simpleType name="SchemaName">
- 
<mailbox:///C%7C/DOCUMENTS%20AND%20SETTINGS/PLEN/APPLICATION%20DATA/Mozilla/Profiles/default/l7ews7wm.slt/Mail/pop.earthlink.net/Inbox?number=46999930#> 
<xs:restriction base="xs:string">
  <xs:enumeration value="DDMS" />
  <xs:enumeration value="ICMSP" />
  <xs:enumeration value="ICMSP_metadata" />
  </xs:restriction>
  </xs:simpleType>
- 
<mailbox:///C%7C/DOCUMENTS%20AND%20SETTINGS/PLEN/APPLICATION%20DATA/Mozilla/Profiles/default/l7ews7wm.slt/Mail/pop.earthlink.net/Inbox?number=46999930#> 
<xs:simpleType name="ResourceMode">
- 
<mailbox:///C%7C/DOCUMENTS%20AND%20SETTINGS/PLEN/APPLICATION%20DATA/Mozilla/Profiles/default/l7ews7wm.slt/Mail/pop.earthlink.net/Inbox?number=46999930#> 
<xs:restriction base="xs:string">
  <xs:enumeration value="add" />
  <xs:enumeration value="update" />
  <xs:enumeration value="delete" />
  </xs:restriction>
  </xs:simpleType>
  </xs:schema>
Thoughts?

Thanks - Peter