Search code examples
xmloracle11gxsdsoabpel

How to refer to a complex type in XML schema with no targetNamespace


At the moment, I'm implementing a number of interfaces to consume XML data from external systems. The data I'm supposed to receive are all well-formed XML documents. However, the problem is that they all come without namespaces like the sample below.

<ReturnOfFileApplicationDetails>
   <ApplicationNo>APP-2015-1214-000847</ApplicationNo>
   <CourtOrderRefNo></CourtOrderRefNo>
   <SourceRequestNo></SourceRequestNo>
   <Status>A</Status>
   <RejectionReason></RejectionReason>
   <CourtEventDetails>
      <NextCourtNo>26</NextCourtNo>
      <NextCourtDateTime>201601111500</NextCourtDateTime>
      <NextCourtJOName></NextCourtJOName>
   </CourtEventDetails>
   <IODetails>
      <Name>CPIB IO</Name>
      <Designation>Special Investigation Officer</Designation>
      <DivisionAgency>CPIB</DivisionAgency>
      <ReportNo></ReportNo>
      <IPNo></IPNo>
   </IODetails>
</ReturnOfFileApplicationDetails>

Hence, from what I've learnt so far, I cannot use targetNamespace in the XSD schema I built to describe those data. For example, below is the XSD I created for the above payload.

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns="http://oscar.pactera.com/icms/schema">
    <xsd:include schemaLocation="CourtEvent.xsd"/>
    <xsd:include schemaLocation="InvestigationOfficer.xsd"/>

    <xsd:complexType name="FileApplication">
        <xsd:sequence>
            <xsd:element name="ApplicationNo" type="xsd:string" minOccurs="0" nillable="true"/>
            <xsd:element name="ApplicationType" type="xsd:string" minOccurs="0" nillable="true"/>
            <xsd:element name="CourtOrderRefNo" type="xsd:string" minOccurs="0" nillable="true"/>
            <xsd:element name="SourceRequestNo" type="xsd:string" minOccurs="0" nillable="true"/>
            <xsd:element name="CaseNo" type="xsd:string" minOccurs="0" nillable="true"/>
            <xsd:element name="Status" type="xsd:string" minOccurs="0" nillable="true"/>
            <xsd:element name="RejectionCode" type="xsd:string" minOccurs="0" nillable="true"/>
            <xsd:element name="RejectionReason" type="xsd:string" minOccurs="0" nillable="true"/>

            <xsd:element name="CourtEventDetails" type="CourtEvent" minOccurs="0" maxOccurs="1"/>
            <xsd:element name="IODetails" type="InvestigationOfficer" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="ReturnOfFileApplicationDetails" type="FileApplication"/>
</xsd:schema>

The problem I have now is that my IDE is complaining that it cannot find the complex type FileApplication I put in for the ReturnOfFileApplicationDetails element the even though they are literally in the same XSD. Since the CourtEvent.xsd and the InvestigationOfficer.xsd also come with no targetNamespace, my IDE cannot find the CourtEvent and the InvestigationOfficer complex types as well.

I'd be very grateful if you could show me I properly build my XSD without targetNamespace.

Cheers,

James Tran


Solution

  • You need to remove the default namespace declaration

    xmlns="http://oscar.pactera.com/icms/schema"