Cannot find declaration of element 'Root' with dbxml

71 Views Asked by At

I'm new to XML. I'm trying to import an XML file but I'm getting an error - "Cannot find declaration of element 'Root'". I suspect it is because the namespace URI (http://xmlns.oracle.com/apps/otm/DBXML) is inactive. I tried going to the URI but it wasn't valid. Since this is where the XML file refers its entities from, I'm guessing an invalid URL means the file cannot find the definition for DBXML. I tried putting another URI, http://www.w3.org/2001/XMLSchema, but it looks like this doesn't support DBXML. What are my options?

XML File

<Root xmlns:dbxml="http://xmlns.oracle.com/apps/otm/DBXML" 
  Version="20C">
<dbxml:TRANSACTION_SET>
    <MX_SHIPMENTS DESCRIPTION="XXX XXX XXX" 
    ORDER_RELEASE_GID="XXX.XXX" 
    LOCATION_GID="XXX.XXX" 
    STOP_NUM="X" 
    ACTIVITY="X" 
    SHIPMENT_GID="XXX.XXX"/>
</dbxml:TRANSACTION_SET>

XML Schema

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dbxml="http://xmlns.oracle.com/apps/otm/DBXML" targetNamespace="http://xmlns.oracle.com/apps/otm/DBXML">
<xs:import schemaLocation="dbxml-response-sample-schema1.xsd"/>
<xs:element name="TRANSACTION_SET">
    <xs:complexType>
        <xs:sequence>
            <xs:element ref="MX_SHIPMENTS" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
</xs:element>
<xs:element name='Root'>
    <xs:complexType>
        <xs:sequence>
            <xs:element ref="dbxml:TRANSACTION_SET"/>
        </xs:sequence>
        <xs:attribute name="Version" type="xs:string"/>
    </xs:complexType>
</xs:element></xs:schema>
1

There are 1 best solutions below

0
On

From my observation, a few things:

  • you have a <Root> at the top, but no </Root> at the bottom.
  • where are you getting these namespaces from, and what is your expectation with them?
  • are you asking dbxml to validate the schema as it's trying to load the data into the database? If not, what exactly are you trying to do here?

My suggestion would be to take out all schema declarations entirely and simply use the XML as you see fit. Schemas are for when you have exact requirements for what the data is supposed to look like - this may be your case, but since you are new to XML I would simply start by using XML without schemas and work your way into schemas as you need to. There are a lot of great resources out there for getting started with schemas, depending on your tool stack.