Associating local copy of xml schema in Workshop

Hi
Every time I open an xml file in xml editor in Weblogic Workshop v 9.2.0 it takes 20 seconds+ to load.. and same to save changes. I believe this is because it is travelling across the internet to download the schemas defined in the xml header
Eg.
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
Is there some way I can tell Workshop that I have local copies of these schema files in the project directory that it can use to validate against so as to avoid this 20 second lag time?
Cheers
Glen

I found there is an XML Catalog section under Preferences -> Web and XML that looks like it might be of use in solving this issue.
I've tried creating User Specified Entries for the schema I believe it is trying to load but it doesn't appear to be making any difference. Can anyone point me to any support notes explaining how this XML Catalog function / dialog box is supposed to be used?
Some other documents suggest that their is an Internet Cache to hold copies of files accessed over the Internet. Does anyone know how I could configure/see where on disk this cache would exist so I can see if the schemas are being cached?
Cheers
Glen

Similar Messages

  • Mapping DTO to XML Schema for Workshop Web Service

    I have a number of DTOs that my application uses. This application
    needs to consume a number of document style web services created in
    workshop. When I generate the proxies for this web service, it creates
    Java beans for the XML schema types defined in the web service.
    Is there a way to get the workshop stubs to map my DTOs to XML schema?
    If not, what is the best way to do this mapping? Thanks.
    Mike

    I have a number of DTOs that my application uses. This application
    needs to consume a number of document style web services created in
    workshop. When I generate the proxies for this web service, it creates
    Java beans for the XML schema types defined in the web service.
    Is there a way to get the workshop stubs to map my DTOs to XML schema?
    If not, what is the best way to do this mapping? Thanks.
    Mike

  • Localized Errors (xerces, xml-schema)

    i would like to get localized error messages (ex. in german) after parsing a xml-schema with the SchemaFactory.
    i've tried out the typical way with "Locale.SetDefault" and e.getLocaleMessage" in a selfwritten ErrorHandler but this doesn't work ...

    i would like to get localized error messages (ex. in
    german) after parsing a xml-schema with the
    SchemaFactory.
    i've tried out the typical way with
    "Locale.SetDefault" and e.getLocaleMessage" in a
    selfwritten ErrorHandler but this doesn't work ...I have the same problem as above. Is there a way to customise schema validation messages?
    example
    cvc-attribute.4: The value ''{2}'' of attribute ''{1}'' on element ''{0}'' is not valid with respect to its fixed '{'value constraint'}'. The attribute must have a value of ''{3}''.
    to become
    Element "{0}" value is invalid. Choose from "{3}".
    thanks

  • How to Update an XML schema..

    Hi All,
    I am new to XML concept. I have a requirement to create a xml schema which will be updated on a weekly basis and a table which associated to the created xml schema.. when ever the Schema is updated the table should not get affected.. Is there a way to solve my problem.. Kindly help me.
    I am using the following client:
    SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jan 31 11:44:59 2011
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    ////////////////////////////////// XML Schema ///////////////////////
    begin
    dbms_xmlschema.registerSchema(
    'http://www.oradev.com/chipsxml1.xsd',
    '<schema xmlns="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.oradev.com/chipsxml1.xsd"
    xmlns:samp="http://www.oradev.com/chipsxml1.xsd"
    version="1.0">
    <element name="HICC">
    <complexType>
    <sequence>
         <element name="UTI">
              <complexType>
              <sequence>
              <element name = "U01" type = "string"/>
              <element name = "U02" type = "string"/>
              <element name = "U03" type = "string"/>
              <element name = "U03a" type = "string"/>
              <element name = "U03b" type = "string"/>
              <element name = "U03c" type = "string"/>          
              <element name = "U04" type = "string"/>                    
              <element name = "U05" type = "string"/>                    
              </sequence>
              </complexType>
         </element>
         <element name="SSI">
              <complexType>
              <sequence>
              <element name = "S01" type = "string"/>
              <element name = "S02" type = "string"/>
              <element name = "S02A" type = "string"/>
              <element name = "S02B" type = "string"/>
              <element name = "S02C" type = "string"/>          
              </sequence>
              </complexType>
         </element>
    </sequence>
    </complexType>
    </element>
    </schema>',
    TRUE, TRUE, FALSE, FALSE);
    end;
    ////////////////////////// Table which has multiple Column //////////////////////////
    CREATE TABLE chipsxmltable2 (
    id number, HICCXMLDATA XmlType)
    XMLTYPE HICCXMLDATA STORE AS OBJECT RELATIONAL
    XMLSCHEMA "http://www.oradev.com/chipsxml1.xsd"
    ELEMENT "HICC";
    ///////////////////////////////// Insert Query in chipsxmltable //////////////////////////
    INSERT INTO chipsxmltable2 VALUES(1,
    xmltype.createxml('<?xml version="1.0"?>
    <samp:HICC xmlns:samp="http://www.oradev.com/chipsxml1.xsd" >
    <UTI>
    <U01>No</U01>
    <U02>Y</U02>
    <U03>Y</U03>
    <U03a>Y</U03a>
    <U03b>Y</U03b>
    <U03c>Y</U03c>     
    <U04>Y</U04>
    <U05>Y</U05>          
    </UTI>
    <SSI>
    <S01>No</S01>
    <S02>Y</S02>
    <S02A>Y</S02A>
    <S02B>Y</S02B>
    <S02C>Y</S02C>
    </SSI>
    </samp:HICC>'));
    //////// This is my Revised XML Schema ///////////////////////
    begin
    dbms_xmlschema.registerSchema(
    'http://www.oradev.com/Rchipsxml1.xsd',
    '<schema xmlns="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.oradev.com/Rchipsxml1.xsd"
    xmlns:samp="http://www.oradev.com/Rchipsxml1.xsd"
    version="1.0">
    <element name="HICC">
    <complexType>
    <sequence>
         <element name="UTI">
              <complexType>
              <sequence>
              <element name = "U01" type = "string"/>
              <element name = "U02" type = "string"/>
              <element name = "U03" type = "string"/>
              <element name = "U03a" type = "string"/>
              <element name = "U03b" type = "string"/>
              <element name = "U03c" type = "string"/>          
              <element name = "U04" type = "string"/>                    
              <element name = "U05" type = "string"/>                    
              </sequence>
              </complexType>
         </element>
    </sequence>
    </complexType>
    </element>
    </schema>',
    TRUE, TRUE, FALSE, FALSE);
    end;
    My question is:
    How to update schema without affecting my table and the data which has already in the table?
    Apologies if the description is not clear. Kindly let me know if further details are needed. Many thanks for your help.
    Very best regards,
    Godwin Jebakumar C.V.
    Thanks in advance,
    Godwin Jebakumar

    Duplicate thread : {thread:id=2171878}
    Please mark this one as "answered".

  • XML Schema Component Naming Convention

    Is there a naming convention when you create an XML Schema? For example,
    When you create a Type component, then the first letter of its name should be upper case ie. BMW, Honda, AutombileEngine ...etc.
    When you create an Element component, then the first letter of its name is lowercase ie. engine, car, guestCar ..etc.
    Do we have such naming convention for XML Schema?
    Thanks

    I am giving this from my document which i prepared for one of my customer
    2     General Guidelines for design of XML schema documents
    The representation of data in an XML format will be a key component of development within SOA. Therefore, the design and development of XML schemas should be as rigorous an activity as designing and developing code or designing database schemas. As such, when creating an XML schema you should be working within a development process and working to a set of design guidelines and coding standards (when writing the XML schema file). XML schemas should be reviewed for accuracy and compliance with guidelines and standards. Each of the requirements in the list below is a general requirement for all XML schemas to be deployed in the SOA environment.
    •     Understandable: XML schemas should be clear, consistent and unambiguous. They should contain human readable documentation and, where appropriate, links to requirements or design documents.
    •     Semantically Complete: An XML schema should define, for one or more target XML documents, each and every element and attribute that is understood by your solution when processing target documents.
    •     Constraining: XML schemas are used as contracts between both publisher and consumer. As such, they must be able to be validated as concisely as possible. When designing an XML schema constraints should be identified for the values for all the elements and attributes that the application uses and relies on to the set of values that the application can handle. A valid document should imply valid data within the limits of what can be specified by the XML Schema language.
    •     Uniquely identifiable: XML schemas should import and include other XML schema files rather than duplicating types and elements locally.
    •     Reusable: XML schemas should be specified in such a way that types and other XML schemas can leverage elements. Every type defined in an XML schema that is the content type of an attribute or an element should be defined globally (i.e., at the top level in the Schema). Types that are defined globally can be reused in other XML schemas. Schemas should be separated into logical sections which can be included into the main schema file.
    •     Extensible: Schemas should be designed to be extensible—that is, new elements and attributes can be inserted throughout the document.
    Every schema should use at least two namespaces – the targetNamespace and the XML Schema (http://www.w3.org/2001/XMLSchema) namespace.
    Create typed elements that can be referred to by object elements:
    Example:
    <?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.soa.com"
    xmlns="http://www.soai.com"
    elementFormDefault="qualified">
    <xsd:complexType name="PersonType">
    <xsd:sequence>
    <xsd:element name="Name" type="xsd:string"/>
    <xsd:element name="SSN" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    <?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.company.org"
    xmlns="http://www.company.org"
    elementFormDefault="qualified">
    <xsd:include schemaLocation="Person.xsd"/>
    <xsd:include schemaLocation="Product.xsd"/>
    <xsd:element name="Company">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="Person" type="PersonType" maxOccurs="unbounded"/>
    <xsd:element name="Product" type="ProductType" maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    •     Recognize that with XML Schemas you will not be able to express all your business rules.
    o     Express those business rules using XSLT.
    •     Use type definitions
    Elements vs Attributes
    •     Use attributes for metadata about the parent element.
    •     Use attributes for data that is semantically tied to the enclosing element.
    •     Use elements for data that have a meaning separate from the enclosing element.
    •     Use attributes when the value will be frequently present in order to improve the human readable form of an XML instance document or reduce its size.
    •     If you don't know which to use, then use the element form (which is more extensible).
    2.1.1     Element, Types and attribute names
    Create a descriptive name without it being excessively long (no more than 32 characters).
    Elements and Types should be named in Upper Camel Case. Upper Camel Case capitalizes the first character of each word and compounds the name (remove all whitespace).
    Attributes should be named in Lower Camel Case. Lower Camel Case capitalizes the first character of each word except the first word and compounds the name.
    Simple and Complex type names
    XML Schema has separate symbol space for elements and types so they may have the same name. The best practice is to append the word "Type" to all simple and complex type names to aid in human readability and comprehension.
    Element, attribute and type names MUST be in a singular form unless the concept itself is plural.
    2.1.1.1     XML Schema versioning
    Use major and minor version tracking:
    Major—completely different structure and semantics, most likely not backward compatible
    Minor—backward compatible changes which introduce new features without removing or changing the semantics of existing structures
    2.1.1.2     Indication of version in the namespace URI
    Specify a namespace URI as follows
    http://$domain/$groupSpecifier/$namespaceTitle/$version
    The groupSpecifier can include several levels, e.g., /www.soa.com/SOA/USA/.
    An example namespace could be:
    http://www.soa.com/SOA/order/2

  • How to create our own XML Schema (.xsd) in Weblogic WorkShop

    Hi,
    I am new to Weblogic Workshop.I want to create one xml schema with custom elements.
    when I am creating a file xml schema(.xsd).The file contains default namespace and no child elements in it.I don't know how to add elements to that file.
    please tell me how to add parent elements and child elements and also our own xml namingspace.

    Hi Sivaram,
    Unfortunately, the 8.1 IDE did not have special tooling for schema generation.
    You will need to create it by hand or using an external tool
    If you are using an external tool to create the file within the schema project, you might want to disable the schema project auto build, which will be triggered every time a file save takes place
    cheers
    Raj

  • How can i change a xmltype column's xml schema?

    i create a table that have a xmltype column.this column is schema-based.
    my problem is ,
    now i want to this column's schema will be redefined to a global schema?
    [b]how can i change the column's schema which already have a schema?

    When a schema is registered a lot of additonal annotations are added to the XML schema by the schema registration process - Look at the version of the XML schema under /sys/schemas/... in the XML DB repository. This information is unqiue to that version of the XML schema and is used internally to manage instance level metadata.
    When instance documents are stored in the DB a set of metadata is generated for each document so that we can make sure that we can maintain DOM Fidelity. This metadata is tied directly to the XML schema the document is associated and is only valid in the context of that XML Schema.
    So when the schema is registered locally and instances are stored the generated metadata is only valid in the context of the local schema. If the same schema is now registered globally new values will be generated for the annotations applied to the global version of the XML schema. Consequently the metadata associated with a document belonging to the local version of the XML schema has no meaning when viewed in the context of the global version of the XML schema.
    The net effect of this is that you will need to copy the data in order to get documents where the metadata for each document is based on the global version of the XML SChema.

  • Error when registering XML Schema

    When I try to register a schema with XDB I keep getting an ORA-31000 error. It says that the schema it references is not a valid XDB schema, but when I try to register that one it says the first one isn't valid.

    Testing with 11g I get
    I assume you have registered 'http://www.w3.org/2005/08/addressing/ws-addr.xsd'
    SQL> set echo on
    SQL> spool testcase.log
    SQL> --
    SQL> connect sys/ as sysdba
    Enter password:
    Connected.
    SQL> set define on
    SQL> set timing on
    SQL> --
    SQL> define USERNAME = IXSEMF01
    SQL> --
    SQL> def PASSWORD = IXSEMF01
    SQL> --
    SQL> def USER_TABLESPACE = USERS
    SQL> --
    SQL> def TEMP_TABLESPACE = TEMP
    SQL> --
    SQL> drop user &USERNAME cascade
      2  /
    old   1: drop user &USERNAME cascade
    new   1: drop user IXSEMF01 cascade
    drop user IXSEMF01 cascade
    ERROR at line 1:
    ORA-01918: user 'IXSEMF01' does not exist
    Elapsed: 00:00:00.03
    SQL> grant connect, resource to &USERNAME identified by &PASSWORD
      2  /
    old   1: grant connect, resource to &USERNAME identified by &PASSWORD
    new   1: grant connect, resource to IXSEMF01 identified by IXSEMF01
    Grant succeeded.
    Elapsed: 00:00:00.01
    SQL> grant create any directory, drop any directory to &USERNAME
      2  /
    old   1: grant create any directory, drop any directory to &USERNAME
    new   1: grant create any directory, drop any directory to IXSEMF01
    Grant succeeded.
    Elapsed: 00:00:00.00
    SQL> grant alter session, create view to &USERNAME
      2  /
    old   1: grant alter session, create view to &USERNAME
    new   1: grant alter session, create view to IXSEMF01
    Grant succeeded.
    Elapsed: 00:00:00.00
    SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
      2  /
    old   1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
    new   1: alter user IXSEMF01 default tablespace USERS temporary tablespace TEMP
    User altered.
    Elapsed: 00:00:00.00
    SQL> connect &USERNAME/&PASSWORD
    Connected.
    SQL> --
    SQL> alter session set events ='19027 trace name context forever, level 0x800'
      2  /
    Session altered.
    Elapsed: 00:00:00.00
    SQL> var schemaURL  varchar2(700)
    SQL> var schemaURL1 varchar2(700)
    SQL> var schemaURL2 varchar2(700)
    SQL> var xmlschema CLOB
    SQL> --
    SQL> begin
      2    :schemaURL := 'http://www.w3.org/2005/08/addressing/ws-addr.xsd';
      3    :xmlSchema :=
      4  '<?xml version="1.0" encoding="utf-8"?>
      5  <!--
      6  <!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "http://www.w3.org/2001/XMLSchema.dtd">
      7      W3C XML Schema defined in the Web Services Addressing 1.0 specification
      8      http://www.w3.org/TR/ws-addr-core
      9
    10     Copyright c 2005 World Wide Web Consortium,
    11
    12     (Massachusetts Institute of Technology, European Research Consortium for
    13     Informatics and Mathematics, Keio University). All Rights Reserved. This
    14     work is distributed under the W3Cr Software License [1] in the hope that
    15     it will be useful, but WITHOUT ANY WARRANTY; without even the implied
    16     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    17
    18     [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
    19
    20     $Id: ws-addr.xsd,v 1.3 2005/08/09 13:17:35 hugo Exp $
    21  -->
    22  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.w3.org/2005/08/addressing" targetNamespace="http://www.w3.
    org/2005/08/addressing" blockDefault="#all" elementFormDefault="qualified" finalDefault="" attributeFormDefault="unqualified">
    23
    24     <!-- Constructs from the WS-Addressing Core -->
    25
    26     <xs:element name="EndpointReference" type="tns:EndpointReferenceType"/>
    27     <xs:complexType name="EndpointReferenceType" mixed="false">
    28             <xs:sequence>
    29                     <xs:element name="Address" type="tns:AttributedURIType"/>
    30                     <xs:element name="ReferenceParameters" type="tns:ReferenceParametersType" minOccurs="0"/>
    31                     <xs:element ref="tns:Metadata" minOccurs="0"/>
    32                     <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    33             </xs:sequence>
    34             <xs:anyAttribute namespace="##other" processContents="lax"/>
    35     </xs:complexType>
    36
    37     <xs:complexType name="ReferenceParametersType" mixed="false">
    38             <xs:sequence>
    39                     <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    40             </xs:sequence>
    41             <xs:anyAttribute namespace="##other" processContents="lax"/>
    42     </xs:complexType>
    43
    44     <xs:element name="Metadata" type="tns:MetadataType"/>
    45     <xs:complexType name="MetadataType" mixed="false">
    46             <xs:sequence>
    47                     <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    48             </xs:sequence>
    49             <xs:anyAttribute namespace="##other" processContents="lax"/>
    50     </xs:complexType>
    51
    52     <xs:element name="MessageID" type="tns:AttributedURIType"/>
    53     <xs:element name="RelatesTo" type="tns:RelatesToType"/>
    54     <xs:complexType name="RelatesToType" mixed="false">
    55             <xs:simpleContent>
    56                     <xs:extension base="xs:anyURI">
    57                             <xs:attribute name="RelationshipType" type="tns:RelationshipTypeOpenEnum" use="optional" default="http://www
    .w3.org/2005/08/addressing/reply"/>
    58                             <xs:anyAttribute namespace="##other" processContents="lax"/>
    59                     </xs:extension>
    60             </xs:simpleContent>
    61     </xs:complexType>
    62
    63     <xs:simpleType name="RelationshipTypeOpenEnum">
    64             <xs:union memberTypes="tns:RelationshipType xs:anyURI"/>
    65     </xs:simpleType>
    66
    67     <xs:simpleType name="RelationshipType">
    68             <xs:restriction base="xs:anyURI">
    69                     <xs:enumeration value="http://www.w3.org/2005/08/addressing/reply"/>
    70             </xs:restriction>
    71     </xs:simpleType>
    72
    73     <xs:element name="ReplyTo" type="tns:EndpointReferenceType"/>
    74     <xs:element name="From" type="tns:EndpointReferenceType"/>
    75     <xs:element name="FaultTo" type="tns:EndpointReferenceType"/>
    76     <xs:element name="To" type="tns:AttributedURIType"/>
    77     <xs:element name="Action" type="tns:AttributedURIType"/>
    78
    79     <xs:complexType name="AttributedURIType" mixed="false">
    80             <xs:simpleContent>
    81                     <xs:extension base="xs:anyURI">
    82                             <xs:anyAttribute namespace="##other" processContents="lax"/>
    83                     </xs:extension>
    84             </xs:simpleContent>
    85     </xs:complexType>
    86
    87     <!-- Constructs from the WS-Addressing SOAP binding -->
    88
    89     <xs:attribute name="IsReferenceParameter" type="xs:boolean"/>
    90
    91     <xs:simpleType name="FaultCodesOpenEnumType">
    92             <xs:union memberTypes="tns:FaultCodesType xs:QName"/>
    93     </xs:simpleType>
    94
    95     <xs:simpleType name="FaultCodesType">
    96             <xs:restriction base="xs:QName">
    97                     <xs:enumeration value="tns:InvalidAddressingHeader"/>
    98                     <xs:enumeration value="tns:InvalidAddress"/>
    99                     <xs:enumeration value="tns:InvalidEPR"/>
    100                     <xs:enumeration value="tns:InvalidCardinality"/>
    101                     <xs:enumeration value="tns:MissingAddressInEPR"/>
    102                     <xs:enumeration value="tns:DuplicateMessageID"/>
    103                     <xs:enumeration value="tns:ActionMismatch"/>
    104                     <xs:enumeration value="tns:MessageAddressingHeaderRequired"/>
    105                     <xs:enumeration value="tns:DestinationUnreachable"/>
    106                     <xs:enumeration value="tns:ActionNotSupported"/>
    107                     <xs:enumeration value="tns:EndpointUnavailable"/>
    108             </xs:restriction>
    109     </xs:simpleType>
    110
    111     <xs:element name="RetryAfter" type="tns:AttributedUnsignedLongType"/>
    112     <xs:complexType name="AttributedUnsignedLongType" mixed="false">
    113             <xs:simpleContent>
    114                     <xs:extension base="xs:unsignedLong">
    115                             <xs:anyAttribute namespace="##other" processContents="lax"/>
    116                     </xs:extension>
    117             </xs:simpleContent>
    118     </xs:complexType>
    119
    120     <xs:element name="ProblemHeaderQName" type="tns:AttributedQNameType"/>
    121     <xs:complexType name="AttributedQNameType" mixed="false">
    122             <xs:simpleContent>
    123                     <xs:extension base="xs:QName">
    124                             <xs:anyAttribute namespace="##other" processContents="lax"/>
    125                     </xs:extension>
    126             </xs:simpleContent>
    127     </xs:complexType>
    128
    129     <xs:element name="ProblemHeader" type="tns:AttributedAnyType"/>
    130     <xs:complexType name="AttributedAnyType" mixed="false">
    131             <xs:sequence>
    132                     <xs:any namespace="##any" processContents="lax" minOccurs="1" maxOccurs="1"/>
    133             </xs:sequence>
    134             <xs:anyAttribute namespace="##other" processContents="lax"/>
    135     </xs:complexType>
    136
    137     <xs:element name="ProblemIRI" type="tns:AttributedURIType"/>
    138
    139     <xs:element name="ProblemAction" type="tns:ProblemActionType"/>
    140     <xs:complexType name="ProblemActionType" mixed="false">
    141             <xs:sequence>
    142                     <xs:element ref="tns:Action" minOccurs="0"/>
    143                     <xs:element name="SoapAction" minOccurs="0" type="xs:anyURI"/>
    144             </xs:sequence>
    145             <xs:anyAttribute namespace="##other" processContents="lax"/>
    146     </xs:complexType>
    147
    148  </xs:schema>';
    149  end;
    150  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    SQL> declare
      2    xmlschema xmltype := xmltype(:xmlschema);
      3  begin
      4    dbms_xmlschema.registerSchema
      5    (
      6        schemaURL => :schemaURL
      7       ,schemaDoc => xmlschema
      8       ,local     => TRUE
      9       ,genBean   => false
    10       ,genTypes  => TRUE
    11       ,genTables => TRUE
    12    );
    13  end;
    14  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:03.07
    SQL>
    SQL> begin
      2    :schemaURL1 := 'muws1-2.xsd';
      3    :xmlSchema :=
      4  '<?xml version="1.0" encoding="utf-8"?>
      5  <!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by Dirk Grissett (Oracle Corp.) --> <xs:schema xmlns:muws1="http://docs.
    oasis-open.org/wsdm/muws1-2.xsd" xmlns:muws2="http://docs.oasis-open.org/wsdm/muws2-2.xsd" xmlns:wsa="http://www.w3.org/2005/08/addressing"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://docs.oasis-open.org/wsdm/muws1-2.xsd" elementFormDefault="qualified" att
    ributeFormDefault="unqualified">
      6     <xs:import namespace="http://docs.oasis-open.org/wsdm/muws2-2.xsd" schemaLocation="muws2-2.xsd"/>
      7     <xs:import namespace="http://www.w3.org/2005/08/addressing" schemaLocation="http://www.w3.org/2005/08/addressing/ws-addr.xsd"/>
      8     <xs:element name="ResourceId" type="xs:anyURI"/>
      9     <xs:element name="ManageabilityCapability" type="xs:anyURI"/>
    10     <xs:complexType name="CorrelatablePropertiesType">
    11             <xs:sequence>
    12                     <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    13             </xs:sequence>
    14             <xs:attribute name="Dialect" type="xs:anyURI"/>
    15             <xs:attribute name="NegativeAssertionPossible" type="xs:boolean"/>
    16             <xs:anyAttribute namespace="##other"/>
    17     </xs:complexType>
    18     <xs:element name="CorrelatableProperties" type="muws1:CorrelatablePropertiesType"/>
    19     <xs:complexType name="ComponentAddressType">
    20             <xs:sequence>
    21                     <xs:element name="ManagementURL" type="xs:string"/>
    22                     <xs:any namespace="##any" processContents="lax"/>
    23             </xs:sequence>
    24     </xs:complexType>
    25     <xs:complexType name="ComponentType">
    26             <xs:sequence>
    27                     <xs:element name="ResourceId" type="xs:anyURI" minOccurs="0"/>
    28                     <xs:element name="ComponentAddress" type="muws1:ComponentAddressType" minOccurs="0"/>
    29                     <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    30             </xs:sequence>
    31             <xs:anyAttribute namespace="##other"/>
    32     </xs:complexType>
    33     <xs:complexType name="ManagementEventType">
    34             <xs:sequence>
    35                     <xs:element name="EventId" type="xs:anyURI"/>
    36                     <xs:element name="SourceComponent" type="muws1:ComponentType"/>
    37                     <xs:element name="ReporterComponent" type="muws1:ComponentType" minOccurs="0"/>
    38                     <xs:element ref="muws2:Situation"/>
    39                     <xs:element name="ExtendedData" type="muws1:ExtendedDataType" minOccurs="0" maxOccurs="unbounded"/>
    40                     <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    41             </xs:sequence>
    42             <xs:attribute name="ReportTime" type="xs:dateTime" use="optional"/>
    43             <xs:anyAttribute namespace="##other"/>
    44     </xs:complexType>
    45     <xs:element name="ManagementEvent" type="muws1:ManagementEventType"/>
    46     <xs:element name="ManageabilityEndpointReference" type="wsa:EndpointReferenceType"/>
    47     <xs:complexType name="ExtendedDataElementType">
    48             <xs:sequence>
    49                     <xs:choice>
    50                             <xs:element name="values" minOccurs="0">
    51                                     <xs:simpleType>
    52                                             <xs:restriction base="xs:string">
    53                                                     <xs:maxLength value="1024"/>
    54                                             </xs:restriction>
    55                                     </xs:simpleType>
    56                             </xs:element>
    57                             <xs:element name="hexValue" type="xs:hexBinary" minOccurs="0"/>
    58                             <xs:element name="intValues" type="xs:int" minOccurs="0"/>
    59                             <xs:element name="longValues" type="xs:long" minOccurs="0"/>
    60                             <xs:element name="shortValues" type="xs:short" minOccurs="0"/>
    61                             <xs:element name="dateTimeValues" type="xs:dateTime" minOccurs="0"/>
    62                             <xs:element name="byteValues" type="xs:byte" minOccurs="0"/>
    63                             <xs:element name="booleanValues" type="xs:boolean" minOccurs="0"/>
    64                             <xs:element name="floatValues" type="xs:float" minOccurs="0"/>
    65                             <xs:element name="doubleValues" type="xs:double" minOccurs="0"/>
    66                             <xs:element name="largeStringValue" type="xs:string" minOccurs="0"/>
    67                     </xs:choice>
    68             </xs:sequence>
    69             <xs:attribute name="name" use="required">
    70                     <xs:simpleType>
    71                             <xs:restriction base="xs:Name">
    72                                     <xs:maxLength value="64"/>
    73                             </xs:restriction>
    74                     </xs:simpleType>
    75             </xs:attribute>
    76             <xs:attribute name="type" use="required">
    77                     <xs:simpleType>
    78                             <xs:restriction base="xs:string">
    79                                     <xs:enumeration value="noValue"/>
    80                                     <xs:enumeration value="byte"/>
    81                                     <xs:enumeration value="short"/>
    82                                     <xs:enumeration value="int"/>
    83                                     <xs:enumeration value="long"/>
    84                                     <xs:enumeration value="float"/>
    85                                     <xs:enumeration value="double"/>
    86                                     <xs:enumeration value="string"/>
    87                                     <xs:enumeration value="dateTime"/>
    88                                     <xs:enumeration value="boolean"/>
    89                                     <xs:enumeration value="byteArray"/>
    90                                     <xs:enumeration value="shortArray"/>
    91                                     <xs:enumeration value="intArray"/>
    92                                     <xs:enumeration value="longArray"/>
    93                                     <xs:enumeration value="floatArray"/>
    94                                     <xs:enumeration value="doubleArray"/>
    95                                     <xs:enumeration value="stringArray"/>
    96                                     <xs:enumeration value="dateTimeArray"/>
    97                                     <xs:enumeration value="booleanArray"/>
    98                                     <xs:enumeration value="hexBinary"/>
    99                                     <xs:enumeration value="largeStringValue"/>
    100                             </xs:restriction>
    101                     </xs:simpleType>
    102             </xs:attribute>
    103     </xs:complexType>
    104     <xs:complexType name="ExtendedDataType">
    105             <xs:sequence>
    106                     <xs:element name="ExtendedDataElement" type="muws1:ExtendedDataElementType" minOccurs="0" maxOccurs="unbounded"/>
    107             </xs:sequence>
    108             <xs:attribute name="profile" type="xs:ID"/>
    109     </xs:complexType>
    110     <!--
    111                                         SCHEMA COPY Material Copy and paste element references below into the schema of a resource prope
    rties document.
    112  These references are provide to insure that the correct minOccurs/maxOccurs attributes are specified in a resource property document sc
    hema.
    113
    114  NOTE: You must import the MUWS Part 1 schema namespace (MUWS1).
    115
    116          **    Identity Properties    **
    117            <xs:element ref="muws1:ResourceId"/>
    118
    119
    120          **    ManageabilityCharacteristics Properties    **
    121            <xs:element ref="muws1:ManageabilityCapability"
    122                        minOccurs="0" maxOccurs="unbounded"/>
    123
    124          **    Correlatable Properties    **
    125            <xs:element ref="muws1:CorrelatableProperties"
    126                        minOccurs="0" maxOccurs="unbounded"/>
    127
    128  -->
    129  </xs:schema>';
    130  end;
    131  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    SQL> declare
      2    xmlschema xmltype := xmltype(:xmlschema);
      3  begin
      4    dbms_xmlschema.registerSchema
      5    (
      6        schemaURL => :schemaURL1
      7       ,schemaDoc => xmlschema
      8       ,local     => TRUE
      9       ,genBean   => false
    10       ,genTypes  => TRUE
    11       ,genTables => TRUE
    12       ,force => TRUE
    13    );
    14  end;
    15  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.35
    SQL> begin
      2    :schemaURL2 := 'muws2-2.xsd';
      3    :xmlSchema :=
      4  '<?xml version="1.0" encoding="utf-8"?>
      5  <!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by Dirk Grissett (Oracle Corp.) -->
      6  <xs:schema xmlns:muws2="http://docs.oasis-open.org/wsdm/muws2-2.xsd" xmlns:muws1="http://docs.oasis-open.org/wsdm/muws1-2.xsd" xmlns:ws
    a="http://www.w3.org/2005/08/addressing" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://docs.oasis-open.org/wsdm/muws2-
    2.xsd" elementFormDefault="qualified" attributeFormDefault="unqualified">
      7     <xs:import namespace="http://docs.oasis-open.org/wsdm/muws1-2.xsd" schemaLocation="muws1-2.xsd"/>
      8     <xs:import namespace="http://www.w3.org/2005/08/addressing" schemaLocation="http://www.w3.org/2005/08/addressing/ws-addr.xsd"/>
      9     <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
    10     <xs:complexType name="LangString">
    11             <xs:simpleContent>
    12                     <xs:extension base="xs:string">
    13                             <xs:attribute ref="xml:lang" use="required"/>
    14                             <xs:anyAttribute namespace="##other"/>
    15                     </xs:extension>
    16             </xs:simpleContent>
    17     </xs:complexType>
    18     <!-- Begin properties for the Description capability -->
    19     <xs:element name="Caption" type="muws2:LangString"/>
    20     <xs:element name="Description" type="muws2:LangString"/>
    21     <xs:element name="Version" type="xs:string"/>
    22     <!-- End   properties for the Description capability -->
    23     <xs:complexType name="CategoryType">
    24             <xs:sequence>
    25                     <xs:any namespace="##any" processContents="lax" minOccurs="0"/>
    26             </xs:sequence>
    27     </xs:complexType>
    28     <xs:complexType name="StateType">
    29             <xs:complexContent>
    30                     <xs:extension base="muws2:CategoryType"/>
    31             </xs:complexContent>
    32     </xs:complexType>
    33     <xs:element name="State" type="muws2:StateType"/>
    34     <xs:element name="EnteredState" type="muws2:StateType"/>
    35     <xs:element name="PreviousState" type="muws2:StateType"/>
    36     <xs:complexType name="StateTransitionType">
    37             <xs:sequence>
    38                     <xs:element ref="muws2:EnteredState"/>
    39                     <xs:element ref="muws2:PreviousState" minOccurs="0"/>
    40                     <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    41             </xs:sequence>
    42             <xs:attribute name="TransitionIdentifier" type="xs:anyURI" use="optional"/>
    43             <xs:attribute name="Time" type="xs:dateTime" use="required"/>
    44             <xs:anyAttribute namespace="##other"/>
    45     </xs:complexType>
    46     <xs:element name="StateTransition" type="muws2:StateTransitionType"/>
    47     <!-- Begin properties for the OperationalStatus capability -->
    48     <xs:element name="OperationalStatus">
    49             <xs:simpleType>
    50                     <xs:restriction base="xs:string">
    51                             <xs:enumeration value="Available"/>
    52                             <xs:enumeration value="PartiallyAvailable"/>
    53                             <xs:enumeration value="Unavailable"/>
    54                             <xs:enumeration value="Unknown"/>
    55                     </xs:restriction>
    56             </xs:simpleType>
    57     </xs:element>
    58     <!-- End   properties for the OperationalStatus capability -->
    59     <xs:attributeGroup name="MetricAttributes">
    60             <xs:attribute name="ResetAt" type="xs:dateTime"/>
    61             <xs:attribute name="LastUpdated" type="xs:dateTime"/>
    62             <xs:attribute name="Duration" type="xs:duration"/>
    63     </xs:attributeGroup>
    64     <!-- Begin properties for the Metrics capability -->
    65     <xs:element name="CurrentTime" type="xs:dateTime"/>
    66     <!-- End   properties for the Metrics capability -->
    67     <xs:complexType name="RelationshipTypeType">
    68             <xs:complexContent>
    69                     <xs:extension base="muws2:CategoryType"/>
    70             </xs:complexContent>
    71     </xs:complexType>
    72     <xs:element name="Self">
    73             <xs:complexType/>
    74     </xs:element>
    75     <xs:complexType name="RelationshipParticipantType">
    76             <xs:sequence>
    77                     <xs:element ref="muws2:Self" minOccurs="0"/>
    78                     <xs:element ref="muws1:ManageabilityEndpointReference" minOccurs="0" maxOccurs="unbounded"/>
    79                     <xs:element ref="wsa:EndpointReference" minOccurs="0" maxOccurs="unbounded"/>
    80                     <xs:element ref="muws1:ResourceId" minOccurs="0"/>
    81                     <xs:element name="Role" type="xs:anyURI"/>
    82                     <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    83             </xs:sequence>
    84             <xs:anyAttribute namespace="##other"/>
    85     </xs:complexType>
    86     <!-- Begin properties for the RelationshipResource capability -->
    87     <xs:element name="Name" type="xs:string"/>
    88     <xs:element name="Type" type="muws2:RelationshipTypeType"/>
    89     <xs:element name="Participant" type="muws2:RelationshipParticipantType"/>
    90     <!-- End   properties for the RelationshipResource capability -->
    91     <xs:complexType name="RelationshipType">
    92             <xs:sequence>
    93                     <xs:element ref="muws2:Name" minOccurs="0"/>
    94                     <xs:element ref="muws2:Type"/>
    95                     <xs:element ref="muws2:Participant" minOccurs="2" maxOccurs="unbounded"/>
    96                     <xs:element name="AccessEndpointReference" type="wsa:EndpointReferenceType" minOccurs="0"/>
    97                     <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    98             </xs:sequence>
    99             <xs:anyAttribute namespace="##other"/>
    100     </xs:complexType>
    101     <!-- Begin properties for the Relationship capability -->
    102     <xs:element name="Relationship" type="muws2:RelationshipType"/>
    103     <!-- End   properties for the Relationship capability -->
    104     <xs:element name="RelationshipCreatedNotification">
    105             <xs:complexType>
    106                     <xs:sequence>
    107                             <xs:element ref="muws2:Relationship"/>
    108                             <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    109                     </xs:sequence>
    110                     <xs:anyAttribute namespace="##other"/>
    111             </xs:complexType>
    112     </xs:element>
    113     <xs:element name="RelationshipDeletedNotification">
    114             <xs:complexType>
    115                     <xs:sequence>
    116                             <xs:element ref="muws2:Relationship"/>
    117                             <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    118                     </xs:sequence>
    119                     <xs:anyAttribute namespace="##other"/>
    120             </xs:complexType>
    121     </xs:element>
    122     <xs:element name="QueryRelationshipsByType">
    123             <xs:complexType>
    124                     <xs:sequence>
    125                             <xs:element name="RequestedType" type="xs:QName"/>
    126                     </xs:sequence>
    127             </xs:complexType>
    128     </xs:element>
    129     <xs:element name="QueryRelationshipsByTypeResponse">
    130             <xs:complexType>
    131                     <xs:sequence>
    132                             <xs:element ref="muws2:Relationship" minOccurs="0" maxOccurs="unbounded"/>
    133                     </xs:sequence>
    134             </xs:complexType>
    135     </xs:element>
    136     <xs:element name="CreationNotification">
    137             <xs:complexType>
    138                     <xs:sequence>
    139                             <xs:element ref="muws1:ManageabilityEndpointReference" minOccurs="0" maxOccurs="unbounded"/>
    140                     </xs:sequence>
    141                     <xs:anyAttribute namespace="##other"/>
    142             </xs:complexType>
    143     </xs:element>
    144     <xs:element name="DestructionNotification">
    145             <xs:complexType>
    146                     <xs:sequence>
    147                             <xs:element ref="muws1:ResourceId" minOccurs="0"/>
    148                     </xs:sequence>
    149                     <xs:anyAttribute namespace="##other"/>
    150             </xs:complexType>
    151     </xs:element>
    152     <xs:complexType name="SituationCategoryType">
    153             <xs:complexContent>
    154                     <xs:extension base="muws2:CategoryType">
    155                             <xs:sequence>
    156                                     <xs:element name="SituationName" minOccurs="0"/>
    157                             </xs:sequence>
    158                     </xs:extension>
    159             </xs:complexContent>
    160     </xs:complexType>
    161     <xs:element name="fred" type="xs:string"/>
    162     <xs:complexType name="SubstitutableMsgType">
    163             <xs:sequence>
    164                     <xs:element name="Value" type="xs:anySimpleType" minOccurs="0" maxOccurs="unbounded"/>
    165             </xs:sequence>
    166             <xs:attribute name="MsgId" type="xs:string" use="required"/>
    167             <xs:attribute name="MsgIdType" type="xs:anyURI" use="required"/>
    168     </xs:complexType>
    169     <xs:complexType name="SituationType">
    170             <xs:sequence>
    171                     <xs:element name="SituationCategory" type="muws2:SituationCategoryType"/>
    172                     <xs:element name="SuccessDisposition" minOccurs="0">
    173                             <xs:simpleType>
    174                                     <xs:restriction base="xs:string">
    175                                             <xs:enumeration value="Successful"/>
    176                                             <xs:enumeration value="Unsuccessful"/>
    177                                     </xs:restriction>
    178                             </xs:simpleType>
    179                     </xs:element>
    180                     <xs:element name="SituationTime" type="xs:dateTime"/>
    181                     <xs:element name="Priority" type="xs:short" minOccurs="0"/>
    182                     <xs:element name="Severity" type="xs:short" minOccurs="0"/>
    183                     <xs:element name="Message" type="muws2:LangString" minOccurs="0"/>
    184                     <xs:element name="SubstitutableMsg" type="muws2:SubstitutableMsgType" minOccurs="0"/>
    185             </xs:sequence>
    186     </xs:complexType>
    187     <xs:element name="Situation" type="muws2:SituationType"/>
    188     <xs:complexType name="EventCorrelationPropertiesType">
    189             <xs:sequence>
    190                     <xs:element name="repeatCount" minOccurs="0">
    191                             <xs:simpleType>
    192                                     <xs:restriction base="xs:short">
    193                                             <xs:minInclusive value="0"/>
    194                                     </xs:restriction>
    195                             </xs:simpleType>
    196                     </xs:element>
    197                     <xs:element name="elapsedTime" minOccurs="0">
    198                             <xs:simpleType>
    199                                     <xs:restriction base="xs:long">
    200                                             <xs:minInclusive value="0"/>
    201                                     </xs:restriction>
    202                             </xs:simpleType>
    203                     </xs:element>
    204             </xs:sequence>
    205             <xs:attribute name="sequenceNumber" type="xs:unsignedLong"/>
    206     </xs:complexType>
    207     <xs:element name="EventCorrelationProperties" type="muws2:EventCorrelationPropertiesType"/>
    208     <xs:complexType name="MsgCatalogInformationType">
    209             <xs:sequence>
    210                     <xs:element name="msgCatalog" type="xs:anyURI"/>
    211                     <xs:element name="msgCatalogType" type="xs:anyURI" minOccurs="0"/>
    212             </xs:sequence>
    213     </xs:complexType>
    214     <xs:element name="MsgCatalogInformation" type="muws2:MsgCatalogInformationType"/>
    215     <!-- #####   Metadata description elements   ##### -->
    216     <xs:element name="Capability" type="xs:anyURI"/>
    217     <xs:complexType name="DialectableExpressionType" mixed="true">
    218             <xs:sequence>
    219                     <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    220             </xs:sequence>
    221             <xs:attribute name="Dialect" type="xs:anyURI" use="required"/>
    222             <xs:anyAttribute namespace="##other"/>
    223     </xs:complexType>
    224     <xs:element name="ValidWhile" type="muws2:DialectableExpressionType"/>
    225     <xs:element name="Units" type="xs:string"/>
    226     <xs:element name="ChangeType">
    227             <xs:simpleType>
    228                     <xs:restriction base="xs:string">
    229                             <xs:enumeration value="Counter"/>
    230                             <xs:enumeration value="Gauge"/>
    231                             <xs:enumeration value="Unknown"/>
    232                     </xs:restriction>
    233             </xs:simpleType>
    234     </xs:element>
    235     <xs:element name="TimeScope">
    236             <xs:simpleType>
    237                     <xs:restriction base="xs:string">
    238                             <xs:enumeration value="Interval"/>
    239                             <xs:enumeration value="PointInTime"/>
    240                             <xs:enumeration value="SinceReset"/>
    241                     </xs:restriction>
    242             </xs:simpleType>
    243     </xs:element>
    244     <xs:element name="GatheringTime">
    245             <xs:simpleType>
    246                     <xs:restriction base="xs:string">
    247                             <xs:enumeration value="OnChange"/>
    248                             <xs:enumeration value="Periodic"/>
    249                             <xs:enumeration value="OnDemand"/>
    250                             <xs:enumeration value="Unknown"/>
    251                     </xs:restriction>
    252             </xs:simpleType>
    253     </xs:element>
    254     <xs:element name="CalculationInterval" type="xs:duration"/>
    255     <xs:element name="MetricGroup" type="xs:anyURI"/>
    256     <xs:element name="PostCondition" type="muws2:DialectableExpressionType"/>
    257     <!-- =========   StartSituation   ============  -->
    258     <xs:element name="StartSituation">
    259             <xs:complexType>
    260                     <xs:complexContent>
    261                             <xs:restriction base="muws2:SituationCategoryType"/>
    262                     </xs:complexContent>
    263             </xs:complexType>
    264     </xs:element>
    265     <xs:element name="StartInitiated">
    266             <xs:complexType>
    267                     <xs:complexContent>
    268                             <xs:restriction base="muws2:SituationCategoryType">
    269                                     <xs:sequence>
    270                                             <xs:element ref="muws2:StartSituation"/>
    271                                     </xs:sequence>
    272                             </xs:restriction>
    273                     </xs:complexContent>
    274             </xs:complexType>
    275     </xs:element>
    276     <xs:element name="RestartInitiated">
    277             <xs:complexType>
    278                     <xs:complexContent>
    279                             <xs:restriction base="muws2:SituationCategoryType">
    280                                     <xs:sequence>
    281                                             <xs:element ref="muws2:StartSituation"/>
    282                                     </xs:sequence>
    283                             </xs:restriction>
    284                     </xs:complexContent>
    285             </xs:complexType>
    286     </xs:element>
    287     <xs:element name="StartCompleted">
    288             <xs:complexType>
    289                     <xs:complexContent>
    290                             <xs:restriction base="muws2:SituationCategoryType">
    291                                     <xs:sequence>
    292                                             <xs:element ref="muws2:StartSituation"/>
    293                                     </xs:sequence>
    294                             </xs:restriction>
    295                     </xs:complexContent>
    296             </xs:complexType>
    297     </xs:element>
    298     <!-- =========   StopSituation   ============  -->
    299     <xs:element name="StopSituation">
    300             <xs:complexType>
    301                     <xs:complexContent>
    302                             <xs:restriction base="muws2:SituationCategoryType"/>
    303                     </xs:complexContent>
    304             </xs:complexType>
    305     </xs:element>
    306     <xs:element name="StopInitiated">
    307             <xs:complexType>
    308                     <xs:complexContent>
    309                             <xs:restriction base="muws2:SituationCategoryType">
    310                                     <xs:sequence>
    311                                             <xs:element ref="muws2:StopSituation"/>
    312                                     </xs:sequence>
    313                             </xs:restriction>
    314                     </xs:complexContent>
    315             </xs:complexType>
    316     </xs:element>
    317     <xs:element name="AbortInitiated">
    318             <xs:complexType>
    319                     <xs:complexContent>
    320                             <xs:restriction base="muws2:SituationCategoryType">
    321                                     <xs:sequence>
    322                                             <xs:element ref="muws2:StopSituation"/>
    323                                     </xs:sequence>
    324                             </xs:restriction>
    325                     </xs:complexContent>
    326             </xs:complexType>
    327     </xs:element>
    328     <xs:element name="PauseInitiated">
    329             <xs:complexType>
    330                     <xs:complexContent>
    331                             <xs:restriction base="muws2:SituationCategoryType">
    332                                     <xs:sequence>
    333                                             <xs:element ref="muws2:StopSituation"/>
    334                                     </xs:sequence>
    335                             </xs:restriction>
    336                     </xs:complexContent>
    337             </xs:complexType>
    338     </xs:element>
    339     <xs:element name="StopCompleted">
    340             <xs:complexType>
    341                     <xs:complexContent>
    342                             <xs:restriction base="muws2:SituationCategoryType">
    343                                     <xs:sequence>
    344                                             <xs:element ref="muws2:StopSituation"/>
    345                                     </xs:sequence>
    346                             </xs:restriction>
    347                     </xs:complexContent>
    348             </xs:complexType>
    349     </xs:element>
    350     <!-- =========   RequestSituation   ============  -->
    351     <xs:element name="RequestSituation">
    352             <xs:complexType>
    353                     <xs:complexContent>
    354                             <xs:restriction base="muws2:SituationCategoryType"/>
    355                     </xs:complexContent>
    356             </xs:complexType>
    357     </xs:element>
    358     <xs:element name="RequestInitiated">
    359             <xs:complexType>
    360                     <xs:complexContent>
    361                             <xs:restriction base="muws2:SituationCategoryType">
    362                                     <xs:sequence>
    363                                             <xs:element ref="muws2:RequestSituation"/>
    364                                     </xs:sequence>
    365                             </xs:restriction>
    366                     </xs:complexContent>
    367             </xs:complexType>
    368     </xs:element>
    369     <xs:element name="RequestCompleted">
    370             <xs:complexType>
    371                     <xs:complexContent>
    372                             <xs:restriction base="muws2:SituationCategoryType">
    373                                     <xs:sequence>
    374                                             <xs:element ref="muws2:RequestSituation"/>
    375                                     </xs:sequence>
    376                             </xs:restriction>
    377                     </xs:complexContent>
    378             </xs:complexType>
    379     </xs:element>
    380     <!-- =========   DestroySituation   ============  -->
    381     <xs:element name="DestroySituation">
    382             <xs:complexType>
    383                     <xs:complexContent>
    384                             <xs:restriction base="muws2:SituationCategoryType"/>
    385                     </xs:complexContent>
    386             </xs:complexType>
    387     </xs:element>
    388     <xs:element name="DestroyInitiated">
    389             <xs:complexType>
    390                     <xs:complexContent>
    391                             <xs:restriction base="muws2:SituationCategoryType">
    392                                     <xs:sequence>
    393                                             <xs:element ref="muws2:DestroySituation"/>
    394                                     </xs:sequence>
    395                             </xs:restriction>
    396                     </xs:complexContent>
    397             </xs:complexType>
    398     </xs:element>
    399     <xs:element name="DestroyCompleted">
    400             <xs:complexType>
    401                     <xs:complexContent>
    402                             <xs:restriction base="muws2:SituationCategoryType">
    403                                     <xs:sequence>
    404                                             <xs:element ref="muws2:DestroySituation"/>
    405                                     </xs:sequence>
    406                             </xs:restriction>
    407                     </xs:complexContent>
    408             </xs:complexType>
    409     </xs:element>
    410     <!-- =========   CreateSituation   ============  -->
    411     <xs:element name="CreateSituation">
    412             <xs:complexType>
    413                     <xs:complexContent>
    414                             <xs:restriction base="muws2:SituationCategoryType"/>
    415                     </xs:complexContent>
    416             </xs:complexType>
    417     </xs:element>
    418     <xs:element name="CreateInitiated">
    419             <xs:complexType>
    420                     <xs:complexContent>
    421                             <xs:restriction base="muws2:SituationCategoryType">
    422                                     <xs:sequence>
    423                                             <xs:element ref="muws2:CreateSituation"/>
    424                                     </xs:sequence>
    425                             </xs:restriction>
    426                     </xs:complexContent>
    427             </xs:complexType>
    428     </xs:element>
    429     <xs:element name="CreateCompleted">
    430             <xs:complexType>
    431                     <xs:complexContent>
    432                             <xs:restriction base="muws2:SituationCategoryType">
    433                                     <xs:sequence>
    434                                             <xs:element ref="muws2:CreateSituation"/>
    435                                     </xs:sequence>
    436                             </xs:restriction>
    437                     </xs:complexContent>
    438             </xs:complexType>
    439     </xs:element>
    440     <!-- =========   ConnectSituation   ============  -->
    441     <xs:element name="ConnectSituation">
    442             <xs:complexType>
    443                     <xs:complexContent>
    444                             <xs:restriction base="muws2:SituationCategoryType"/>
    445                     </xs:complexContent>
    446             </xs:complexType>
    447     </xs:element>
    448     <xs:element name="ConnectInitiated">
    449             <xs:complexType>
    450                     <xs:complexContent>
    451                             <xs:restriction base="muws2:SituationCategoryType">
    452                                     <xs:sequence>
    453                                             <xs:element ref="muws2:ConnectSituation"/>
    454                                     </xs:sequence>
    455                             </xs:restriction>
    456                     </xs:complexContent>
    457             </xs:complexType>
    458     </xs:element>
    459     <xs:element name="ReconnectInitiated">
    460             <xs:complexType>
    461                     <xs:complexContent>
    462                             <xs:restriction base="muws2:SituationCategoryType">
    463                                     <xs:sequence>
    464                                             <xs:element ref="muws2:ConnectSituation"/>
    465                                     </xs:sequence>
    466                             </xs:restriction>
    467                     </xs:complexContent>
    468             </xs:complexType>
    469     </xs:element>
    470     <xs:element name="ConnectCompleted">
    471             <xs:complexType>
    472                     <xs:complexContent>
    473                             <xs:restriction base="muws2:SituationCategoryType">
    474                                     <xs:sequence>
    475                                             <xs:element ref="muws2:ConnectSituation"/>
    476                                     </xs:sequence>
    477                             </xs:restriction>
    478                     </xs:complexContent>
    479             </xs:complexType>
    480     </xs:element>
    481     <!-- =========   ReportSituation   ============  -->
    482     <xs:element name="ReportSituation">
    483             <xs:complexType>
    484                     <xs:complexContent>
    485                             <xs:restriction base="muws2:SituationCategoryType"/>
    486                     </xs:complexContent>
    487             </xs:complexType>
    488     </xs:element>
    489     <xs:element name="PerformanceReport">
    490             <xs:complexType>
    491                     <xs:complexContent>
    492                             <xs:restriction base="muws2:SituationCategoryType">
    493                                     <xs:sequence>
    494                                             <xs:element ref="muws2:ReportSituation"/>
    495                                     </xs:sequence>
    496                             </xs:restriction>
    497                     </xs:complexContent>
    498             </xs:complexType>
    499     </xs:element>
    500     <xs:element name="SecurityReport">
    501             <xs:complexType>
    502                     <xs:complexContent>
    503                             <xs:restriction base="muws2:SituationCategoryType">
    504                                     <xs:sequence>
    505                                             <xs:element ref="muws2:ReportSituation"/>
    506                                     </xs:sequence>
    507                             </xs:restriction>
    508                     </xs:complexContent>
    509             </xs:complexType>
    510     </xs:element>
    511     <xs:element name="HeartbeatReport">
    512             <xs:complexType>
    513                     <xs:complexContent>
    514                             <xs:restriction base="muws2:SituationCategoryType">
    515                                     <xs:sequence>
    516                                             <xs:element ref="muws2:ReportSituation"/>
    517                                     </xs:sequence>
    518                             </xs:restriction>
    519                     </xs:complexContent>
    520             </xs:complexType>
    521     </xs:element>
    522     <xs:element name="StatusReport">
    523             <xs:complexType>
    524                     <xs:complexContent>
    525                             <xs:restriction base="muws2:SituationCategoryType">
    526                                     <xs:sequence>
    527                                             <xs:element ref="muws2:ReportSituation"/>
    528                                     </xs:sequence>
    529                             </xs:restriction>
    530                     </xs:complexContent>
    531             </xs:complexType>
    532     </xs:element>
    533     <xs:element name="TraceReport">
    534             <xs:complexType>
    535                     <xs:complexContent>
    536                             <xs:restriction base="muws2:SituationCategoryType"&g

  • XML Schema Collection (SQL Server 2012): Complex Schema Collection with Attribute - Should xs or xsd be used in the coding?

    Hi all,
    I just got a copy of the book "Pro SQL Server 2008 XML" written by Michael Coles (published by Apress) and try to learn the XML Schema Collection in my SQL Server 2012 Management Studio (SSMS2012). I studied Chapter 4 XML Collection of the book
    and executed the following code of Listing 4-8 Complex Schema with Attribute:
    -- Pro SQL Server 2008 XML by Michael Coles (Apress)
    -- Listing04-08.sql Complex XML Schema with Attribute
    -- shcColes04-08.sql saved in C:\\Documents\XML_SQL_Server2008_code_Coles_Apress
    -- 6 April 2015 8:00 PM
    CREATE XML SCHEMA COLLECTION dbo.ComplexTestSchemaCollection_attribute
    AS
    N'<?xml version="1.0"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="item">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="name" />
    <xs:element name="color" />
    <xs:group ref="id-price" />
    <xs:group ref="size-group" />
    </xs:sequence>
    <xs:attribute name="id" />
    <xs:attribute name="number" />
    </xs:complexType>
    </xs:element>
    <xs:group name="id-price">
    <xs:choice>
    <xs:element name="list-price" />
    <xs:element name="standard-cost" />
    </xs:choice>
    </xs:group>
    <xs:group name="size-group">
    <xs:sequence>
    <xs:element name="size" />
    <xs:element name="unit-of-measure" />
    </xs:sequence>
    </xs:group>
    </xs:schema>';
    GO
    DECLARE @x XML (dbo.ComplexTestSchemaCollection_attribute);
    SET @x = N'<?xml version="1.0"?>
    <item id="749" number="BK-R93R-62">
    <name>Road-150 Red, 62</name>
    <color>Red</color>
    <list-price>3578.27</list-price>
    <size>62</size>
    <unit-of-measure>CM</unit-of-measure>
    </item>';
    SELECT @x;
    GO
    DROP XML SCHEMA COLLECTION dbo.ComplexTestSchemaCollection_attribute;
    It worked nicely. But, I just found out the coding that was downloaded from the website of Apress and I just executed was different from the coding of Listing 4-8 listed in the book: all the <xs: ....> and </xs: ..> in my SSMS2012 are
    listed as <xsd:...> and </xsd:...> respectively in the book!!??  The same thing happens in the Listing 4-3 Simple XML Schema, Listing 4-5 XML Schema and Valid XML Document with Comple Type Definition, Listion 4-6 XML Schema and XML
    Document Document with Complex Type Using <sequence> and <choice>, and Listing 4-7 Complex XML Schema and XML Document with Model Group Definition (I executed last week) too.  I wonder: should xs or xsd be used in the XML
    Schema Collection of SSMS2012?  Please kindly help,  clarify this matter and explain the diffirence of using xs and xsd for me.
    Thanks in advance,
    Scott Chang   

    Hi Scott,
    Using xs or xsd depends on how you declare the namespace prefix.
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="item">
    I've posted a very good link in your last question, just in case you might have missed it, please see the below link.
    Understanding XML Namespaces
    In an XML document we use a namespace prefix to qualify the local names of both elements and attributes . A prefix is really just an abbreviation for the namespace identifier (URI), which is typically quite long. The prefix is first mapped to a namespace
    identifier through a namespace declaration. The syntax for a namespace declaration is:
    xmlns:<prefix>='<namespace identifier>'
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Insert data into the xml schema-based xmltype table problem!

    Hello, there,
    I got problem in inserting data into the xmltype table after registered XML schema and created table. details see below:
    1) xml schema:
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- edited with XMLSpy v2007 sp2 (http://www.altova.com) by Constantin Ilea (EMERGIS INC) -->
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.emergis.com/eHealth/EHIP/data/meta/profile:v1" targetNamespace="http://www.emergis.com/eHealth/EHIP/data/meta/profile:v1" elementFormDefault="qualified">
         <!-- ************** PART I: BEGIN SIMPLE OBJECT TYPE DEFINITIONS ********************************** -->
         <xs:simpleType name="RoutingType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="Synch"/>
                   <xs:enumeration value="Asynch"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="StatusType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="ACTIVE"/>
                   <xs:enumeration value="VOID"/>
                   <xs:enumeration value="PENDING"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="SenderApplicationType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="PR"/>
                   <xs:enumeration value="CR"/>
                   <xs:enumeration value="POS"/>
                   <xs:enumeration value="CPP"/>
                   <xs:enumeration value="Other"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="ServiceTypeType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="IS"/>
                   <xs:enumeration value="WS"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="RouteDirect">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="Request"/>
                   <xs:enumeration value="Reply"/>
                   <xs:enumeration value="None"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="Indicator">
              <xs:annotation>
                   <xs:documentation>can we also change the value to "ON" and "OFF" instead? in this way this cn be shared by all type of switch indicator</xs:documentation>
              </xs:annotation>
              <xs:restriction base="xs:string">
                   <xs:enumeration value="YES"/>
                   <xs:enumeration value="NO"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="RuleType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="ControlAct"/>
                   <xs:enumeration value="WSPolicy"/>
                   <xs:enumeration value="AccessControl"/>
                   <xs:enumeration value="Certification"/>
                   <xs:enumeration value="MessageConformance"/>
                   <xs:enumeration value="Variant"/>
                   <xs:enumeration value="Routing"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="HL7Result">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="ACCEPT"/>
                   <xs:enumeration value="REFUSE"/>
                   <xs:enumeration value="REJECT"/>
                   <xs:enumeration value="ACK"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="IIPType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="PUT"/>
                   <xs:enumeration value="GET/LIST"/>
                   <xs:enumeration value="NOTIF"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="ProfileTypeType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="IIPProfile"/>
                   <xs:enumeration value="BizOperationProfile"/>
                   <xs:enumeration value="OrchestrationProfile"/>
                   <xs:enumeration value="DomainObjectProfile"/>
                   <xs:enumeration value="ServiceProfile"/>
                   <xs:enumeration value="ExceptionProfile"/>
                   <xs:enumeration value="CustomizedProfile"/>
                   <xs:enumeration value="SystemProfile"/>
                   <xs:enumeration value="HL7XMLSchemaProfile"/>
                   <xs:enumeration value="EnricherParametersProfile"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="ParameterType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="String"/>
                   <xs:enumeration value="Object"/>
                   <xs:enumeration value="Number"/>
                   <xs:enumeration value="Document"/>
              </xs:restriction>
         </xs:simpleType>
         <!-- ************** PART I: END SIMPLE OBJECT TYPE DEFINITIONS ********************************** -->
         <!-- ************** PART II: BEGIN COMPLEX OBJECT TYPE DEFINITIONS ********************************** -->
         <!-- *********************** begin new added objects, by rshan *************************************** -->
         <xs:complexType name="ProfileType">
              <xs:annotation>
                   <xs:documentation>
              1.Profile IS USED TO BE AN WRAPPER ELEMENT FOR ALL KIND OF PROFILES NO MATTER WHAT KIND OF PROFILE IT IS
              2.ProfileID used to uniquely identify the current profile
              3.ProfileData used to hold all the necessary profile related data
              </xs:documentation>
              </xs:annotation>
              <xs:sequence>
                   <xs:element name="ProfileID" type="ProfileIDType">
                        <xs:annotation>
                             <xs:documentation>this will hold all the common attributes, espically the global unique identifier to the profile, no matter what type of profile is</xs:documentation>
                        </xs:annotation>
                   </xs:element>
                   <xs:element name="ProfileData" type="ProfileDataType">
                        <xs:annotation>
                             <xs:documentation>all the non-common profile meta data that attached to each specific profile type such as IIPProfile, OrchestrationProfile, and BizOperationProfile will be placed here</xs:documentation>
                        </xs:annotation>
                   </xs:element>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="ProfileIDType">
              <xs:annotation>
                   <xs:documentation>global unique identifier and all the common attributes across all different profiles, the @ID and @Type together will be used as the primary key to identify the profile data</xs:documentation>
              </xs:annotation>
              <xs:attribute name="ID" type="xs:ID" use="required">
                   <xs:annotation>
                        <xs:documentation>ID is the global unique identifier to the profile, no matter what type of profile it is</xs:documentation>
                   </xs:annotation>
              </xs:attribute>
              <xs:attribute name="Name"/>
              <xs:attribute name="Description"/>
              <xs:attribute name="Version">
                   <xs:annotation>
                        <xs:documentation>version of the profile data</xs:documentation>
                   </xs:annotation>
              </xs:attribute>
              <xs:attribute name="Type" type="ProfileTypeType" use="required">
                   <xs:annotation>
                        <xs:documentation>value to identify the ProfileType type within
                        IIPProfile,BizOperationProfile,OrchestrationProfile,DomainObjectProfile
                        ServiceProfile,ExceptionProfile,SystemProfile,HL7XMLSchemaProfile,
                        EnricherParametersProfile,CustomizedProfile
                        </xs:documentation>
                   </xs:annotation>
              </xs:attribute>
              <xs:attribute name="Status" type="StatusType" default="ACTIVE">
                   <xs:annotation>
                        <xs:documentation>used to show the related profile data status like "ACTIVE","PENDING","VOID"...</xs:documentation>
                   </xs:annotation>
              </xs:attribute>
              <!--
              <xs:sequence>
                   <xs:element name="ProfileReference" type="ProfileIDType" minOccurs="0" maxOccurs="unbounded">
                        <xs:annotation>
                             <xs:documentation>this will be the place to hold the integrity relationship with other profiles like foreign key if existed and necessary to show up</xs:documentation>
                        </xs:annotation>
                   </xs:element>
              </xs:sequence>
              -->
         </xs:complexType>
         <xs:complexType name="ProfileDataType">
              <xs:annotation>
                   <xs:documentation>meta data associated tightly to each specific type of profile</xs:documentation>
              </xs:annotation>
              <xs:choice>
                   <xs:element name="EnricherParametersProfileData" type="EnricherParametersDataType">
                        <xs:annotation>
                             <xs:documentation>Enricher Parameters related profile data
                   1. one instance of this type may contains all the related System metadata.
                   2. idType part may use to identify different version/release/status
                   </xs:documentation>
                        </xs:annotation>
                   </xs:element>
                   <xs:element name="ExtendProfileData" type="ExtendProfileDataType">
                        <xs:annotation>
                             <xs:documentation>If needed, any profile data not defined within the current release scope can be added here </xs:documentation>
                        </xs:annotation>
                   </xs:element>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="ExtendProfileDataType">
              <xs:sequence>
                   <xs:element name="ExtendProfile" type="xs:anyType" minOccurs="0"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="EnricherParametersDataType">
              <xs:sequence>
                   <xs:element name="EnricherParameter" type="EnricherParameter" maxOccurs="unbounded"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="EnricherParameter">
              <xs:sequence>
                   <xs:element ref="Enricher"/>
              </xs:sequence>
              <xs:attribute name="serviceName" type="xs:string" use="required"/>
              <xs:attribute name="interactionID" type="xs:string"/>
         </xs:complexType>
         <xs:element name="Enricher">
              <xs:annotation>
                   <xs:documentation>Comment describing your root element</xs:documentation>
              </xs:annotation>
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="Parameters" type="Parameters"/>
                        <xs:element ref="Section" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:complexType name="ValueType">
              <xs:attribute name="field" use="required"/>
              <xs:attribute name="value"/>
              <xs:attribute name="action"/>
         </xs:complexType>
         <xs:element name="Section">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="Value" type="ValueType" minOccurs="0" maxOccurs="unbounded"/>
                        <xs:element ref="Section" minOccurs="0" maxOccurs="unbounded"/>
                   </xs:sequence>
                   <xs:attribute name="path" use="required"/>
              </xs:complexType>
         </xs:element>
         <xs:complexType name="Parameters">
              <xs:sequence>
                   <xs:element name="Parameter" minOccurs="0" maxOccurs="unbounded">
                        <xs:complexType>
                             <xs:attribute name="name" use="required"/>
                             <xs:attribute name="reference"/>
                        </xs:complexType>
                   </xs:element>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="RuleList">
              <xs:annotation>
                   <xs:documentation>an array of rules</xs:documentation>
              </xs:annotation>
              <xs:sequence>
                   <xs:element name="Rule" type="RuleProfile" minOccurs="0" maxOccurs="unbounded"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="RuleProfile">
              <xs:attribute name="RName" use="required"/>
              <xs:attribute name="RType" type="RuleType" use="required"/>
              <xs:attribute name="Status" default="ON">
                   <xs:annotation>
                        <xs:documentation>By default is ON (or if is missing)</xs:documentation>
                   </xs:annotation>
              </xs:attribute>
              <xs:attribute name="Order"/>
              <xs:attribute name="Direction" type="RouteDirect">
                   <xs:annotation>
                        <xs:documentation>Request / Reply</xs:documentation>
                   </xs:annotation>
              </xs:attribute>
         </xs:complexType>
         <!-- ************** PART II: END COMPLEX OBJECT TYPE DEFINITIONS *********************************** -->
         <!-- ************** PART III: BEGIN ROOT ELEMENTS DEFINITIONS ********************************* -->
         <!-- 0) Profile wrapper root element
    Profile IS USED TO BE AN WRAPPER ELEMENT FOR ALL KIND OF PROFILES NO MATTER WHAT KIND OF PROFILE IT IS
    -->
         <xs:element name="Profile" type="ProfileType">
              <xs:annotation>
                   <xs:documentation>Profile IS USED TO BE AN WRAPPER ELEMENT FOR ALL KIND OF PROFILES NO MATTER WHAT KIND OF PROFILE IT IS</xs:documentation>
              </xs:annotation>
         </xs:element>
    </xs:schema>
    2)register xml schema:
    SQL> begin
    2 dbms_xmlschema.registerSchema
    3 (
    4 schemaurl=>'http://rac3-1-vip:8080/home/'||USER||'/xsd/EHIPProfile_v00.xsd',
    5 schemadoc=>xdbURIType('/home/'||USER||'/xsd/EHIPProfile_v00.xsd').getClob(),
    6 local=>True,
    7 gentypes=>True,
    8 genbean=>False,
    9 gentables=>False
    10 );
    11 End;
    12 /
    PL/SQL procedure successfully completed.
    SQL>
    SQL>
    3) xml data:
    <?xml version="1.0" encoding="UTF-8"?>
    <!--Sample XML file generated by XMLSpy v2007 sp2 (http://www.altova.com)-->
    <Profile xmlns="http://www.emergis.com/eHealth/EHIP/data/meta/profile:v1">
         <ProfileID Type="EnricherParametersProfile" Status="ACTIVE" ID="EnricherPP.ID.0001" Name="EnricherPP.ID.0001" Description="EnricherPP.ID.0001" Version="01"/>
         <ProfileData>
              <EnricherParametersProfileData>
                   <EnricherParameter serviceName="LRS_BusinessDomainObject.lrs.businessDomainObject.domainObjectBuilder.concrete.ExceptionCreators:createExceptionV50CategoryCanonicalPart" interactionID="">
                   <Enricher>
                        <Parameters>
                             <Parameter name="MESSAGE_ID" reference="test"/>
                        </Parameters>
                        <Section path="HEADER">
                             <Section path="RESPONSE_TYPE">
                                  <Value field="value" value="I"/>
                             </Section>
                             <Section path="HL7_STANDARD_VERSION">
                                  <Value field="value" value="HL7V3"/>
                             </Section>
                             <Section path="DESIRED_ACKNOWLEDGMENT_TYPE">
                                  <Value field="value" value="NE"/>
                             </Section>
                             <Section path="SENDING_NETWORK_ADDRESS">
                                  <Value field="value" value=""/>
                             </Section>
                             <Section path="SENDING_APPLICATION_IDENTIFIER">
                                  <Value field="root" value="2.16.840.1.113883.3.133.1.3"/>
                                  <Value field="extension" value=""/>
                             </Section>
                             <Section path="SENDING_APPLICATION_NAME">
                                  <Value field="value" value="NL HIAL"/>
                             </Section>
                        </Section>
                   </Enricher>
         </EnricherParameter>
              <EnricherParameter serviceName="LRS_BusinessDomainObject.lrs.businessDomainObject.domainObjectBuilder.concrete.DomainObjectCreators:createFindClientsAssociatedIdentifersRequestObject" interactionID="PRPA_IN101105CA">
                   <Enricher>
                        <Parameters>
                             <Parameter name="MESSAGE_ID" reference="test"/>
                        </Parameters>
                        <Section path="HEADER">
                             <Section path="RESPONSE_TYPE">
                                  <Value field="value" value="I"/>
                             </Section>
                             <Section path="HL7_STANDARD_VERSION">
                                  <Value field="value" value="HL7V3"/>
                             </Section>
                             <Section path="PROCESSING_CODE">
                                  <Value field="value" value="T"/>
                             </Section>
                             <!--
                             <Section path="PROCESSING_MODE_CODE">
                                  <Value field="value" value="T"/>
                             </Section>
                             -->                         
                             <Section path="DESIRED_ACKNOWLEDGMENT_TYPE">
                                  <Value field="value" value="NE"/>
                             </Section>
                             <Section path="RECEIVER_NETWORK_ADDRESS">
                                  <Value field="value" value="prsunew.moh.hnet.bc.ca"/>
                             </Section>
                             <Section path="RECEIVER_APPLICATION_IDENTIFIER">
                                  <Value field="root" value="2.16.840.1.113883.3.40.5.1"/>
                                  <Value field="extension" value=""/>
                             </Section>
                             <Section path="SENDING_NETWORK_ADDRESS">
                                  <Value field="value" value=""/>
                             </Section>
                             <Section path="SENDING_APPLICATION_IDENTIFIER">
                                  <Value field="root" value="2.16.840.1.113883.3.133.1.3"/>
                                  <Value field="extension" value=""/>
                             </Section>
                             <Section path="SENDING_APPLICATION_NAME">
                                  <Value field="value" value="NL HIAL"/>
                             </Section>
                        </Section>
                   </Enricher>
         </EnricherParameter>
              <EnricherParameter serviceName="LRS_BusinessDomainObject.lrs.businessDomainObject.domainObjectBuilder.concrete.DomainObjectContentEnrichers:enrichPRRequest" interactionID="">
    <!--Sample XML file generated by XMLSpy v2007 sp2 (http://www.altova.com)-->
    <Enricher>
         <Parameters>
              <Parameter name="MESSAGE_IDENTIFIER" reference="test"/>
         </Parameters>
         <Section path="HEADER">
              <Section path="HL7_STANDARD_VERSION">
                   <Value field="value" value="V3PR2"/>
              </Section>
              <!--POS/CPP populated ?-->
              <!--Not sure if this should be set as a variance within EHIP or if we expect the POS/CPP to provide this value-->
              <Section path="PROCESSING_CODE">
                   <Value field="value" value="T"/>
              </Section>
              <!--POS/CPP populated ?-->
              <Section path="PROCESSING_MODE_CODE">
                   <Value field="value" value="T"/>
              </Section>
              <!--POS/CPP populated ?-->
              <Section path="DESIRED_ACKNOWLEDGMENT_TYPE">
                   <Value field="value" value="NE"/>
              </Section>
              <!-- note:We Expect PRS to give us a web service address -->                    
              <!--<Section path="RECEIVER_NETWORK_ADDRESS">
                   <Value field="value" value="_http://PRSServer/svcName"/>
              </Section>
              -->
              <Section path="RECEIVER_APPLICATION_IDENTIFIER[0]">
                   <Value field="root" value="2.16.840.1.113883.3.40.1.14"/>
                   <Value field="extension" value="SIT1"/>
              </Section>
              <!-- note: values of the fields to be provided by PRS -->
              <Section path="RECEIVER_APPLICATION_NAME[0]">
                   <Value field="value" value="receiverAppName"/>
              </Section>
              <!-- note: RECEIVER_ORGANIZATION has an extra trailing space, as in the Excel mapping spreadsheet -->
              <!-- note: values of the fields to be specified by PRS later -->
              <Section path="RECEIVER_AGENT/RECEIVER_ORGANIZATION/RECEIVER_ORGANIZATION_IDENTIFIER[0]">
                   <Value field="root" value="2.16.840.1.113883.3.40.4.1"/>
                   <Value field="extension" value="receiverOrgId"/>
              </Section>
              <Section path="SENDING_APPLICATION_NAME[0]">
                   <Value field="value" value="NLPRSCLNT"/>
              </Section>
              <!-- note: SENDING_ORGANIZATION has an extra trailing space, as in the Excel mapping spreadsheet -->
              <!-- note: values of the fields to be specified by PRS later -->
              <Section path="SENDING_AGENT/SENDING_ORGANIZATION/SENDING_ORGANIZATION_IDENTIFIER[0]">
                   <Value field="root" value="2.16.840.1.113883.4.3.57"/>
                   <Value field="extension" value="3001"/>
              </Section>
              <Section path="PERFORMER/HEALTHCARE_WORKER_IDENTIFIER[0]">
                   <Value field="root" value="2.16.840.1.113883.4.3.57"/>
                   <Value field="extension" value="HIAL_USR"/>
              </Section>          
         </Section>
         <Section path="PAYLOAD">
              <!--<Section path="QUERY_STATUS_CODE">
                   <Value field="value" value="New"/>
              </Section>-->
              <!-- note: AUDIT has an extra trailing space, as in the Excel mapping spreadsheet -->
              <Section path="AUDIT[0]/AUDIT_INFORMATION">
                   <Value field="code" value="LATEST"/>
                   <Value field="codeSystem" value="PRSAuditParameters"/>
              </Section>
              <!-- note: CONFIDENCE has an extra trailing space, as in the Excel mapping spreadsheet -->
              <Section path="CONFIDENCE/CONFIDENCE_VALUE">
                   <Value field="value" value="100"/>
              </Section>
              <!-- note: HISTORY has an extra trailing space, as in the Excel mapping spreadsheet -->
              <Section path="HISTORY/INCLUDE_HISTORY_INDICATOR">
                   <Value field="value" value="false"/>
              </Section>
              <!-- note: JURISDICTION has an extra trailing space, as in the Excel mapping spreadsheet -->
              <Section path="JURISDICTION/JURISDICTION_TYPE">
                   <Value field="value" value="NL"/>
              </Section>
              <!-- note: RESPONSE_OBJECT has an extra trailing space, as in the Excel mapping spreadsheet -->
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[0]">
                   <Value field="code" value="GRS_ADDRESS"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[1]">
                   <Value field="code" value="GRS_ELECTRONIC_ADDRESS"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[2]">
                   <Value field="code" value="GRS_IDENTIFIER"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[3]">
                   <Value field="code" value="GRS_ORGANIZATION_NAME"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[4]">
                   <Value field="code" value="GRS_PERSONAL_NAME"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[5]">
                   <Value field="code" value="GRS_REGISTRY_IDENTIFIER"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[6]">
                   <Value field="code" value="GRS_TELEPHONE"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[7]">
                   <Value field="code" value="PRS_CONDITION"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[8]">
                   <Value field="code" value="PRS_CONFIDENTIALITY_INDICATOR"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[9]">
                   <Value field="code" value="PRS_DEMOGRAPHIC_DETAIL"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[10]">
                   <Value field="code" value="PRS_DISCIPLINARY_ACTION"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[11]">
                   <Value field="code" value="PRS_INFORMATION_ROUTE"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[12]">
                   <Value field="code" value="PRS_NOTE"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[13]">
                   <Value field="code" value="PRS_PROVIDER_CREDENTIAL"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[14]">
                   <Value field="code" value="PRS_PROVIDER_EXPERTISE"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[15]">
                   <Value field="code" value="PRS_PROVIDER_RELATIONSHIP"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[16]">
                   <Value field="code" value="PRS_STATUS"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[17]">
                   <Value field="code" value="PRS_WORK_LOCATION"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[18]">
                   <Value field="code" value="PRS_WORK_LOCATION_ADDRESS"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[19]">
                   <Value field="code" value="PRS_WORK_LOCATION_DETAIL"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[20]">
                   <Value field="code" value="PRS_WORK_LOCATION_ELECTRONIC_ADDRESS"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[21]">
                   <Value field="code" value="PRS_WORK_LOCATION_INFORMATION_ROUTE"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[22]">
                   <Value field="code" value="PRS_WORK_LOCATION_TELEPHONE"/>
              </Section>
              <!-- note: ROLE_CLASS has an extra trailing space, as in the Excel mapping spreadsheet -->
              <Section path="ROLE_CLASS /ROLE_CLASS_VALUE">
                   <Value field="value" value="LIC"/>
              </Section>
              <Section path="SORT_CONTROL[0]/SORT_CONTROL_ELEMENT_NAME">
                   <Value field="code" value="PrincipalPerson.name.value.family"/>
              </Section>
              <Section path="SORT_CONTROL[0]/SORT_CONTROL_DIRECTION_CODE">
                   <Value field="value" value="A"/>
              </Section>
         </Section>
    </Enricher>
         </EnricherParameter>
              </EnricherParametersProfileData>
         </ProfileData>
    </Profile>
    the data is valid against the schema through XML Spy tool... and loaded into the XDB repository...
    4) create table and insert data:
    SQL> CREATE TABLE EHIP_PROFILE OF SYS.XMLTYPE
    2 XMLSCHEMA "http://rac3-1-vip:8080/home/EHIPSBUSER1/xsd/EHIPProfile_v00.xsd" ELEMENT "Profile"
    3 ;
    Table created.
    SQL>
    SQL> alter table EHIP_PROFILE
    2 add CONSTRAINT EHIP_PROF_PK PRIMARY KEY(XMLDATA."ProfileID"."ID",XMLDATA."ProfileID"."Type");
    Table altered.
    SQL>
    SQL>
    SQL>
    SQL>
    SQL> select xdbURIType('/home/'||USER||'/ProfileData/EnricherPP.ID.0001.xml').getClob() from dual;
    XDBURITYPE('/HOME/'||USER||'/PROFILEDATA/ENRICHERPP.ID.0001.XML').GETCLOB()
    <?xml version="1.0" encoding="UTF-8"?>
    <!--Sample XML file generated by XMLSpy
    SQL>
    SQL>
    SQL> insert into ehip_profile values(xmltype.createXML(xdbURIType('/home/'||USER||'/ProfileData/EnricherPP.ID.0001.xml').getClob()));
    insert into ehip_profile values(xmltype.createXML(xdbURIType('/home/'||USER||'/ProfileData/EnricherPP.ID.0001.xml').getClob()))
    ERROR at line 1:
    ORA-21700: object does not exist or is marked for delete
    what's the problem caused the "ORA-21700: object does not exist or is marked for delete" error?
    Thanks in advance for your help?

    Thanks Marco,
    Here're my environment:
    SQL> select INSTANCE_NUMBER, INSTANCE_NAME,HOST_NAME,VERSION from v$instance;
    INSTANCE_NUMBER INSTANCE_NAME HOST_NAME VERSION
    2 rac32 RAC3-2 10.2.0.3.0
    I followed your suggested in the above, and always purge recyclebin, but still got the same problem. because in 10gr2, there's no dbms_xmlschema.purge_schema available,
    and I did checked the recyclebin after force the delete of schema, nothing inside. any other recommendation?

  • Problem inserting and querying XML data with a recursive XML schema

    Hello,
    I'm facing a problem with querying XML data that is valid against a recursive XML Schema. I have got a table category that stores data as binary XML using Oracle 11g Rel 2 on Windows XP. The XML Schema is the following:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="bold_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="keyword_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
                   <xs:element name="plain_text" type="xs:string"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="emph_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="text_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="parlist_type">
              <xs:sequence>
                   <xs:element name="listitem" minOccurs="0" maxOccurs="unbounded" type="listitem_type"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="listitem_type">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="parlist" type="parlist_type"/>
                   <xs:element name="text" type="text_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:element name="category">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="name"/>
                        <xs:element name="description">
                                  <xs:complexType>
                                            <xs:choice>
                                                           <xs:element name="text" type="text_type"/>
                                                           <xs:element name="parlist" type="parlist_type"/>
                                            </xs:choice>
                                  </xs:complexType>
                        </xs:element>
                                                                </xs:sequence>
                                                                <xs:attribute name="id"/>
                                            </xs:complexType>
                        </xs:element>
    </xs:schema>I registered this schema and created the category table. Then I inserted a new row using the code below:
    insert into category_a values
    (XMlElement("category",
          xmlattributes('categoryAAA' as "id"),
          xmlforest ('ma categ' as "name"),
          (xmlelement("description", (xmlelement("text", 'find doors blest now whiles favours carriage tailor spacious senses defect threat ope willow please exeunt truest assembly <keyword> staring travels <bold> balthasar parts attach </bold> enshelter two <emph> inconsiderate ways preventions </emph> preventions clasps better affections comes perish </keyword> lucretia permit street full meddle yond general nature whipp <emph> lowness </emph> grievous pedro')))    
    The row is successfully inserted as witnessed by the results of row counting. However, I cannot extract data from the table. First, I tried using SqlPlus* which hangs up and quits after a while. I then tried to use SQL Developer, but haven't got any result. Here follow some examples of queries and their results in SQL Developer:
    Query 1
    select * from category
    Result : the whole row is returned
    Query 2
    select xmlquery('$p/category/description' passing object_value as "p" returning content) from category
    Result: "SYS.XMLTYPE"
    now I tried to fully respect the nested structure of description element in order to extract the text portion of <bold> using this query
    Query 3
    select  xmlquery('$p/category/description/text/keyword/bold/text()' passing object_value as "p" returning content) from  category_a
    Result: null
    and also tried to extract the text portion of element <text> using this query
    Query 4
    select  xmlquery('$p/category/description/text/text()' passing object_value as "p" returning content) from  category_a
    Result: "SYS.XMLTYPE".
    On the other hand, I noticed, from the result of query 1, that the opening tags of elements keyword and bold are encoded as the less than operator "&lt;". This explains why query 3 returns NULL. However, query 4 should display the text content of <text>, which is not the case.
    My questions are about
    1. How to properly insert the XML data while preserving the tags (especially the opening tag).
    2. How to display the data (the text portion of the main Element or of the nested elements).
    The problem about question 1 is that it is quite unfeasible to write a unique insert statement because the structure of <description> is recursive. In other words, if the structure of <description> was not recursive, it would be possible to embed the elements using the xmlelement function during the insertion.
    In fact, I need to insert the content of <description> from a source table (called category_a) into a target table (+category_b+) automatically .
    I filled category_a using the Saxloader utility from an flat XML file that I have generated from a benchmark. The content of <description> is different from one row to another but it is always valid with regards to the XML Schema. The data is properly inserted as witnessed by the "select * from category_a" instruction (500 row inserted). Besides, the opening tags of the nested elements under <description> are preserved (no "&lt;"). Then I wrote a PL/SQL procedure in which a cursor extracts the category id and category name into varchar2 variables and description into an XMLtype variable from category_a. When I try to insert the values into a category_b, I get the follwing error:
    LSX-00213: only 0 occurrences of particle "text", minimum is 1which tells that the <text> element is absent (actually it is present in the source table).
    So, my third question is why are not the tags recognized during the insertion?
    Can anyone help please?

    Hello,
    indded, I was using an old version of Sqlplus* (8.0.60.0.0) because I had a previous installation (oracle 10g XE). Instead, I used the Sqlplus* shipped with the 11g2database (version 11.2.0.1.0). All the queries that I wrote work fine and display the data correctly.
    I also used the XMLSERIALIZE function and can now display the description content in SQL Developer.
    Thank you very much.
    To answer your question Marco, I registered the XML Schema using the following code
    declare
      doc varchar2(4000) := '<?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="bold_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="keyword_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
                   <xs:element name="plain_text" type="xs:string"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="emph_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="text_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="parlist_type">
              <xs:sequence>
                   <xs:element name="listitem" minOccurs="0" maxOccurs="unbounded" type="listitem_type"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="listitem_type">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="parlist" type="parlist_type"/>
                   <xs:element name="text" type="text_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:element name="category">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="name"/>
                        <xs:element name="description">
                                  <xs:complexType>
                                            <xs:choice>
                                                           <xs:element name="text" type="text_type"/>
                                                           <xs:element name="parlist" type="parlist_type"/>
                                            </xs:choice>
                                  </xs:complexType>
                        </xs:element>
                                                                </xs:sequence>
                                                                <xs:attribute name="id"/>
                                            </xs:complexType>
                        </xs:element>
    </xs:schema>';
    begin
      dbms_xmlschema.registerSchema('/xmldb/category_auction.xsd', doc,     LOCAL      => FALSE, 
            GENTYPES   => FALSE,  GENBEAN    => FALSE,   GENTABLES  => FALSE,
             FORCE      => FALSE,
             OPTIONS    => DBMS_XMLSCHEMA.REGISTER_BINARYXML,
             OWNER      => USER);
    end;then, I created the Category table as follows:
    CREATE TABLE category_a of XMLType XMLTYPE store AS BINARY XML
        XMLSCHEMA "xmldb/category_auction.xsd" ELEMENT "category";Now, there still remains a problem of how to insert the "description" content which I serialized as a CLOB data into another table as XML. To this purpose, I wrote a view over the Category_a table as follows:
    CREATE OR REPLACE FORCE VIEW "AUCTION_XWH"."CATEGORY_V" ("CATEGORY_ID", "CNAME", "DESCRIPTION") AS
      select category_v."CATEGORY_ID",category_v."CNAME",
      XMLSerialize(content ( xmlquery('$p/category/description/*' passing object_value as "p" returning content)) as clob) as "DESCRIPTION"
      from  auction.category_a p, 
    xmltable ('$a/category' passing p.Object_Value as "a"
    columns  category_id varchar2(15) path '@id',
              cname varchar2(20) path 'name') category_v;Then, I wrote a procedure to insert data into the Category_xwh table (the source and target tables are slightly different: the common elements are just copied wereas new elements are created in the target table). The code of the procedure is the following:
    create or replace PROCEDURE I_CATEGORY AS
    v_cname VARCHAR2(30);
    v_description clob ;
    v_category_id VARCHAR2(15);
    cursor mycursor is select category_id, cname, description from category_v;
    BEGIN
    open mycursor;
      loop
      /*retrieving the columns*/
      fetch mycursor into v_category_id, v_cname, v_description ;
      exit when mycursor%notfound;
      insert into category_xwh values
      (XMlElement("category",
          xmlattributes(v_category_id as "category_id"),
          xmlelement("Hierarchies", xmlelement("ObjHierarchy", xmlelement ("H_Cat"),
                                                               xmlelement ("Rollsup",
                                                                                  (xmlelement("all_categories",
                                                                                   xmlattributes('allcategories' as "all_category_id")))
        xmlforest (
                  v_cname as "cat_name",
                  v_description as "description")    
    end loop;
      commit;
      close mycursor;
    END I_CATEGORY;When I execute the procedure, I get the following error:
    LSX-00201: contents of "description" should be elements onlyso, I just wonder if this is because v_description is considered as plain text and not as XML text, even if its content is XML. Do I need to use a special function to cast the CLOB as XML?
    Thanks for your help.
    Doulkifli

  • XML Schemas embedded in Forms TIPS

    I have been having a lot of trouble with embedding an XML Schema into my form to be used with a Workflow. The first problem appears to be that if you create a form and the very "FIRST" dataconnection is not to your schema, the workflow designer will not see it. The only way around this was to manually edit the XML behind the form so that it was the first connection (not fun).
    The other issue I have makes sense. I had my schema in the same folder as my form on my local machine, so when I bound my schema to the folder, it just put ./schema.xsd as the location of the schema. When I loaded the form into the Form Manager, I also uploaded the schema into the same folder. When I made a change to my schema on my local copy, I forgot to change the copy I had put in the Form Manager, so even though I was making the change to my form and re-saving the form again with the check-box to embed the schema, the workflow designer never saw it. When you export a workflow, there is no reference to the schema, so it must just look at the form variable that you defined.

    Hi Dave
    In my experience, the "embed" option does actually work. However, you need to restart Workflow Designer if you change the embedded schema, because WFD caches the schema, and will not refresh it if it's changed.
    As far as I'm aware, WF will not follow the link to a non-embedded schema.
    Howard
    http://www.avoka.com

  • How does XML DB handle XML Schema Validation ?

    In order to validate an XML document against an XML Schema using Oracle XML DB the XML Schema must first be registered with XML DB using the method registerSchema provided by the package DBMS_XMLSCHEMA.
    XDB provides two types of schema validation, 'Lax' Validation and 'Strict' Validation.
    'Lax' validation takes place whenever a schema based document is converted from it's textual representation into the XML DB internal object model. Errors caught by this validation will be prefixed with 'ORA'.
    'Stict' validation takes place when the XMLType methods schemaValidate() or isSchemaValid() are invoked.
    The schemaValidate() method throws an exception with an error message indicating what is wrong it encounteres an invalid document. The error message associated with the exception will be prefixed with LSX.
    The isSchemaValid() method returns true or false, depending on whether or not the document is valid. It cannot return any information about why the document is invalid.
    The reason for having both the Lax and Strict validation models is that Strict validation is much more expensive in terms of CPU and memory usage than Lax validation.

    Here are some examples of what is caught by Lax validation (ORA errors) and what is only caught by Strict validation (LSX errors).
    SQL> begin
      2     dbms_xmlschema.registerSchema('test',xmltype(
      3  '<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.co
    eFormDefault="unqualified">
      4     <xs:complexType name="RootType">
      5             <xs:sequence>
      6                     <xs:element name="Mandatory"/>
      7                     <xs:element name="Enumeration">
      8                             <xs:simpleType>
      9                                     <xs:restriction base="xs:string">
    10                                             <xs:enumeration value="A"/>
    11                                             <xs:enumeration value="B"/>
    12                                             <xs:enumeration value="C"/>
    13                                     </xs:restriction>
    14                             </xs:simpleType>
    15                     </xs:element>
    16                     <xs:element name="MinLength">
    17                             <xs:simpleType>
    18                                     <xs:restriction base="xs:string">
    19                                             <xs:minLength value="4"/>
    20                                             <xs:maxLength value="20"/>
    21                                     </xs:restriction>
    22                             </xs:simpleType>
    23                     </xs:element>
    24                     <xs:element name="MaxLength">
    25                             <xs:simpleType>
    26                                     <xs:restriction base="xs:string">
    27                                             <xs:minLength value="1"/>
    28                                             <xs:maxLength value="4"/>
    29                                     </xs:restriction>
    30                             </xs:simpleType>
    31                     </xs:element>
    32                     <xs:element name="MaxOccurs" type="xs:string" maxOccurs="2"/>
    33                     <xs:element name="MinOccurs" minOccurs="2" maxOccurs="2"/>
    34                     <xs:element name="Optional" type="xs:string" minOccurs="0"/>
    35             </xs:sequence>
    36     </xs:complexType>
    37     <xs:element name="Root" type="RootType" xdb:defaultTable="ROOT_TABLE"/>
    38  </xs:schema>'));
    39  end;
    40  /
    PL/SQL procedure successfully completed.
    SQL> --
    SQL> -- Valid Document
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11     <Optional>Goodbye</Optional>
    12  </Root>'
    13  ))
    14  /
    1 row created.
    SQL> --
    SQL> -- Undefined element 'Illegal'
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Illegal>Hello World</Illegal>
      5     <Enumeration>A</Enumeration>
      6     <MinLength>ABCD</MinLength>
      7     <MaxLength>WXYZ</MaxLength>
      8     <MaxOccurs>1</MaxOccurs>
      9     <MaxOccurs>2</MaxOccurs>
    10     <MinOccurs>1</MinOccurs>
    11     <MinOccurs>2</MinOccurs>
    12     <Optional>Goodbye</Optional>
    13  </Root>'
    14  ))
    15  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-30937: No schema definition for 'Illegal' (namespace '##local') in parent
    '/Root'
    SQL> --
    SQL> -- Multiple occurences of 'Optional'
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11     <Optional>Goodbye</Optional>
    12     <Optional>Goodbye</Optional>
    13  </Root>'
    14  ))
    15  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-30936: Maximum number (1) of 'Optional' XML node elements exceeded
    SQL> --
    SQL> -- Missing element 'Manadatory'
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Enumeration>A</Enumeration>
      4     <MinLength>ABCD</MinLength>
      5     <MaxLength>WXYZ</MaxLength>
      6     <MaxOccurs>1</MaxOccurs>
      7     <MaxOccurs>2</MaxOccurs>
      8     <MinOccurs>1</MinOccurs>
      9     <MinOccurs>2</MinOccurs>
    10     <Optional>Goodbye</Optional>
    11  </Root>'
    12  ))
    13  /
    1 row created.
    SQL> --
    SQL> -- Invalid Enumeration Value
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>Z</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11     <Optional>Goodbye</Optional>
    12  </Root>'
    13  ))
    14  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-31038: Invalid enumeration value: "Z"
    SQL> --
    SQL> -- MinLength Violation
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABC</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11     <Optional>Goodbye</Optional>
    12  </Root>'
    13  ))
    14  --
    15  -- MaxLength Violation
    16  --
    17  /
    1 row created.
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>VWXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11     <Optional>Goodbye</Optional>
    12  </Root>'
    13  ))
    14  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-30951: Element or attribute at Xpath /Root/MaxLength exceeds maximum length
    SQL> --
    SQL> -- Missing element Optional - Valid Document
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11  </Root>'
    12  ))
    13  /
    1 row created.
    SQL> --
    SQL> -- Too many instances of 'MaxOccurs'
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MaxOccurs>3</MaxOccurs>
    10     <MinOccurs>1</MinOccurs>
    11     <MinOccurs>2</MinOccurs>
    12     <Optional>Goodbye</Optional>
    13  </Root>'
    14  ))
    15  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-30936: Maximum number (2) of 'MaxOccurs' XML node elements exceeded
    SQL> --
    SQL> -- Too few instances of 'MinOccurs'
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <Optional>Goodbye</Optional>
    11  </Root>'
    12  ))
    13  /
    1 row created.
    SQL> create trigger validateSchema
      2  before insert on ROOT_TABLE
      3  for each row
      4  begin
      5     :new.object_value.schemaValidate();
      6  end;
      7  /
    Trigger created.
    SQL> --
    SQL> -- Valid Document
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11     <Optional>Goodbye</Optional>
    12  </Root>'
    13  ))
    14  /
    1 row created.
    SQL> --
    SQL> -- Undefined element 'Illegal'
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Illegal>Hello World</Illegal>
      5     <Enumeration>A</Enumeration>
      6     <MinLength>ABCD</MinLength>
      7     <MaxLength>WXYZ</MaxLength>
      8     <MaxOccurs>1</MaxOccurs>
      9     <MaxOccurs>2</MaxOccurs>
    10     <MinOccurs>1</MinOccurs>
    11     <MinOccurs>2</MinOccurs>
    12     <Optional>Goodbye</Optional>
    13  </Root>'
    14  ))
    15  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-30937: No schema definition for 'Illegal' (namespace '##local') in parent
    '/Root'
    SQL> --
    SQL> -- Multiple occurences of 'Optional'
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11     <Optional>Goodbye</Optional>
    12     <Optional>Goodbye</Optional>
    13  </Root>'
    14  ))
    15  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-30936: Maximum number (1) of 'Optional' XML node elements exceeded
    SQL> --
    SQL> -- Missing element 'Manadatory'
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Enumeration>A</Enumeration>
      4     <MinLength>ABCD</MinLength>
      5     <MaxLength>WXYZ</MaxLength>
      6     <MaxOccurs>1</MaxOccurs>
      7     <MaxOccurs>2</MaxOccurs>
      8     <MinOccurs>1</MinOccurs>
      9     <MinOccurs>2</MinOccurs>
    10     <Optional>Goodbye</Optional>
    11  </Root>'
    12  ))
    13  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00213: only 0 occurrences of particle "Mandatory", minimum is 1
    ORA-06512: at "SYS.XMLTYPE", line 345
    ORA-06512: at "XDBTEST.VALIDATESCHEMA", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.VALIDATESCHEMA'
    SQL> --
    SQL> -- Invalid Enumeration Value
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>Z</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11     <Optional>Goodbye</Optional>
    12  </Root>'
    13  ))
    14  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-31038: Invalid enumeration value: "Z"
    SQL> --
    SQL> -- MinLength Violation
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABC</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11     <Optional>Goodbye</Optional>
    12  </Root>'
    13  ))
    14  --
    15  -- MaxLength Violation
    16  --
    17  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00221: "ABC" is too short (minimum length is 4)
    ORA-06512: at "SYS.XMLTYPE", line 345
    ORA-06512: at "XDBTEST.VALIDATESCHEMA", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.VALIDATESCHEMA'
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>VWXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11     <Optional>Goodbye</Optional>
    12  </Root>'
    13  ))
    14  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-30951: Element or attribute at Xpath /Root/MaxLength exceeds maximum length
    SQL> --
    SQL> -- Missing element Optional - Valid Document
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11  </Root>'
    12  ))
    13  /
    1 row created.
    SQL> --
    SQL> -- Too many instances of 'MaxOccurs'
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MaxOccurs>3</MaxOccurs>
    10     <MinOccurs>1</MinOccurs>
    11     <MinOccurs>2</MinOccurs>
    12     <Optional>Goodbye</Optional>
    13  </Root>'
    14  ))
    15  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-30936: Maximum number (2) of 'MaxOccurs' XML node elements exceeded
    SQL> --
    SQL> -- Too few instances of 'MinOccurs'
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <Optional>Goodbye</Optional>
    11  </Root>'
    12  ))
    13  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00213: only 1 occurrences of particle "MinOccurs", minimum is 2
    ORA-06512: at "SYS.XMLTYPE", line 345
    ORA-06512: at "XDBTEST.VALIDATESCHEMA", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.VALIDATESCHEMA'
    SQL>

  • How to identify objects created by registering xml schema

    Hi Everyone,
    We are using Oracle 9i Rel2. I have registered an XML schema and I saw that there were several objects created for it table ,some types and a trigger . For some build purposes I want to exclude all of these objects which are associated with xml schema and should be able to drop and recreate the whole of oracle schema.
    I see the user_types table does not have any parameter to indicate that these are autogenerated or are different. In user_types they look like any other type that a user would have created. Do any of you know how to differentiate these types created by registering XML schemas from the normal types.
    Thanks for your help

    There is no way I know of to differentiate between a type created by Schema Registration and another Type. You can query the XML Schema itslef to get the Typenames it relies on.
    SQL> --
    SQL> SQL> select nvl(extractvalue
    2 (
    3 value(ct),
    4 '/xs:complexType/@name',
    5 'xmlns:xs="http://www.w3.org/2001/XMLSchema"
    6 xmlns:xdb="http://xmlns.oracle.com/xdb"'
    7 ),'Local Complex Type') COMPLEX_TYPE,
    8 extractvalue
    9 (
    10 value(ct),
    11 '/xs:complexType/@xdb:SQLType',
    12 'xmlns:xs="http://www.w3.org/2001/XMLSchema"
    13 xmlns:xdb="http://xmlns.oracle.com/xdb"'
    14 ) SQL_TYPE
    15 from user_xml_schemas,
    16 table
    17 (
    18 xmlsequence
    19 (
    20 extract
    21 (
    22 schema,
    23 '//xs:complexType',
    24 'xmlns:xs="http://www.w3.org/2001/XMLSchema"
    25 xmlns:xdb="http://xmlns.oracle.com/xdb"'
    26 )
    27 )
    28 ) ct
    29 /
    COMPLEX_TYPE
    SQL_TYPE
    PurchaseOrderType
    PURCHASEORDER_T
    LineItemsType
    LINEITEMS_T
    LineItemType
    LINEITEM_T
    COMPLEX_TYPE
    SQL_TYPE
    PartType
    PART_T
    ActionsType
    ACTIONS_T
    Local Complex Type
    ACTION_T
    COMPLEX_TYPE
    SQL_TYPE
    RejectionType
    REJECTION_T
    ShippingInstructionsType
    SHIPPING_INSTRUCTIONS_T
    Local Complex Type
    ROOT_T
    COMPLEX_TYPE
    SQL_TYPE
    Local Complex Type
    P222_T
    10 rows selected.
    SQL>

  • How to fix "ORA-31038:Invalid value ..." in a XML schema

    Hello,
    We are in 11gR2 :
    select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE    11.2.0.2.0      Production
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - ProductionWe load XML files based on a registered XML schema.
    Here is the top of our XML schema:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:xdb="http://xmlns.oracle.com/xdb"
             xmlns="http://www.capgemini.com/xsd/projet.xsd"
             targetNamespace="http://www.capgemini.com/xsd/projet.xsd"
             elementFormDefault="unqualified"
             blockDefault="#all">
      <xsd:element name="WORKBENCH_PROJECT" xdb:defaultTable="WORKBENCH_PROJECT_TABLE">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="BaseCalendars"/>
            <xsd:element ref="PoolResources"/>
            <xsd:element ref="Projects"/>
          </xsd:sequence>
    ...We experience error ORA-31038: Invalid number value ... at the load of the XML, when the focus goes to a string type attribute :
    Here it is :
            <Task
              UID="AJ\&apos;UF`2=_```)O0H;&quot;P!```?P```0" earlyStart="2010-04-20T08:00:00" category="Run"
              baseTime="2010-03-26T09:22:00" lateStart="2010-04-20T08:00:00" start="2010-04-20T08:00:00"
              proxy="false" earlyFinish="2010-05-12T17:00:00" lateFinish="2010-05-12T17:00:00"
              critical="true" status="2" shortName="OASIS 3.2" outlineLevel="4" baseFinish="2010-06-11T17:00:00"
              finish="2010-05-12T17:00:00" summary="false" baseStart="2010-05-17T08:00:00" baselineDuration="20.0"
              milestone="false" name="OASI 3.2.1 : Association d&apos;un plan à un PFO" fixed="true"
              locked="false" key="false" percComp="1.0" totalSlack="0.0" unplanned="false">
              <Assignments>
                <Assignment
                  status="2" actualWork="24.0" resourceID="SMOUFLIH" start="2010-04-20T08:00:00" baselineWork="0.0"
    Here is the XML schema part where the load fails ( at the attribute *<xsd:attribute name="name" type="xsd:string"/>* ) :
      <xsd:element name="Task" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Assignments" minOccurs="0"/>
            <xsd:element ref="BaselineDetails" minOccurs="0"/>
            <xsd:element ref="Constraints" minOccurs="0"/>
            <xsd:element ref="Notes" minOccurs="0"/>
          </xsd:sequence>
          <xsd:attribute name="UID"/>
          <xsd:attribute name="taskID" type="xsd:string"/>
          <xsd:attribute name="baseFinish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="baseStart" type="xsd:NMTOKEN"/>
          <xsd:attribute name="baseTime" type="xsd:NMTOKEN"/>
          <xsd:attribute name="baselineDuration" type="xsd:decimal"/>
          <xsd:attribute name="category" type="xsd:string"/>
          <xsd:attribute name="critical" type="xsd:string"/>
          <xsd:attribute name="earlyFinish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="earlyStart" type="xsd:NMTOKEN"/>
          <xsd:attribute name="finish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="fixed" type="xsd:string"/>
          <xsd:attribute name="guidelines" type="xsd:string"/>
          <xsd:attribute name="key" type="xsd:string"/>
          <xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
          <xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
          <xsd:attribute name="lateFinish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="lateStart" type="xsd:NMTOKEN"/>
          <xsd:attribute name="locked" type="xsd:string"/>
          <xsd:attribute name="methodID" type="xsd:string"/>
          <xsd:attribute name="milestone" type="xsd:string"/>
          <xsd:attribute name="name" type="xsd:string"/>
          <xsd:attribute name="outlineLevel" type="xsd:integer"/>
          <xsd:attribute name="percComp" type="xsd:decimal"/>
          <xsd:attribute name="priority" type="xsd:string"/>
          <xsd:attribute name="proxy" type="xsd:string"/>
          <xsd:attribute name="shortName" type="xsd:string"/>
          <xsd:attribute name="start" type="xsd:NMTOKEN"/>
          <xsd:attribute name="status" type="xsd:integer"/>
          <xsd:attribute name="summary" type="xsd:string"/>
          <xsd:attribute name="totalSlack" type="xsd:double"/>
          <xsd:attribute name="unplanned" type="xsd:string"/>
          <xsd:attribute name="userText1" type="xsd:string"/>
          <xsd:attribute name="userText2" type="xsd:string"/>
          <xsd:attribute name="userText3" type="xsd:string"/>
          <xsd:attribute name="userText4" type="xsd:string"/>
          <xsd:attribute name="userText5" type="xsd:string"/>
      We know how to fix it manually :
    The workaround is to :
    remove all "&apos;" in each attribute called "name" But we suppose we need to amend the XML schema with a proper change. And we don't know how to do this.
    The weird is that we've never noticed this error earlier on a 11gR1 DB... This error only occurs on our brand new 11.2.0.2
    I hope it's clear enough for your understanding.
    Do you have any advice ?
    Thanks in advance,
    Olivier

    What are your NLS Settings
    SQL> select *
      2  from nls_database_parameters
      3  where parameter in ('NLS_LANGUAGE', 'NLS_TERRITORY', 'NLS_CHARACTERSET');
    PARAMETER                                SQL> select *
      2  from nls_database_parameters
      3  where parameter in ('NLS_LANGUAGE', 'NLS_TERRITORY', 'NLS_CHARACTERSET');
    PARAMETER                    VALUE
    NLS_LANGUAGE              AMERICAN
    NLS_TERRITORY             AMERICA
    NLS_CHARACTERSET       AL32UTF8
    SQL>With my settings I do not see a problem with a cut-down test...
    SQL> spool testcase.log
    SQL> --
    SQL> connect sys/oracle as sysdba
    Connected.
    SQL> --
    SQL> set define on
    SQL> set timing on
    SQL> --
    SQL> def USERNAME = CG
    SQL> --
    SQL> def PASSWORD = &USERNAME
    SQL> --
    SQL> -- def XMLDIR = &1
    SQL> --
    SQL> def USER_TABLESPACE = USERS
    SQL> --
    SQL> def TEMP_TABLESPACE = TEMP
    SQL> --
    SQL> drop user &USERNAME cascade
      2  /
    old   1: drop user &USERNAME cascade
    new   1: drop user CG cascade
    User dropped.
    Elapsed: 00:00:01.72
    SQL> grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD
      2  /
    old   1: grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD
    new   1: grant create any directory, drop any directory, connect, resource, alter session, create view to CG identified by CG
    Grant succeeded.
    Elapsed: 00:00:00.01
    SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
      2  /
    old   1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
    new   1: alter user CG default tablespace USERS temporary tablespace TEMP
    User altered.
    Elapsed: 00:00:00.01
    SQL> connect &USERNAME/&PASSWORD
    Connected.
    SQL> --
    SQL> -- create or replace directory XMLDIR as '&XMLDIR'
    SQL> -- /
    SQL> var SCHEMAURL1    varchar2(256)
    SQL> VAR XMLSCHEMA1    CLOB;
    SQL> VAR INSTANCE1     CLOB;
    SQL> --
    SQL> set define off
    SQL> --
    SQL> alter session set events='31098 trace name context forever'
      2  /
    Session altered.
    Elapsed: 00:00:00.00
    SQL> begin
      2    :SCHEMAURL1:= 'http://xmlns.example.com/testcase.xsd';
      3    :XMLSCHEMA1 :=
      4  '<?xml version="1.0" encoding="UTF-8"?>
      5  <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="qualified" attributeFormDefault="unqualified">
      6     <xsd:element name="Task" xdb:defaultTable="TASK_TABLE">
      7      <xsd:complexType xdb:maintainDOM="false">
      8        <xsd:sequence>
      9          <xsd:element name="Notes" type="xsd:string" minOccurs="0"/>
    10        </xsd:sequence>
    11        <xsd:attribute name="UID"/>
    12        <xsd:attribute name="taskID" type="xsd:string"/>
    13        <xsd:attribute name="baseFinish" type="xsd:NMTOKEN"/>
    14        <xsd:attribute name="baseStart" type="xsd:NMTOKEN"/>
    15        <xsd:attribute name="baseTime" type="xsd:NMTOKEN"/>
    16        <xsd:attribute name="baselineDuration" type="xsd:decimal"/>
    17        <xsd:attribute name="category" type="xsd:string"/>
    18        <xsd:attribute name="critical" type="xsd:string"/>
    19        <xsd:attribute name="earlyFinish" type="xsd:NMTOKEN"/>
    20        <xsd:attribute name="earlyStart" type="xsd:NMTOKEN"/>
    21        <xsd:attribute name="finish" type="xsd:NMTOKEN"/>
    22        <xsd:attribute name="fixed" type="xsd:string"/>
    23        <xsd:attribute name="guidelines" type="xsd:string"/>
    24        <xsd:attribute name="key" type="xsd:string"/>
    25        <xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
    26        <xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
    27        <xsd:attribute name="lateFinish" type="xsd:NMTOKEN"/>
    28        <xsd:attribute name="lateStart" type="xsd:NMTOKEN"/>
    29        <xsd:attribute name="locked" type="xsd:string"/>
    30        <xsd:attribute name="methodID" type="xsd:string"/>
    31        <xsd:attribute name="milestone" type="xsd:string"/>
    32        <xsd:attribute name="name" type="xsd:string"/>
    33        <xsd:attribute name="outlineLevel" type="xsd:integer"/>
    34        <xsd:attribute name="percComp" type="xsd:decimal"/>
    35        <xsd:attribute name="priority" type="xsd:string"/>
    36        <xsd:attribute name="proxy" type="xsd:string"/>
    37        <xsd:attribute name="shortName" type="xsd:string"/>
    38        <xsd:attribute name="start" type="xsd:NMTOKEN"/>
    39        <xsd:attribute name="status" type="xsd:integer"/>
    40        <xsd:attribute name="summary" type="xsd:string"/>
    41        <xsd:attribute name="totalSlack" type="xsd:double"/>
    42        <xsd:attribute name="unplanned" type="xsd:string"/>
    43        <xsd:attribute name="userText1" type="xsd:string"/>
    44        <xsd:attribute name="userText2" type="xsd:string"/>
    45        <xsd:attribute name="userText3" type="xsd:string"/>
    46        <xsd:attribute name="userText4" type="xsd:string"/>
    47        <xsd:attribute name="userText5" type="xsd:string"/>
    48             </xsd:complexType>
    49     </xsd:element>
    50  </xsd:schema>';
    51    :INSTANCE1 :=
    52  '<Task
    53            UID="AJ\&apos;UF`2=_```)O0H;&quot;P!```?P```0" earlyStart="2010-04-20T08:00:00" category="Run"
    54            baseTime="2010-03-26T09:22:00" lateStart="2010-04-20T08:00:00" start="2010-04-20T08:00:00"
    55            proxy="false" earlyFinish="2010-05-12T17:00:00" lateFinish="2010-05-12T17:00:00"
    56            critical="true" status="2" shortName="OASIS 3.2" outlineLevel="4" baseFinish="2010-06-11T17:00:00"
    57            finish="2010-05-12T17:00:00" summary="false" baseStart="2010-05-17T08:00:00" baselineDuration="20.0"
    58            milestone="false" name="OASI 3.2.1 : Association d&apos;un plan A  un PFO" fixed="true"
    59            locked="false" key="false" percComp="1.0" totalSlack="0.0" unplanned="false"/>';
    60  end;
    61  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    SQL> set define on
    SQL> --
    SQL> declare
      2    V_XML_SCHEMA xmlType := XMLType(:XMLSCHEMA1);
      3  begin
      4    DBMS_XMLSCHEMA.registerSchema
      5    (
      6      SCHEMAURL        => :SCHEMAURL1,
      7      SCHEMADOC        => V_XML_SCHEMA,
      8      LOCAL            => TRUE,
      9      GENBEAN          => FALSE,
    10      GENTYPES         => TRUE,
    11      GENTABLES        => TRUE,
    12      ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    13    );
    14  end;
    15  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.46
    SQL> desc TASK_TABLE
    Name                                      Null?    Type
    TABLE of SYS.XMLTYPE(XMLSchema "http://xmlns.example.com/testcase.xsd" Element "Task") STORAGE Object-relational TYPE "Task3632_T"
    SQL> --
    SQL> insert into TASK_TABLE values ( XMLTYPE(:INSTANCE1))
      2  /
    1 row created.
    Elapsed: 00:00:00.01
    SQL> commit
      2  /
    Commit complete.
    Elapsed: 00:00:00.09and am able to extract the value of the name attribute correct
    SQL> select XMLCAST(XMLQUERY('/Task/@name' passing OBJECT_VALUE returning content) as VARCHAR2(64))
      2    from TASK_TABLE
      3  /
    XMLCAST(XMLQUERY('/TASK/@NAME'PASSINGOBJECT_VALUERETURNINGCONTEN
    OASI 3.2.1 : Association d'un plan A  un PFO
    Elapsed: 00:00:00.00Could you try this simplied test in your database...
    Edited by: mdrake on Nov 30, 2010 8:36 PM

Maybe you are looking for

  • Updating custom field in table EKKO within user exit when PO is saved

    I am trying to update a custom field in table EKKO when a PO is saved.  I am using FM EXIT_SAPMM06E_013, within enhancement MM06E005.  Since EKKO is not a table that can be updated with this user exit, I am using a technic that I read about on SDN wh

  • How to use windows environment variable "%appdata%" in TEXT_IO built-in

    Hello Sir/Madam, I'm currently using TEXT_IO built-in package to write data file user's "C" drive in Oracle Forms 6i on Windows XP OS. We are in the process of upgrading the OS to Windows7. This new version does not allow to write to "C" or "D" drive

  • Smart cover lock option not show in setting in new ipad

    hi i have a new ipad 64 wi-fi 4g and i used smart cover. when i conected smart cover to new ipad, in setting>general not show smart lock. plese help me

  • ABAP APIs / Java APIs (MDM Extraction)

    Hi All, If I have to extract data out of MDM Repository without using the MDM Syndication functionality, How can I do that? I know there is something called ABAP APIs / Java APIs. Can this ABAP/Java APIs be used to extract data out of MDM Repositorie

  • Uploading songs from IPOD onto new OS

    My computer crashed and needed to be reformatted, so I lost everything. When I reformatted, I downloaded the newest version of ITunes. When I hooked up my Ipod though, it tell me that I have to erase all of my songs. Is there any way around this? Any