Forum Stats

  • 3,767,913 Users
  • 2,252,729 Discussions
  • 7,874,379 Comments

Discussions

Problema ao registrar XML Schema

Samuel Ferraz
Samuel Ferraz Member Posts: 1 Red Ribbon
edited Apr 16, 2018 11:09AM in SQL and PL/SQL (Portuguese)

Bom dia, estou tendo um problema ao registrar um XML Schema (arquivo .xsd) na minha base de dados.

Ao registra-lo ocorre o seguinte erro: ORA-01741: identificador de tamanho zero inválido.

E estou utilizando o .xsd purchaseOrder o qual é exemplificado na documentação da oracle para teste,

O codigo está correto? O mesmo foi feito da seguinte forma:

begin

dbms_xmlschema.registerschema(

schemaURL => 'http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd', 

schemaDoc => '<xs:schema

  targetNamespace="http://xmlns.oracle.com/xdb/documentation/purchaseOrder"

  xmlns:po="http://xmlns.oracle.com/xdb/documentation/purchaseOrder"

  xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">

  <xs:element name="PurchaseOrder" type="po:PurchaseOrderType"/>

    <xs:complexType name="PurchaseOrderType">

      <xs:sequence>

        <xs:element name="Reference" type="po:ReferenceType"/>

        <xs:element name="Actions" type="po:ActionsType"/>

        <xs:element name="Reject" type="po:RejectionType" minOccurs="0"/>

        <xs:element name="Requestor" type="po:RequestorType"/>

        <xs:element name="User" type="po:UserType"/>

        <xs:element name="CostCenter" type="po:CostCenterType"/>

        <xs:element name="ShippingInstructions"

                    type="po:ShippingInstructionsType"/>

        <xs:element name="SpecialInstructions"

                    type="po:SpecialInstructionsType"/>

        <xs:element name="LineItems" type="po:LineItemsType"/>

        <xs:element name="Notes" type="po:NotesType"/>

      </xs:sequence>

    </xs:complexType>

    <xs:complexType name="LineItemsType">

      <xs:sequence>

        <xs:element name="LineItem" type="po:LineItemType"

                    maxOccurs="unbounded"/>

      </xs:sequence>

    </xs:complexType>

    <xs:complexType name="LineItemType">

      <xs:sequence>

        <xs:element name="Description" type="po:DescriptionType"/>

        <xs:element name="Part" type="po:PartType"/>

      </xs:sequence>

      <xs:attribute name="ItemNumber" type="xs:integer"/>

    </xs:complexType>

    <xs:complexType name="PartType">

      <xs:attribute name="Id">

        <xs:simpleType>

          <xs:restriction base="xs:string">

            <xs:minLength value="10"/>

            <xs:maxLength value="14"/>

          </xs:restriction>

        </xs:simpleType>

      </xs:attribute>

      <xs:attribute name="Quantity" type="po:moneyType"/>

      <xs:attribute name="UnitPrice" type="po:quantityType"/>

    </xs:complexType>

    <xs:simpleType name="ReferenceType">

      <xs:restriction base="xs:string">

        <xs:minLength value="18"/>

        <xs:maxLength value="30"/>

      </xs:restriction>

    </xs:simpleType>

    <xs:complexType name="ActionsType">

      <xs:sequence>

        <xs:element name="Action" maxOccurs="4">

          <xs:complexType>

            <xs:sequence>

              <xs:element name="User" type="po:UserType"/>

              <xs:element name="Date" type="po:DateType" minOccurs="0"/>

            </xs:sequence>

          </xs:complexType>

        </xs:element>

      </xs:sequence>

    </xs:complexType>

    <xs:complexType name="RejectionType">

      <xs:all>

        <xs:element name="User" type="po:UserType" minOccurs="0"/>

        <xs:element name="Date" type="po:DateType" minOccurs="0"/>

        <xs:element name="Comments" type="po:CommentsType" minOccurs="0"/>

      </xs:all>

    </xs:complexType>

    <xs:complexType name="ShippingInstructionsType">

      <xs:sequence>

        <xs:element name="name" type="po:NameType" minOccurs="0"/>

        <xs:element name="address" type="po:AddressType" minOccurs="0"/>

        <xs:element name="telephone" type="po:TelephoneType" minOccurs="0"/>

      </xs:sequence>

    </xs:complexType>

    <xs:simpleType name="moneyType">

      <xs:restriction base="xs:decimal">

        <xs:fractionDigits value="2"/>

        <xs:totalDigits value="12"/>

      </xs:restriction>

    </xs:simpleType>

    <xs:simpleType name="quantityType">

      <xs:restriction base="xs:decimal">

        <xs:fractionDigits value="4"/>

        <xs:totalDigits value="8"/>

      </xs:restriction>

    </xs:simpleType>

    <xs:simpleType name="UserType">

      <xs:restriction base="xs:string">

        <xs:minLength value="1"/>

        <xs:maxLength value="10"/>

      </xs:restriction>

    </xs:simpleType>

    <xs:simpleType name="RequestorType">

      <xs:restriction base="xs:string">

        <xs:minLength value="0"/>

        <xs:maxLength value="128"/>

      </xs:restriction>

    </xs:simpleType>

    <xs:simpleType name="CostCenterType">

      <xs:restriction base="xs:string">

        <xs:minLength value="1"/>

        <xs:maxLength value="4"/>

      </xs:restriction>

    </xs:simpleType>

    <xs:simpleType name="VendorType">

      <xs:restriction base="xs:string">

        <xs:minLength value="0"/>

        <xs:maxLength value="20"/>

      </xs:restriction>

    </xs:simpleType>

    <xs:simpleType name="PurchaseOrderNumberType">

      <xs:restriction base="xs:integer"/>

    </xs:simpleType>

    <xs:simpleType name="SpecialInstructionsType">

      <xs:restriction base="xs:string">

        <xs:minLength value="0"/>

        <xs:maxLength value="2048"/>

      </xs:restriction>

    </xs:simpleType>

    <xs:simpleType name="NameType">

      <xs:restriction base="xs:string">

        <xs:minLength value="1"/>

        <xs:maxLength value="20"/>

      </xs:restriction>

    </xs:simpleType>

    <xs:simpleType name="AddressType">

      <xs:restriction base="xs:string">

        <xs:minLength value="1"/>

        <xs:maxLength value="256"/>

      </xs:restriction>

    </xs:simpleType>

    <xs:simpleType name="TelephoneType">

      <xs:restriction base="xs:string">

        <xs:minLength value="1"/>

        <xs:maxLength value="24"/>

      </xs:restriction>

    </xs:simpleType>

    <xs:simpleType name="DateType">

      <xs:restriction base="xs:date"/>

    </xs:simpleType>

    <xs:simpleType name="CommentsType">

      <xs:restriction base="xs:string">

        <xs:minLength value="1"/>

        <xs:maxLength value="2048"/>

      </xs:restriction>

    </xs:simpleType>

    <xs:simpleType name="DescriptionType">

      <xs:restriction base="xs:string">

        <xs:minLength value="1"/>

        <xs:maxLength value="256"/>

      </xs:restriction>

    </xs:simpleType>

    <xs:simpleType name="NotesType">

      <xs:restriction base="xs:string">

        <xs:minLength value="1"/>

        <xs:maxLength value="32767"/>

      </xs:restriction>

    </xs:simpleType>

  </xs:schema>',

       local => TRUE,

       gentypes => TRUE,

       genbean => FALSE,

       force => FALSE);

end;

Tagged: