Generation of XML Schema according to Table structure

Hi all !,
I am extracting the data from the database and creating an XML file with corresponding data elements. I can do it successfully. Is there any way to generate the XML schema file based on the structure of the Table, dynamically? Please help.
Thanks in advance.
All efforts will be appreciated.
Regards

look at source code of XMLVisualisator http://ententee.com

Similar Messages

  • 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?

  • Generating an XML schema for a TABLE

    Hi,
    I know I can easily export DATA into an XML file, but Sql Developer can also generate an XML schema for a table LAYOUT. Does anyone know how this is done?
    I did it some time ago and have been unable to do it again.
    Thanks

    Hi Thanks for the response. Yes, what you say is the type of thing I mean. The snippet below was actually created using SqlDeveloper, but I just can't seem to be able to do it again :-(
    <?xml version='1.0' encoding='Cp1252' ?>
    <results>
         <row>
              <Column_Name><![CDATA[AD_UNIT_ID]]></Column_Name>
              <Data_Type><![CDATA[NUMBER(5,0)]]></Data_Type>
              <Nullable><![CDATA[Yes]]></Nullable>
              <Data_Default><![CDATA[]]></Data_Default>
              <COLUMN_ID><![CDATA[1]]></COLUMN_ID>
              <Primary_Key><![CDATA[]]></Primary_Key>
              <COMMENTS><![CDATA[]]></COMMENTS>
         </row>
         <row>
              <Column_Name><![CDATA[AD_UNIT_NAME]]></Column_Name>
              <Data_Type><![CDATA[CHAR(30 CHAR)]]></Data_Type>
              <Nullable><![CDATA[Yes]]></Nullable>
              <Data_Default><![CDATA[]]></Data_Default>
              <COLUMN_ID><![CDATA[2]]></COLUMN_ID>
              <Primary_Key><![CDATA[]]></Primary_Key>
              <COMMENTS><![CDATA[]]></COMMENTS>

  • SQL Developer generating an XML Schema for a table

    I hope I've put this question in to correct area of the forum!
    My question is how do you generate an XML schema of a table layout in SQL Developer?
    You can generate an XML schema for the DATA, but I just want to generate one with all the column definitions etc.
    The annoying thing is I managed to do this the other day, but after attempting again for several hours I've forgotten how to do it :-(
    Thanks and regards, Adrian

    A more specific answer, using SqlDeveloper itself, can be found at
    Re: Generating an XML schema for a TABLE

  • XML Schema to generate table data from a repeating subform data

    Hi All, I would like to have a check box that when checked, will hide a quotation form, and make a purchase order form visible, carrying over some of the field data from the quotation form into a new table on the Purchase order form. I've attached this form at https://workspaces.acrobat.com/?d=pqpsXx5VPi*LkMeVKrX57w if you would like to take a look. When the checkbox is unchecked, it will hid the PO form, and make the quite form visible.
    The idea behind this is that my client will create his quote and send t to his customer. Once the customer accepts the quote, he can just click a button to generate his purchase order that he will send to his supplier.
    It seems that because I've got buttons to add rows on the quote form that the problem is more complex. I would be able to do this myself if the table had a fixed number of rows and I was able to use global fields and naming each cell something different, but beacuse it's a single repeating subform, I can't seem to make it work at all.
    I understand that because its a repeating subform that I need to create an XML schema to accomplish this, but also can't figure out for the life of me how to actually create the schema. I've been reading tons of tutorials, but no clue how to apply it to my specific need. I have only been able only find info on how to bind the data source once it's been created.
    I would be forever grateful if anyone could help me out.
    Thank you!

    I've edited your form and put it here.
    Here's what I've done:
    Inserted script into your checkbox renamed Accpted that hides/shows the Purchase Order/ Sales Quotation
    I've included a scripting object with a function I wrote to transfer data from like named fields/subforms from one section to another
    Inserted a few common fields into your Purchase Order table
    What you need to do is complete the development of your Purchase Order table. Make sure the common fields between the quote and purchase tables have the same names in order to transfer the data.
    No schema necessary.
    Kyle

  • Generate XML Schema from oracle tables

    I am new to xml...We have a requirement to generate xml schemas for one or more oracle tables...Are there any tools availaible in oracle?.....I have tried xml spy which generates the schema but i want it like a batch process probably without user intervention...

    An XML document may be generated from a database table with XSU.
    http://www.devx.com/xml/Article/32046

  • Exp XML Schema (.xsd) to another schema on same instance

    Hello,
    I hope someone on this forum can help me or point me in the correct direction. I want to export a schema which contains a table (EQUIPMENT) which has a XMLType column defined against a registered .xsd. I would then like to restored this schema to another schema on the same instance (development instance) and also onto another db instance.
    I have been trying to do this with the help of "Chapter 30 Importing and Exporting XMLType Tables" from the Oracle® XML DB Developer's Guide
    10g Release 2 (10.2). Unfortunately without success. At the end of this message I have encluded sample error messages that I am receiving for creation of TYPES which is causing my import to fail.
    I cannot find any examples on the web on how to achieve an exp from one schema and imp in another either on the same instance or another one.
    DDL for my table is :
    create table EQUIPMENT
    ID number(7) not null,
    STATUSID number(7) not null,
    ATTRIBUTEDATA xmltype
    xmltype column ATTRIBUTEDATA xmlschema "EQUIPMENT.xsd" element EQUIPMENT_XML
    tablespace TBS_DATA1;
    Three test runs as follows:
    1. Using an empty u2 schema and I register the .xsd file. Then I try to import (FROMUSER - TOUSER imp mode) my dump file which leads to the following error:
    IMP-00017: following statement failed with ORACLE error 2304:
    "CREATE TYPE "MTA1440_T" TIMESTAMP '2007-11-14:14:42:16' OID '3EE57B10307317"
    "74E044080020C94102' AS OBJECT ("SYS_XDBPD$" "XDB"."XDB$RAW_LIST_T",""
    "ATTRIBUTE_01" NUMBER(38),"ATTRIBUTE_02" VARCHAR2(4000 CHAR),"ATTRIBUTE_03" "
    "VARCHAR2(4000 CHAR),"ATTRIBUTE_04" NUMBER(38),"ATTRIBUTE_05" VARCHAR2(4000 "
    "CHAR))FINAL INSTANTIABLE "
    IMP-00003: ORACLE error 2304 encountered
    NOTE: Even though import failed, I now see a new TYPE created called "MTA1526_T".
    2. If I try to create the TYPE as is from the error above I get the following error:
    SQL> CREATE TYPE MTA1440_T
    2 OID '3EE57B1030731774E044080020C94102'
    3 AS OBJECT (SYS_XDBPD$ XDB.XDB$RAW_LIST_T,
    4 ATTRIBUTE_01 NUMBER(38),
    5 ATTRIBUTE_02 VARCHAR2(4000 CHAR),
    6 ATTRIBUTE_03 VARCHAR2(4000 CHAR),
    7 ATTRIBUTE_04 NUMBER(38),
    8 ATTRIBUTE_05 VARCHAR2(4000 CHAR)) FINAL INSTANTIABLE;
    9 /
    CREATE TYPE MTA1440_T
    ERROR at line 1:
    ORA-02304: invalid object identifier literal
    3. So now I create the "MTA1440_T" type without the OID value and retry the import.
    IMP-00061: Warning: Object type "U2"."MTA1440_T" already exists with a different identifier
    "CREATE TYPE "MTA1440_T" TIMESTAMP '2007-11-14:14:42:16' OID '3EE57B10307317"
    "74E044080020C94102' AS OBJECT ("SYS_XDBPD$" "XDB"."XDB$RAW_LIST_T",""
    "ATTRIBUTE_01" NUMBER(38),"ATTRIBUTE_02" VARCHAR2(4000 CHAR),"ATTRIBUTE_03" "
    "VARCHAR2(4000 CHAR),"ATTRIBUTE_04" NUMBER(38),"ATTRIBUTE_05" VARCHAR2(4000 "
    "CHAR))FINAL INSTANTIABLE "
    Questions from me:
    A. Can I export TYPES only as suggested by the online documentation ?
    B. If importing onto same instance in another schema surely the OID for the TYPE will always fail - so then why can the import not create the required TYPE name itself during the import ?
    C. Should I use global TYPES and Register the .XSD globally for all schema's in an instance to validate against .. would this prevent me from having errors on an import ?
    I would appreciate any insight any one could provide me. Many thanks in advance.
    Dom

    Hi Guys,
    Thank you all for the replies. I am dissappointed to hear that in 10g does not support exp/imp of schema's structured XML. However I am a little confused or should I say mislead by the "" documentation I
    Here is an extract from chapter "30 - Importing and Exporting XMLType Tables" from the Oracle XML DB 10g Developers Guide documentation:
    "..... Oracle Database supports the import and export of XML schema-based XMLType tables. An XMLType table depends on the XML schema used to define it. Similarly the XML schema has dependencies on the SQL object types created or specified for it. Thus, exporting a user with XML schema-based XMLType tables, consists of the following steps:
    1. Exporting SQL Types During XML Schema Registration. As a part of the XML
    schema registration process .....
    2. Exporting XML Schemas. After all the types are exported, XML schemas are
    exported as XML text .....
    3. Exporting XML Tables. The next step is to export the tables. Export of each table consists of two steps:
    A. The table definition is exported as a part of the CREATE TABLE statement....
    B. The data in the table is exported as XML text. Note that data for out-of-line
    tables is.....
    From this documentation I was under the impression that the exp/imp of XML Schema-Based XMLType Tables was supported.
    Regarding the backup mechanism/strategy for database schema's containing tables with Schema-Based XMLTypes what would you recommend the best online backup method to use - tablespace backups ?
    What I need to be able to do in day-to-day work is to have the ability to be able to take a copy of a customers UAT or production database schema and apply it to a dev or test db instance here for bug testing etc. Do you have any advice on best to achieve this without the use of an exp/imp when the schema will contain Schema-Based XMLType tables.
    Thank you all for your assistance so far.

  • XML in Oracle 9i (best method to return a xml file from a table query)

    Hello.
    What is the best method to query a table, or set of tables (that will return thousands of rows) using xml in oracle? (best performance)
    I'm currently using DBMS_XMLGen, is there a better method ?

    I think, if your talking about generating XML, that you should use XMLElement, XMLForest, etc. to create your XML.
    Lets assume that you base is relational data, then maybe the following great example will give you an idea how to do it : Re: Generate XML Schema from oracle tables
    As michaels pointed out (did you read the link/ URL given?), the general expectancy is that the packages will be less and less important. So also maintenance wise the XMLElement, etc way will be the best, also for the future, maintainable method.

  • Loading xml data into eexternal table

    emp.xml is xml file namewhich is saved in C:\Documents and Settings\james\Desktop\emp.xml
    xml file
    <EMPLOYEES>
    <EMP>
    <EMPNO>7369</EMPNO>
    <ENAME>SMITH</ENAME>
    <JOB>CLERK</JOB>
    <HIREDATE>17-DEC-80</HIREDATE>
    <SAL>800</SAL>
    </EMP>
    <EMP>
    <EMPNO>7499</EMPNO>
    <ENAME>ALLEN</ENAME>
    <JOB>SALESMAN</JOB>
    <HIREDATE>20-FEB-81</HIREDATE>
    <SAL>1600</SAL>
    <COMM>300</COMM>
    </EMP>
    </EMPLOYEES>
    CREATE DIRECTORY my_xml_dir AS 'C:\Documents and Settings\james\Desktop\emp.xml'
    CREATE TABLE my_xml_et ( EMPNO NUMBER, EMPNAME VARCHAR2(10), JOB VARCHAR2(10), HIREDATE DATE, SAL NUMBER )
    using external tables how this xml data is loaded into my_xml_et

    I think you mean you are trying to load an XML from/using an external table.
    However, external tables are typically best suited to flat file structures rather than XML nested structures.
    What you require is one of the many techniques for shredding an XML document into oracle table structures.
    More information on these techniques can be found in the XML DB forum, with plenty of useful links in the FAQ for that forum...
    XML DB FAQ

  • XML Schema Collection (SQL Server 2012): How to create an XML Schema Collection that can be used to Validate a field name (column title) of an existing dbo Table of a Database in SSMS2012?

    Hi all,
    I used the following code to create a new Database (ScottChangDB) and a new Table (marvel) in my SQL Server 2012 Management Studio (SSMS2012) successfully:
    -- ScottChangDB.sql saved in C://Documents/SQL Server XQuery_MacLochlainns Weblog_code
    -- 14 April 2015 09:15 AM
    USE master
    IF EXISTS
    (SELECT 1
    FROM sys.databases
    WHERE name = 'ScottChangDB')
    DROP DATABASE ScottChangDB
    GO
    CREATE DATABASE ScottChangDB
    GO
    USE ScottChangDB
    CREATE TABLE [dbo].[marvel] (
    [avenger_name] [char] (30) NULL, [ID] INT NULL)
    INSERT INTO marvel
    (avenger_name,ID)
    VALUES
    ('Hulk', 1),
    ('Iron Man', 2),
    ('Black Widow', 3),
    ('Thor', 4),
    ('Captain America', 5),
    ('Hawkeye', 6),
    ('Winter Soldier', 7),
    ('Iron Patriot', 8);
    SELECT avenger_name FROM marvel ORDER BY ID For XML PATH('')
    DECLARE @x XML
    SELECT @x=(SELECT avenger_name FROM marvel ORDER BY ID FOR XML PATH('Marvel'))--,ROOT('root'))
    SELECT
    person.value('Marvel[4]', 'varchar(100)') AS NAME
    FROM @x.nodes('.') AS Tbl(person)
    ORDER BY NAME DESC
    --Or if you want the completed element
    SELECT @x.query('/Marvel[4]/avenger_name')
    DROP TABLE [marvel]
    Now I am trying to create my first XML Schema Collection to do the Validation on the Field Name (Column Title) of the "marvel" Table. I have studied Chapter 4 XML SCHEMA COLLECTIONS of the book "Pro SQL Server 2008 XML" written by
    Michael Coles (published by Apress) and some beginning pages of XQuery Language Reference, SQL Server 2012 Books ONline (published by Microsoft). I mimicked  Coles' Listing 04-05 and I wanted to execute the following first-drafted sql in
    my SSMS2012:
    -- Reference [Scott Chang modified Listing04-05.sql of Pro SQL Server 2008 XML by Michael Coles (Apress)]
    -- [shcColes04-05.sql saved in C:\\Documents\XML_SQL_Server2008_code_Coles_Apress]
    -- [executed: 2 April 2015 15:04 PM]
    -- shcXMLschemaTableValidate1.sql in ScottChangDB of SQL Server 2012 Management Studio (SSMS2012)
    -- saved in C:\Documents\XQuery-SQLServer2012
    tried to run: 15 April 2015 ??? AM
    USE ScottChangDB;
    GO
    CREATE XML SCHEMA COLLECTION dbo. ComplexTestSchemaCollection_all
    AS
    N'<?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="marvel">
    <xsd:complexType>
    <xsd:all>
    <xsd:element name="avenger_name" />
    <xsd:element name="ID" />
    </xsd:all>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>';
    GO
    DECLARE @x XML (dbo. ComplexTestSchemaCollection_all);
    SET @x = N'<?xml version="1.0"?>
    <marvel>
    <avenger_name>Thor</name>
    <ID>4</ID>
    </marvel>';
    SELECT @x;
    GO
    DROP XML SCHEMA COLLECTION dbo.ComplexTestSchemaCollection_all;
    GO
    I feel that drafted sql is very shaky and it needs the SQL Server XML experts to modify to make it work for me. Please kindly help, exam the coding of my shcXMLTableValidate1.sql and modify it to work.
    Thanks in advance,
    Scott Chang

    Hi Scott,
    2) Yes, FOR XML PATH clause converts relational data to XML format with a specific structure for the "marvel" Table. Regarding validate all the avenger_names, please see below
    sample.
    DECLARE @x XML
    SELECT @x=(SELECT ID ,avenger_name FROM marvel FOR XML PATH('Marvel'))
    SELECT @x
    SELECT
    n.value('avenger_name[1]','VARCHAR(99)') avenger_name,
    n.value('ID[1]','INT') ID
    FROM @x.nodes('//Marvel') Tab(n)
    WHERE n.value('ID[1]','INT') = 1 -- specify the ID here
    --FOR XML PATH('Marvel')  --uncommented this line if you want the result as element type
    3)i.check the xml schema content
    --find xml schema collection
    SELECT ss.name,xsc.name collection_name FROM sys.xml_schema_collections xsc JOIN sys.schemas ss ON xsc.schema_id= ss.schema_id
    select * from sys.schemas
    --check the schema content,use the name,collection_name from the above query
    SELECT xml_schema_namespace(N'name',N'collection_name')
    3)ii. View can be viewed as virtual table. Use a view to list the XML schema content.
    CREATE VIEW XSDContentView
    AS
    SELECT ss.name,xsc.name collection_name,cat.content
    FROM sys.xml_schema_collections xsc JOIN sys.schemas ss ON xsc.schema_id= ss.schema_id
    CROSS APPLY(
    SELECT xml_schema_namespace(ss.name,xsc.name) AS content
    ) AS cat
    WHERE xsc.name<>'sys'
    GO
    SELECT * FROM XSDContentView
    By the way, it would be appreciated if you can spread your questions into posts. For any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • How to handle tables data in XML schema based adobe form

    Hi all,
    I am working on the CRM business partner creation by using Interactive adobe form with following steps:
    1) Uploaded the offline Interactive adobe form  to online interactive adobe form via WebDynpro ABAP;
    2) Capture XML data into corresponding BAPI structures;
    3) Save all the changes to database via BAPI.
    The adobe form contains customer information as well as several table views which are bind with the context created in WebDynpro: Node NEW_BP_NODE cardinality 1:1 with single attributes and table type attributes (1:n): COLOUR_COMP, MEN_COMP etc.
    While converting the xml format data to SAP context format, It is fine to use following routine to find the single attribute and map to the BAPI structure to do the database update.
    NODE = DOCUMENT->FIND_FROM_NAME( NAME = 'XYZu2019).
    XYZ = NODE->GET_VALUE( ).
    Question: how to convert the xml table data to SAP context format in WebDynpro ABAP?
    The XML table data looks like below.
    <?xml version="1.0" encoding="UTF-8" ?>
    <NEW_BP_NODE>
    <COLOUR_COMP>
    <DATA>
    <ZZTFLD0W2AQW />
    <ZZTFLDRZ2AQX>000</ZZTFLDRZ2AQX>
    <ZZTFLDVD2TQW />
    <ZZTFLDQK2HQX />
    <ZZTFLDEL2XQX />
    <ZZTFLDTC2DQX>000</ZZTFLDTC2DQX>
    <ZZTFLDOR2UQX />
    </DATA>
    <DATA>
    <ZZTFLD0W2AQW />
    <ZZTFLDRZ2AQX />
    <ZZTFLDVD2TQW />
    <ZZTFLDQK2HQX />
    <ZZTFLDEL2XQX />
    <ZZTFLDTC2DQX />
    <ZZTFLDOR2UQX />
    </DATA>
    <DATA>
    <ZZTFLD0W2AQW />
    <ZZTFLDRZ2AQX />
    <ZZTFLDVD2TQW />
    <ZZTFLDQK2HQX />
    <ZZTFLDEL2XQX />
    <ZZTFLDTC2DQX />
    <ZZTFLDOR2UQX />
    </DATA>
    </COLOUR_COMP>
    <MEN_COMP>
    <DATA>
    <ZZTFLD4V2V7V />
    <ZZTFLDYD2N7W>000</ZZTFLDYD2N7W>
    <ZZTFLDX32I7W />
    <ZZTFLD2D2W7W />
    <ZZTFLDGD2A7W />
    </DATA>
    <DATA>
    <ZZTFLD4V2V7V />
    <ZZTFLDYD2N7W>000</ZZTFLDYD2N7W>
    <ZZTFLDX32I7W />
    <ZZTFLD2D2W7W />
    <ZZTFLDGD2A7W />
    </DATA>
    </MEN_COMP>
    Thanks in advance for your help.
    Michelle

    Hi,
    Just follow these steps:
    1. Create interactive form UI element in your view.
    2. Now provide Datasource and PDFSOURCE to it in form properties.
    3. Now give a template name prefix with 'Z' or 'Y'.
    4. Double click on it. It will prompt for interface name.
    5. Provide interface name prefixed with 'Z' or 'Y'.
    6. Click on Context button in the Pop up window and provide the node you have selected as DATASOURCE.
    7. Click ok and it will open the form designer.
    8. In this way you can create a XML Schema based Form.
    9. Activate the interface and design the form providing layout type and other details.
    Hope it will help.
    Regards,
    Vaibhav

  • Multiple XML schema in structured XMLType column possible?

    I have registered several different xml schema in my 10g database. I have a table with an XMLType column. That column will always hold one XML document that conforms to one of the XML schema. Question: does that by definition mean I have to use "unstructured" storage, or there any way to use structured storage telling Oracle that the XMLType conforms to xsd1 OR xsd2 OR xsd3?
    Thanks.

    In 10gR2 a column based on an XML Schema and using object-relation storage can be bound to one global element. The only way for a column to hold documents associated with more than one global element is if both elements are defined as members of the same substition group.

  • SQL Server 2012 Management Studio:In the Database, how to print out or export the old 3 dbo Tables that were created manually and they have a relationship for 1 Parent table and 2 Child tables?How to handle this relationship in creating a new XML Schema?

    Hi all,
    Long time ago, I manually created a Database (APGriMMRP) and 3 Tables (dbo.Table_1_XYcoordinates, dbo.Table_2_Soil, and dbo.Table_3_Water) in my SQL Server 2012 Management Studio (SSMS2012). The dbo.Table_1_XYcoordinates has the following columns: file_id,
    Pt_ID, X, Y, Z, sample_id, Boring. The dbo.Table_2_Soil has the following columns: Boring, sample_date, sample_id, Unit, Arsenic, Chromium, Lead. The dbo.Table_3_Water has the following columns: Boring, sample_date, sample_id, Unit, Benzene, Ethylbenzene,
    Pyrene. The dbo.Table_1_XYcoordinates is a Parent Table. The dbo.Table_2_Soil and the dbo.Table_3_Water are 2 Child Tables. The sample_id is key link for the relationship between the Parent Table and the Child Tables.
    Problem #1) How can I print out or export these 3 dbo Tables?
    Problem #2) If I right-click on the dbo Table, I see "Start PowerShell" and click on it. I get the following error messages: Warning: Failed to load the 'SQLAS' extension: An exception occurred in SMO while trying to manage a service. 
    --> Failed to retrieve data for this request. --> Invalid class.  Warning: Could not obtain SQL Server Service information. An attemp to connect to WMI on 'NAB-WK-02657306' failed with the following error: An exception occurred in SMO while trying
    to manage a service. --> Failed to retrieve data for this request. --> Invalid class.  .... PS SQLSERVER:\SQL\NAB-WK-02657306\SQLEXPRESS\Databases\APGriMMRP\Table_1_XYcoordinates>   What causes this set of error messages? How can
    I get this problem fixed in my PC that is an end user of the Windows 7 LAN System? Note: I don't have the regular version of Microsoft Visual Studio 2012 in my PC. I just have the Microsoft 2012 Shell (Integrated) program in my PC.
    Problem #3: I plan to create an XML Schema Collection in the "APGriMMRP" database for the Parent Table and the Child Tables. How can I handle the relationship between the Parent Table and the Child Table in the XML Schema Collection?
    Problem #4: I plan to extract some results/data from the Parent Table and the Child Table by using XQuery. What kind of JOIN (Left or Right JOIN) should I use in the XQuerying?
    Please kindly help, answer my questions, and advise me how to resolve these 4 problems.
    Thanks in advance,
    Scott Chang    

    In the future, I would recommend you to post your questions one by one, and to the appropriate forum. Of your questions it is really only #3 that fits into this forum. (And that is the one I will not answer, because I have worked very little with XSD.)
    1) Not sure what you mean with "print" or "export", but when you right-click a database, you can select Tasks from the context menu and in this submenu you find "Export data".
    2) I don't know why you get that error, but any particular reason you want to run PowerShell?
    4) If you have tables, you query them with SQL, not XQuery. XQuery is when you query XML documents, but left and right joins are SQL things. There are no joins in XQuery.
    As for left/right join, notice that these two are equivalent:
    SELECT ...
    FROM   a LEFT JOIN b ON a.col = b.col
    SELECT ...
    FROM   b RIGHT JOIN a ON a.col = b.col
    But please never use RIGHT JOIN - it gives me a headache!
    There is nothing that says that you should use any of the other. In fact, if you are returning rows from parent and child, I would expect an inner join, unless you want to cater for parents without children.
    Here is an example where you can study the different join types and how they behave:
    CREATE TABLE apple (a int         NOT NULL PRIMARY KEY,
                        b varchar(23) NOT NULL)
    INSERT apple(a, b)
       VALUES(1, 'Granny Smith'),
             (2, 'Gloster'),
             (4, 'Ingrid-Marie'),
             (5, 'Milenga')
    CREATE TABLE orange(c int        NOT NULL PRIMARY KEY,
                        d varchar(23) NOT NULL)
    INSERT orange(c, d)
       VALUES(1, 'Agent'),
             (3, 'Netherlands'),
             (4, 'Revolution')
    SELECT a, b, c, d
    FROM   apple
    CROSS  JOIN orange
    SELECT a, b, c, d
    FROM   apple
    INNER  JOIN orange ON apple.a = orange.c
    SELECT a, b, c, d
    FROM   apple
    LEFT   OUTER JOIN orange ON apple.a = orange.c
    SELECT a, b, c, d
    FROM   apple
    RIGHT  OUTER JOIN orange ON apple.a = orange.c
    SELECT a, b, c, d
    FROM   apple
    FULL OUTER JOIN orange ON apple.a = orange.c
    go
    DROP TABLE apple, orange
    Erland Sommarskog, SQL Server MVP, [email protected]

  • How to create XML from relational tables based on an XML Schema ?

    There is no automated way in Oracle XML DB to define an automatic mapping between a set of columns in some existing relational tables and the elements and attributres defined by an XML Schema.
    However it is easy solve this problem by using the SQL/XML operators (XMLAGG, XMLELEMENT, XMLFOREST, XMLATTRIBUTES, etc) to generate XML documents that are compliant with an XML Schema directly from a SQL statement.
    If the XML Schema is registered with Oracle XML DB and the appropraite Schema Location information is added into the generated document using XMLAttributes then it becomes very easy to ensure that the generated documents are valid.
    The following example show an easy way to do this by creating an XML View that contains the documents to be validated.
    SQL> drop table PURCHASEORDER_LINEITEM
      2  /
    Table dropped.
    SQL> drop table PURCHASEORDER_REJECTION
      2  /
    Table dropped.
    SQL> drop table PURCHASEORDER_SHIPPING
      2  /
    Table dropped.
    SQL> drop TABLE PURCHASEORDER_ACTION
      2  /
    Table dropped.
    SQL> drop TABLE PURCHASEORDER_TABLE
      2  /
    Table dropped.
    SQL> create table PURCHASEORDER_TABLE
      2  (
      3   REFERENCE                                          VARCHAR2(28),
      4   PRIMARY KEY ("REFERENCE"),
      5   REQUESTER                                          VARCHAR2(48),
      6   USERID                                             VARCHAR2(32),
      7   COSTCENTER                                         VARCHAR2(3),
      8   SPECIALINSTRUCTIONS                                VARCHAR2(2048)
      9  )
    10  /
    Table created.
    SQL> create table PURCHASEORDER_ACTION
      2  (
      3   REFERENCE,
      4   FOREIGN KEY ("REFERENCE")                          REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
      5   ACTIONEDBY                                         VARCHAR2(32),
      6   DATEACTIONED                                       DATE
      7  )
      8  /
    Table created.
    SQL> create table PURCHASEORDER_SHIPPING
      2  (
      3   REFERENCE,
      4   FOREIGN KEY ("REFERENCE")                          REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
      5   PRIMARY KEY ("REFERENCE"),
      6   SHIPTONAME                                         VARCHAR2(48),
      7   ADDRESS                                            VARCHAR2(512),
      8   PHONE                                              VARCHAR2(32)
      9  )
    10  /
    Table created.
    SQL> create table PURCHASEORDER_REJECTION
      2  (
      3   REFERENCE,
      4   FOREIGN KEY ("REFERENCE")                          REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
      5   PRIMARY KEY ("REFERENCE"),
      6   REJECTEDBY                                         VARCHAR2(32),
      7   DATEREJECTED                                       DATE,
      8   COMMENTS                                           VARCHAR2(2048)
      9  )
    10  /
    Table created.
    SQL> create table PURCHASEORDER_LINEITEM
      2  (
      3   REFERENCE,
      4   FOREIGN KEY ("REFERENCE")                          REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
      5   LINENO                                             NUMBER(10),
      6   PRIMARY KEY ("REFERENCE","LINENO"),
      7   UPC                                                   VARCHAR2(14),
      8   DESCRIPTION                                        VARCHAR2(128),
      9   QUANTITY                                           NUMBER(10),
    10   UNITPRICE                                          NUMBER(12,2)
    11  )
    12  /
    Table created.
    SQL> insert into PURCHASEORDER_TABLE values ('SMCCAIN-20030109123335470PDT','Samuel B. McCain','SMCCAIN','A10','Courier')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_ACTION values ('SMCCAIN-20030109123335470PDT','SVOLLMAN',NULL)
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_SHIPPING values ('SMCCAIN-20030109123335470PDT','Samuel B. McCain','800 Bridge Parkway,Redwood Shores,CA,9406
    5,USA','650 506 7800')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_REJECTION values ('SMCCAIN-20030109123335470PDT',null,null,null)
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','1','715515010320','Life of Brian - Monty Python''s','2','39.
    95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','2','37429145227','The Night Porter','2','29.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','3','37429128121','Oliver Twist','1','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','4','715515012720','Notorious','4','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','5','715515012928','In the Mood for Love','3','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','6','37429130926','Alphaville','2','29.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','7','37429166529','General Idi Amin Dada','4','29.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','8','715515012928','In the Mood for Love','3','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','9','715515009423','Flesh for Frankenstein','3','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','10','715515008976','The Killer','1','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','11','37429167922','Ballad of a Soldier','2','29.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','12','37429158623','Ordet','2','0')
      2  /
    1 row created.
    SQL> var schemaPath varchar2(256)
    SQL> --
    SQL> begin
      2    :schemaURL := 'http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd';
      3    :schemaPath := '/public/purchaseOrder.xsd';
      4  end;
      5  /
    PL/SQL procedure successfully completed.
    SQL> call dbms_xmlSchema.deleteSchema(:schemaURL,4)
      2  /
    Call completed.
    SQL> declare
      2    res boolean;
      3    xmlSchema xmlType := xmlType(
      4  '<!-- edited with XML Spy v4.0 U (http://www.xmlspy.com) by Mark (Drake) -->
      5  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="tr
    ue">
      6          <xs:element name="PurchaseOrder" type="PurchaseOrderType" xdb:defaultTable="PURCHASEORDER"/>
      7          <xs:complexType name="PurchaseOrderType" xdb:SQLType="PURCHASEORDER_T" xdb:maintainDOM="false">
      8                  <xs:sequence>
      9                          <xs:element name="Reference" type="ReferenceType" xdb:SQLName="REFERENCE"/>
    10                          <xs:element name="Actions" type="ActionsType" xdb:SQLName="ACTIONS"/>
    11                          <xs:element name="Reject" type="RejectionType" minOccurs="0" xdb:SQLName="REJECTION"/>
    12                          <xs:element name="Requestor" type="RequestorType" xdb:SQLName="REQUESTOR"/>
    13                          <xs:element name="User" type="UserType" xdb:SQLName="USERID"/>
    14                          <xs:element name="CostCenter" type="CostCenterType" xdb:SQLName="COST_CENTER"/>
    15                          <xs:element name="ShippingInstructions" type="ShippingInstructionsType" xdb:SQLName="SHIPPING_INSTRUCTIONS"/>
    16                          <xs:element name="SpecialInstructions" type="SpecialInstructionsType" xdb:SQLName="SPECIAL_INSTRUCTIONS"/>
    17                          <xs:element name="LineItems" type="LineItemsType" xdb:SQLName="LINEITEMS"/>
    18                  </xs:sequence>
    19          </xs:complexType>
    20          <xs:complexType name="LineItemsType" xdb:SQLType="LINEITEMS_T" xdb:maintainDOM="false">
    21                  <xs:sequence>
    22                          <xs:element name="LineItem" type="LineItemType" maxOccurs="unbounded" xdb:SQLName="LINEITEM" xdb:SQLCollType="L
    INEITEM_V"/>
    23                  </xs:sequence>
    24          </xs:complexType>
    25          <xs:complexType name="LineItemType" xdb:SQLType="LINEITEM_T" xdb:maintainDOM="false">
    26                  <xs:sequence>
    27                          <xs:element name="Description" type="DescriptionType" xdb:SQLName="DESRIPTION"/>
    28                          <xs:element name="Part" type="PartType" xdb:SQLName="PART"/>
    29                  </xs:sequence>
    30                  <xs:attribute name="ItemNumber" type="xs:integer" xdb:SQLName="ITEMNUMBER" xdb:SQLType="NUMBER"/>
    31          </xs:complexType>
    32          <xs:complexType name="PartType" xdb:SQLType="PART_T" xdb:maintainDOM="false">
    33                  <xs:attribute name="Id" xdb:SQLName="PART_NUMBER" xdb:SQLType="VARCHAR2">
    34                          <xs:simpleType>
    35                                  <xs:restriction base="xs:string">
    36                                          <xs:minLength value="10"/>
    37                                          <xs:maxLength value="14"/>
    38                                  </xs:restriction>
    39                          </xs:simpleType>
    40                  </xs:attribute>
    41                  <xs:attribute name="Quantity" type="moneyType" xdb:SQLName="QUANTITY"/>
    42                  <xs:attribute name="UnitPrice" type="quantityType" xdb:SQLName="UNITPRICE"/>
    43          </xs:complexType>
    44          <xs:simpleType name="ReferenceType">
    45                  <xs:restriction base="xs:string">
    46                          <xs:minLength value="18"/>
    47                          <xs:maxLength value="30"/>
    48                  </xs:restriction>
    49          </xs:simpleType>
    50          <xs:complexType name="ActionsType" xdb:SQLType="ACTIONS_T" xdb:maintainDOM="false">
    51                  <xs:sequence>
    52                          <xs:element name="Action" maxOccurs="4" xdb:SQLName="ACTION" xdb:SQLCollType="ACTION_V">
    53                                  <xs:complexType xdb:SQLType="ACTION_T" xdb:maintainDOM="false">
    54                                          <xs:sequence>
    55                                                  <xs:element name="User" type="UserType" xdb:SQLName="ACTIONED_BY"/>
    56                                                  <xs:element name="Date" type="DateType" minOccurs="0" xdb:SQLName="DATE_ACTIONED"/>
    57                                          </xs:sequence>
    58                                  </xs:complexType>
    59                          </xs:element>
    60                  </xs:sequence>
    61          </xs:complexType>
    62          <xs:complexType name="RejectionType" xdb:SQLType="REJECTION_T" xdb:maintainDOM="false">
    63                  <xs:all>
    64                          <xs:element name="User" type="UserType" minOccurs="0" xdb:SQLName="REJECTED_BY"/>
    65                          <xs:element name="Date" type="DateType" minOccurs="0" xdb:SQLName="DATE_REJECTED"/>
    66                          <xs:element name="Comments" type="CommentsType" minOccurs="0" xdb:SQLName="REASON_REJECTED"/>
    67                  </xs:all>
    68          </xs:complexType>
    69          <xs:complexType name="ShippingInstructionsType" xdb:SQLType="SHIPPING_INSTRUCTIONS_T" xdb:maintainDOM="false">
    70                  <xs:sequence>
    71                          <xs:element name="name" type="NameType" minOccurs="0" xdb:SQLName="SHIP_TO_NAME"/>
    72                          <xs:element name="address" type="AddressType" minOccurs="0" xdb:SQLName="SHIP_TO_ADDRESS"/>
    73                          <xs:element name="telephone" type="TelephoneType" minOccurs="0" xdb:SQLName="SHIP_TO_PHONE"/>
    74                  </xs:sequence>
    75          </xs:complexType>
    76          <xs:simpleType name="moneyType">
    77                  <xs:restriction base="xs:decimal">
    78                          <xs:fractionDigits value="2"/>
    79                          <xs:totalDigits value="12"/>
    80                  </xs:restriction>
    81          </xs:simpleType>
    82          <xs:simpleType name="quantityType">
    83                  <xs:restriction base="xs:decimal">
    84                          <xs:fractionDigits value="4"/>
    85                          <xs:totalDigits value="8"/>
    86                  </xs:restriction>
    87          </xs:simpleType>
    88          <xs:simpleType name="UserType">
    89                  <xs:restriction base="xs:string">
    90                          <xs:minLength value="1"/>
    91                          <xs:maxLength value="10"/>
    92                  </xs:restriction>
    93          </xs:simpleType>
    94          <xs:simpleType name="RequestorType">
    95                  <xs:restriction base="xs:string">
    96                          <xs:minLength value="0"/>
    97                          <xs:maxLength value="128"/>
    98                  </xs:restriction>
    99          </xs:simpleType>
    100          <xs:simpleType name="CostCenterType">
    101                  <xs:restriction base="xs:string">
    102                          <xs:minLength value="1"/>
    103                          <xs:maxLength value="4"/>
    104                  </xs:restriction>
    105          </xs:simpleType>
    106          <xs:simpleType name="VendorType">
    107                  <xs:restriction base="xs:string">
    108                          <xs:minLength value="0"/>
    109                          <xs:maxLength value="20"/>
    110                  </xs:restriction>
    111          </xs:simpleType>
    112          <xs:simpleType name="PurchaseOrderNumberType">
    113                  <xs:restriction base="xs:integer"/>
    114          </xs:simpleType>
    115          <xs:simpleType name="SpecialInstructionsType">
    116                  <xs:restriction base="xs:string">
    117                          <xs:minLength value="0"/>
    118                          <xs:maxLength value="2048"/>
    119                  </xs:restriction>
    120          </xs:simpleType>
    121          <xs:simpleType name="NameType">
    122                  <xs:restriction base="xs:string">
    123                          <xs:minLength value="1"/>
    124                          <xs:maxLength value="20"/>
    125                  </xs:restriction>
    126          </xs:simpleType>
    127          <xs:simpleType name="AddressType">
    128                  <xs:restriction base="xs:string">
    129                          <xs:minLength value="1"/>
    130                          <xs:maxLength value="256"/>
    131                  </xs:restriction>
    132          </xs:simpleType>
    133          <xs:simpleType name="TelephoneType">
    134                  <xs:restriction base="xs:string">
    135                          <xs:minLength value="1"/>
    136                          <xs:maxLength value="24"/>
    137                  </xs:restriction>
    138          </xs:simpleType>
    139          <xs:simpleType name="DateType">
    140                  <xs:restriction base="xs:date"/>
    141          </xs:simpleType>
    142          <xs:simpleType name="CommentsType">
    143                  <xs:restriction base="xs:string">
    144                          <xs:minLength value="1"/>
    145                          <xs:maxLength value="2048"/>
    146                  </xs:restriction>
    147          </xs:simpleType>
    148          <xs:simpleType name="DescriptionType">
    149                  <xs:restriction base="xs:string">
    150                          <xs:minLength value="1"/>
    151                          <xs:maxLength value="256"/>
    152                  </xs:restriction>
    153          </xs:simpleType>
    154  </xs:schema>
    155  ');
    156  begin
    157    if (dbms_xdb.existsResource(:schemaPath)) then
    158      dbms_xdb.deleteResource(:schemaPath);
    159    end if;
    160    res := dbms_xdb.createResource(:schemaPath,xmlSchema);
    161  end;
    162  /
    PL/SQL procedure successfully completed.
    SQL> begin
      2    dbms_xmlschema.registerSchema
      3    (
      4      :schemaURL,
      5      xdbURIType(:schemaPath).getClob(),
      6      TRUE,TRUE,FALSE,FALSE
      7    );
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    SQL> create or replace view PURCHASEORDER_XML
      2  of xmltype
      3  xmlSCHEMA "http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd" Element "PurchaseOrder"
      4  with object id
      5  (
      6    substr(extractValue(object_value,'/PurchaseOrder/Reference'),1,32)
      7  )
      8  as
      9    select xmlElement
    10           (
    11             "PurchaseOrder",
    12             xmlAttributes
    13             (
    14               'http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd' as "xsi:noNamespaceSchemaLocation",
    15               'http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi"
    16             ),
    17             xmlElement("Reference",p.REFERENCE),
    18             xmlElement
    19             (
    20               "Actions",
    21               ( select xmlAgg
    22                        (
    23                          xmlElement
    24                          (
    25                            "Action",
    26                            xmlElement("User",ACTIONEDBY),
    27                            case
    28                              when DATEACTIONED is not null
    29                              then xmlElement("Date",DATEACTIONED)
    30                            end
    31                          )
    32                        )
    33                   from PURCHASEORDER_ACTION a
    34                  where a.REFERENCE = p.REFERENCE
    35               )
    36             ),
    37             xmlElement
    38             (
    39               "Reject",
    40                  xmlForest
    41                  (
    42                    REJECTEDBY as "User",
    43                 DATEREJECTED as "Date",
    44                    COMMENTS as "Comments"
    45                  )
    46             ),
    47             xmlElement("Requestor",REQUESTER),
    48             xmlElement("User",USERID),
    49             xmlElement("CostCenter",COSTCENTER),
    50             xmlElement
    51             (
    52               "ShippingInstructions",
    53               xmlElement("name",SHIPTONAME),
    54               xmlElement("address",ADDRESS),
    55               xmlElement("telephone",PHONE)
    56             ),
    57             xmlElement("SpecialInstructions",SPECIALINSTRUCTIONS),
    58             xmlElement
    59             (
    60               "LineItems",
    61               ( select xmlAgg
    62                        (
    63                          xmlElement
    64                          (
    65                            "LineItem",
    66                            xmlAttributes(LINENO as "ItemNumber"),
    67                            xmlElement("Description",DESCRIPTION),
    68                            xmlElement
    69                            (
    70                              "Part",
    71                              xmlAttributes
    72                              (
    73                                UPC       as "Id",
    74                                QUANTITY  as "Quantity",
    75                                UNITPRICE as "UnitPrice"
    76                              )
    77                            )
    78                          )
    79                        )
    80                    from PURCHASEORDER_LINEITEM l
    81                   where l.REFERENCE = p.REFERENCE
    82               )
    83             )
    84           )
    85      from PURCHASEORDER_TABLE p, PURCHASEORDER_REJECTION r, PURCHASEORDER_SHIPPING s
    86     where r.REFERENCE = p.REFERENCE
    87       and s.REFERENCE = p.REFERENCE
    88  /
    View created.
    SQL> set long 10000 pages 0 lines 140
    SQL> --
    SQL> select x.object_value.extract('/*')
      2    from PURCHASEORDER_XML x
      3  /
    <PurchaseOrder xsi:noNamespaceSchemaLocation="http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <Reference>SMCCAIN-20030109123335470PDT</Reference>
      <Actions>
        <Action>
          <User>SVOLLMAN</User>
        </Action>
      </Actions>
      <Reject/>
      <Requestor>Samuel B. McCain</Requestor>
      <User>SMCCAIN</User>
      <CostCenter>A10</CostCenter>
      <ShippingInstructions>
        <name>Samuel B. McCain</name>
        <address>800 Bridge Parkway,Redwood Shores,CA,94065,USA</address>
        <telephone>650 506 7800</telephone>
      </ShippingInstructions>
      <SpecialInstructions>Courier</SpecialInstructions>
      <LineItems>
        <LineItem ItemNumber="1">
          <Description>Life of Brian - Monty Python&apos;s</Description>
          <Part Id="715515010320" Quantity="2" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="2">
          <Description>The Night Porter</Description>
          <Part Id="37429145227" Quantity="2" UnitPrice="29.95"/>
        </LineItem>
        <LineItem ItemNumber="3">
          <Description>Oliver Twist</Description>
          <Part Id="37429128121" Quantity="1" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="4">
          <Description>Notorious</Description>
          <Part Id="715515012720" Quantity="4" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="5">
          <Description>In the Mood for Love</Description>
          <Part Id="715515012928" Quantity="3" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="6">
          <Description>Alphaville</Description>
          <Part Id="37429130926" Quantity="2" UnitPrice="29.95"/>
        </LineItem>
        <LineItem ItemNumber="7">
          <Description>General Idi Amin Dada</Description>
          <Part Id="37429166529" Quantity="4" UnitPrice="29.95"/>
        </LineItem>
        <LineItem ItemNumber="8">
          <Description>In the Mood for Love</Description>
          <Part Id="715515012928" Quantity="3" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="9">
          <Description>Flesh for Frankenstein</Description>
          <Part Id="715515009423" Quantity="3" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="10">
          <Description>The Killer</Description>
          <Part Id="715515008976" Quantity="1" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="11">
          <Description>Ballad of a Soldier</Description>
          <Part Id="37429167922" Quantity="2" UnitPrice="29.95"/>
        </LineItem>
        <LineItem ItemNumber="12">
          <Description>Ordet</Description>
          <Part Id="37429158623" Quantity="2" UnitPrice="0"/>
        </LineItem>
      </LineItems>
    </PurchaseOrder>
    SQL> begin
      2    for x in (select object_value from PURCHASEORDER_XML) loop
      3      x.object_value.schemaValidate();
      4    end loop;
      5  end;
      6  /
    PL/SQL procedure successfully completed.
    SQL>

    There is no automated way in Oracle XML DB to define an automatic mapping between a set of columns in some existing relational tables and the elements and attributres defined by an XML Schema.
    However it is easy solve this problem by using the SQL/XML operators (XMLAGG, XMLELEMENT, XMLFOREST, XMLATTRIBUTES, etc) to generate XML documents that are compliant with an XML Schema directly from a SQL statement.
    If the XML Schema is registered with Oracle XML DB and the appropraite Schema Location information is added into the generated document using XMLAttributes then it becomes very easy to ensure that the generated documents are valid.
    The following example show an easy way to do this by creating an XML View that contains the documents to be validated.
    SQL> drop table PURCHASEORDER_LINEITEM
      2  /
    Table dropped.
    SQL> drop table PURCHASEORDER_REJECTION
      2  /
    Table dropped.
    SQL> drop table PURCHASEORDER_SHIPPING
      2  /
    Table dropped.
    SQL> drop TABLE PURCHASEORDER_ACTION
      2  /
    Table dropped.
    SQL> drop TABLE PURCHASEORDER_TABLE
      2  /
    Table dropped.
    SQL> create table PURCHASEORDER_TABLE
      2  (
      3   REFERENCE                                          VARCHAR2(28),
      4   PRIMARY KEY ("REFERENCE"),
      5   REQUESTER                                          VARCHAR2(48),
      6   USERID                                             VARCHAR2(32),
      7   COSTCENTER                                         VARCHAR2(3),
      8   SPECIALINSTRUCTIONS                                VARCHAR2(2048)
      9  )
    10  /
    Table created.
    SQL> create table PURCHASEORDER_ACTION
      2  (
      3   REFERENCE,
      4   FOREIGN KEY ("REFERENCE")                          REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
      5   ACTIONEDBY                                         VARCHAR2(32),
      6   DATEACTIONED                                       DATE
      7  )
      8  /
    Table created.
    SQL> create table PURCHASEORDER_SHIPPING
      2  (
      3   REFERENCE,
      4   FOREIGN KEY ("REFERENCE")                          REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
      5   PRIMARY KEY ("REFERENCE"),
      6   SHIPTONAME                                         VARCHAR2(48),
      7   ADDRESS                                            VARCHAR2(512),
      8   PHONE                                              VARCHAR2(32)
      9  )
    10  /
    Table created.
    SQL> create table PURCHASEORDER_REJECTION
      2  (
      3   REFERENCE,
      4   FOREIGN KEY ("REFERENCE")                          REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
      5   PRIMARY KEY ("REFERENCE"),
      6   REJECTEDBY                                         VARCHAR2(32),
      7   DATEREJECTED                                       DATE,
      8   COMMENTS                                           VARCHAR2(2048)
      9  )
    10  /
    Table created.
    SQL> create table PURCHASEORDER_LINEITEM
      2  (
      3   REFERENCE,
      4   FOREIGN KEY ("REFERENCE")                          REFERENCES "PURCHASEORDER_TABLE" ("REFERENCE") ON DELETE CASCADE,
      5   LINENO                                             NUMBER(10),
      6   PRIMARY KEY ("REFERENCE","LINENO"),
      7   UPC                                                   VARCHAR2(14),
      8   DESCRIPTION                                        VARCHAR2(128),
      9   QUANTITY                                           NUMBER(10),
    10   UNITPRICE                                          NUMBER(12,2)
    11  )
    12  /
    Table created.
    SQL> insert into PURCHASEORDER_TABLE values ('SMCCAIN-20030109123335470PDT','Samuel B. McCain','SMCCAIN','A10','Courier')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_ACTION values ('SMCCAIN-20030109123335470PDT','SVOLLMAN',NULL)
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_SHIPPING values ('SMCCAIN-20030109123335470PDT','Samuel B. McCain','800 Bridge Parkway,Redwood Shores,CA,9406
    5,USA','650 506 7800')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_REJECTION values ('SMCCAIN-20030109123335470PDT',null,null,null)
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','1','715515010320','Life of Brian - Monty Python''s','2','39.
    95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','2','37429145227','The Night Porter','2','29.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','3','37429128121','Oliver Twist','1','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','4','715515012720','Notorious','4','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','5','715515012928','In the Mood for Love','3','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','6','37429130926','Alphaville','2','29.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','7','37429166529','General Idi Amin Dada','4','29.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','8','715515012928','In the Mood for Love','3','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','9','715515009423','Flesh for Frankenstein','3','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','10','715515008976','The Killer','1','39.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','11','37429167922','Ballad of a Soldier','2','29.95')
      2  /
    1 row created.
    SQL> insert into PURCHASEORDER_LINEITEM values ('SMCCAIN-20030109123335470PDT','12','37429158623','Ordet','2','0')
      2  /
    1 row created.
    SQL> var schemaPath varchar2(256)
    SQL> --
    SQL> begin
      2    :schemaURL := 'http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd';
      3    :schemaPath := '/public/purchaseOrder.xsd';
      4  end;
      5  /
    PL/SQL procedure successfully completed.
    SQL> call dbms_xmlSchema.deleteSchema(:schemaURL,4)
      2  /
    Call completed.
    SQL> declare
      2    res boolean;
      3    xmlSchema xmlType := xmlType(
      4  '<!-- edited with XML Spy v4.0 U (http://www.xmlspy.com) by Mark (Drake) -->
      5  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="tr
    ue">
      6          <xs:element name="PurchaseOrder" type="PurchaseOrderType" xdb:defaultTable="PURCHASEORDER"/>
      7          <xs:complexType name="PurchaseOrderType" xdb:SQLType="PURCHASEORDER_T" xdb:maintainDOM="false">
      8                  <xs:sequence>
      9                          <xs:element name="Reference" type="ReferenceType" xdb:SQLName="REFERENCE"/>
    10                          <xs:element name="Actions" type="ActionsType" xdb:SQLName="ACTIONS"/>
    11                          <xs:element name="Reject" type="RejectionType" minOccurs="0" xdb:SQLName="REJECTION"/>
    12                          <xs:element name="Requestor" type="RequestorType" xdb:SQLName="REQUESTOR"/>
    13                          <xs:element name="User" type="UserType" xdb:SQLName="USERID"/>
    14                          <xs:element name="CostCenter" type="CostCenterType" xdb:SQLName="COST_CENTER"/>
    15                          <xs:element name="ShippingInstructions" type="ShippingInstructionsType" xdb:SQLName="SHIPPING_INSTRUCTIONS"/>
    16                          <xs:element name="SpecialInstructions" type="SpecialInstructionsType" xdb:SQLName="SPECIAL_INSTRUCTIONS"/>
    17                          <xs:element name="LineItems" type="LineItemsType" xdb:SQLName="LINEITEMS"/>
    18                  </xs:sequence>
    19          </xs:complexType>
    20          <xs:complexType name="LineItemsType" xdb:SQLType="LINEITEMS_T" xdb:maintainDOM="false">
    21                  <xs:sequence>
    22                          <xs:element name="LineItem" type="LineItemType" maxOccurs="unbounded" xdb:SQLName="LINEITEM" xdb:SQLCollType="L
    INEITEM_V"/>
    23                  </xs:sequence>
    24          </xs:complexType>
    25          <xs:complexType name="LineItemType" xdb:SQLType="LINEITEM_T" xdb:maintainDOM="false">
    26                  <xs:sequence>
    27                          <xs:element name="Description" type="DescriptionType" xdb:SQLName="DESRIPTION"/>
    28                          <xs:element name="Part" type="PartType" xdb:SQLName="PART"/>
    29                  </xs:sequence>
    30                  <xs:attribute name="ItemNumber" type="xs:integer" xdb:SQLName="ITEMNUMBER" xdb:SQLType="NUMBER"/>
    31          </xs:complexType>
    32          <xs:complexType name="PartType" xdb:SQLType="PART_T" xdb:maintainDOM="false">
    33                  <xs:attribute name="Id" xdb:SQLName="PART_NUMBER" xdb:SQLType="VARCHAR2">
    34                          <xs:simpleType>
    35                                  <xs:restriction base="xs:string">
    36                                          <xs:minLength value="10"/>
    37                                          <xs:maxLength value="14"/>
    38                                  </xs:restriction>
    39                          </xs:simpleType>
    40                  </xs:attribute>
    41                  <xs:attribute name="Quantity" type="moneyType" xdb:SQLName="QUANTITY"/>
    42                  <xs:attribute name="UnitPrice" type="quantityType" xdb:SQLName="UNITPRICE"/>
    43          </xs:complexType>
    44          <xs:simpleType name="ReferenceType">
    45                  <xs:restriction base="xs:string">
    46                          <xs:minLength value="18"/>
    47                          <xs:maxLength value="30"/>
    48                  </xs:restriction>
    49          </xs:simpleType>
    50          <xs:complexType name="ActionsType" xdb:SQLType="ACTIONS_T" xdb:maintainDOM="false">
    51                  <xs:sequence>
    52                          <xs:element name="Action" maxOccurs="4" xdb:SQLName="ACTION" xdb:SQLCollType="ACTION_V">
    53                                  <xs:complexType xdb:SQLType="ACTION_T" xdb:maintainDOM="false">
    54                                          <xs:sequence>
    55                                                  <xs:element name="User" type="UserType" xdb:SQLName="ACTIONED_BY"/>
    56                                                  <xs:element name="Date" type="DateType" minOccurs="0" xdb:SQLName="DATE_ACTIONED"/>
    57                                          </xs:sequence>
    58                                  </xs:complexType>
    59                          </xs:element>
    60                  </xs:sequence>
    61          </xs:complexType>
    62          <xs:complexType name="RejectionType" xdb:SQLType="REJECTION_T" xdb:maintainDOM="false">
    63                  <xs:all>
    64                          <xs:element name="User" type="UserType" minOccurs="0" xdb:SQLName="REJECTED_BY"/>
    65                          <xs:element name="Date" type="DateType" minOccurs="0" xdb:SQLName="DATE_REJECTED"/>
    66                          <xs:element name="Comments" type="CommentsType" minOccurs="0" xdb:SQLName="REASON_REJECTED"/>
    67                  </xs:all>
    68          </xs:complexType>
    69          <xs:complexType name="ShippingInstructionsType" xdb:SQLType="SHIPPING_INSTRUCTIONS_T" xdb:maintainDOM="false">
    70                  <xs:sequence>
    71                          <xs:element name="name" type="NameType" minOccurs="0" xdb:SQLName="SHIP_TO_NAME"/>
    72                          <xs:element name="address" type="AddressType" minOccurs="0" xdb:SQLName="SHIP_TO_ADDRESS"/>
    73                          <xs:element name="telephone" type="TelephoneType" minOccurs="0" xdb:SQLName="SHIP_TO_PHONE"/>
    74                  </xs:sequence>
    75          </xs:complexType>
    76          <xs:simpleType name="moneyType">
    77                  <xs:restriction base="xs:decimal">
    78                          <xs:fractionDigits value="2"/>
    79                          <xs:totalDigits value="12"/>
    80                  </xs:restriction>
    81          </xs:simpleType>
    82          <xs:simpleType name="quantityType">
    83                  <xs:restriction base="xs:decimal">
    84                          <xs:fractionDigits value="4"/>
    85                          <xs:totalDigits value="8"/>
    86                  </xs:restriction>
    87          </xs:simpleType>
    88          <xs:simpleType name="UserType">
    89                  <xs:restriction base="xs:string">
    90                          <xs:minLength value="1"/>
    91                          <xs:maxLength value="10"/>
    92                  </xs:restriction>
    93          </xs:simpleType>
    94          <xs:simpleType name="RequestorType">
    95                  <xs:restriction base="xs:string">
    96                          <xs:minLength value="0"/>
    97                          <xs:maxLength value="128"/>
    98                  </xs:restriction>
    99          </xs:simpleType>
    100          <xs:simpleType name="CostCenterType">
    101                  <xs:restriction base="xs:string">
    102                          <xs:minLength value="1"/>
    103                          <xs:maxLength value="4"/>
    104                  </xs:restriction>
    105          </xs:simpleType>
    106          <xs:simpleType name="VendorType">
    107                  <xs:restriction base="xs:string">
    108                          <xs:minLength value="0"/>
    109                          <xs:maxLength value="20"/>
    110                  </xs:restriction>
    111          </xs:simpleType>
    112          <xs:simpleType name="PurchaseOrderNumberType">
    113                  <xs:restriction base="xs:integer"/>
    114          </xs:simpleType>
    115          <xs:simpleType name="SpecialInstructionsType">
    116                  <xs:restriction base="xs:string">
    117                          <xs:minLength value="0"/>
    118                          <xs:maxLength value="2048"/>
    119                  </xs:restriction>
    120          </xs:simpleType>
    121          <xs:simpleType name="NameType">
    122                  <xs:restriction base="xs:string">
    123                          <xs:minLength value="1"/>
    124                          <xs:maxLength value="20"/>
    125                  </xs:restriction>
    126          </xs:simpleType>
    127          <xs:simpleType name="AddressType">
    128                  <xs:restriction base="xs:string">
    129                          <xs:minLength value="1"/>
    130                          <xs:maxLength value="256"/>
    131                  </xs:restriction>
    132          </xs:simpleType>
    133          <xs:simpleType name="TelephoneType">
    134                  <xs:restriction base="xs:string">
    135                          <xs:minLength value="1"/>
    136                          <xs:maxLength value="24"/>
    137                  </xs:restriction>
    138          </xs:simpleType>
    139          <xs:simpleType name="DateType">
    140                  <xs:restriction base="xs:date"/>
    141          </xs:simpleType>
    142          <xs:simpleType name="CommentsType">
    143                  <xs:restriction base="xs:string">
    144                          <xs:minLength value="1"/>
    145                          <xs:maxLength value="2048"/>
    146                  </xs:restriction>
    147          </xs:simpleType>
    148          <xs:simpleType name="DescriptionType">
    149                  <xs:restriction base="xs:string">
    150                          <xs:minLength value="1"/>
    151                          <xs:maxLength value="256"/>
    152                  </xs:restriction>
    153          </xs:simpleType>
    154  </xs:schema>
    155  ');
    156  begin
    157    if (dbms_xdb.existsResource(:schemaPath)) then
    158      dbms_xdb.deleteResource(:schemaPath);
    159    end if;
    160    res := dbms_xdb.createResource(:schemaPath,xmlSchema);
    161  end;
    162  /
    PL/SQL procedure successfully completed.
    SQL> begin
      2    dbms_xmlschema.registerSchema
      3    (
      4      :schemaURL,
      5      xdbURIType(:schemaPath).getClob(),
      6      TRUE,TRUE,FALSE,FALSE
      7    );
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    SQL> create or replace view PURCHASEORDER_XML
      2  of xmltype
      3  xmlSCHEMA "http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd" Element "PurchaseOrder"
      4  with object id
      5  (
      6    substr(extractValue(object_value,'/PurchaseOrder/Reference'),1,32)
      7  )
      8  as
      9    select xmlElement
    10           (
    11             "PurchaseOrder",
    12             xmlAttributes
    13             (
    14               'http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd' as "xsi:noNamespaceSchemaLocation",
    15               'http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi"
    16             ),
    17             xmlElement("Reference",p.REFERENCE),
    18             xmlElement
    19             (
    20               "Actions",
    21               ( select xmlAgg
    22                        (
    23                          xmlElement
    24                          (
    25                            "Action",
    26                            xmlElement("User",ACTIONEDBY),
    27                            case
    28                              when DATEACTIONED is not null
    29                              then xmlElement("Date",DATEACTIONED)
    30                            end
    31                          )
    32                        )
    33                   from PURCHASEORDER_ACTION a
    34                  where a.REFERENCE = p.REFERENCE
    35               )
    36             ),
    37             xmlElement
    38             (
    39               "Reject",
    40                  xmlForest
    41                  (
    42                    REJECTEDBY as "User",
    43                 DATEREJECTED as "Date",
    44                    COMMENTS as "Comments"
    45                  )
    46             ),
    47             xmlElement("Requestor",REQUESTER),
    48             xmlElement("User",USERID),
    49             xmlElement("CostCenter",COSTCENTER),
    50             xmlElement
    51             (
    52               "ShippingInstructions",
    53               xmlElement("name",SHIPTONAME),
    54               xmlElement("address",ADDRESS),
    55               xmlElement("telephone",PHONE)
    56             ),
    57             xmlElement("SpecialInstructions",SPECIALINSTRUCTIONS),
    58             xmlElement
    59             (
    60               "LineItems",
    61               ( select xmlAgg
    62                        (
    63                          xmlElement
    64                          (
    65                            "LineItem",
    66                            xmlAttributes(LINENO as "ItemNumber"),
    67                            xmlElement("Description",DESCRIPTION),
    68                            xmlElement
    69                            (
    70                              "Part",
    71                              xmlAttributes
    72                              (
    73                                UPC       as "Id",
    74                                QUANTITY  as "Quantity",
    75                                UNITPRICE as "UnitPrice"
    76                              )
    77                            )
    78                          )
    79                        )
    80                    from PURCHASEORDER_LINEITEM l
    81                   where l.REFERENCE = p.REFERENCE
    82               )
    83             )
    84           )
    85      from PURCHASEORDER_TABLE p, PURCHASEORDER_REJECTION r, PURCHASEORDER_SHIPPING s
    86     where r.REFERENCE = p.REFERENCE
    87       and s.REFERENCE = p.REFERENCE
    88  /
    View created.
    SQL> set long 10000 pages 0 lines 140
    SQL> --
    SQL> select x.object_value.extract('/*')
      2    from PURCHASEORDER_XML x
      3  /
    <PurchaseOrder xsi:noNamespaceSchemaLocation="http://xfiles:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <Reference>SMCCAIN-20030109123335470PDT</Reference>
      <Actions>
        <Action>
          <User>SVOLLMAN</User>
        </Action>
      </Actions>
      <Reject/>
      <Requestor>Samuel B. McCain</Requestor>
      <User>SMCCAIN</User>
      <CostCenter>A10</CostCenter>
      <ShippingInstructions>
        <name>Samuel B. McCain</name>
        <address>800 Bridge Parkway,Redwood Shores,CA,94065,USA</address>
        <telephone>650 506 7800</telephone>
      </ShippingInstructions>
      <SpecialInstructions>Courier</SpecialInstructions>
      <LineItems>
        <LineItem ItemNumber="1">
          <Description>Life of Brian - Monty Python&apos;s</Description>
          <Part Id="715515010320" Quantity="2" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="2">
          <Description>The Night Porter</Description>
          <Part Id="37429145227" Quantity="2" UnitPrice="29.95"/>
        </LineItem>
        <LineItem ItemNumber="3">
          <Description>Oliver Twist</Description>
          <Part Id="37429128121" Quantity="1" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="4">
          <Description>Notorious</Description>
          <Part Id="715515012720" Quantity="4" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="5">
          <Description>In the Mood for Love</Description>
          <Part Id="715515012928" Quantity="3" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="6">
          <Description>Alphaville</Description>
          <Part Id="37429130926" Quantity="2" UnitPrice="29.95"/>
        </LineItem>
        <LineItem ItemNumber="7">
          <Description>General Idi Amin Dada</Description>
          <Part Id="37429166529" Quantity="4" UnitPrice="29.95"/>
        </LineItem>
        <LineItem ItemNumber="8">
          <Description>In the Mood for Love</Description>
          <Part Id="715515012928" Quantity="3" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="9">
          <Description>Flesh for Frankenstein</Description>
          <Part Id="715515009423" Quantity="3" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="10">
          <Description>The Killer</Description>
          <Part Id="715515008976" Quantity="1" UnitPrice="39.95"/>
        </LineItem>
        <LineItem ItemNumber="11">
          <Description>Ballad of a Soldier</Description>
          <Part Id="37429167922" Quantity="2" UnitPrice="29.95"/>
        </LineItem>
        <LineItem ItemNumber="12">
          <Description>Ordet</Description>
          <Part Id="37429158623" Quantity="2" UnitPrice="0"/>
        </LineItem>
      </LineItems>
    </PurchaseOrder>
    SQL> begin
      2    for x in (select object_value from PURCHASEORDER_XML) loop
      3      x.object_value.schemaValidate();
      4    end loop;
      5  end;
      6  /
    PL/SQL procedure successfully completed.
    SQL>

  • Xml to ABAP internal table mapping and schema validation

    Hi Experts,
    I'm trying to get data from an xml file into internal tables in ABAP. My requirement is to validate xml against an xsd schema, how can i do it?
    My other question is, if there are any possible ways to map the fields of a table so that once the xml file is read, the fields automatically get populated depending on the different elements and attributes in the xml file.
    -joe

    Hi,
    check out :
    http://help.sap.com/saphelp_nw70/helpdata/en/fd/9d734b389211d596a200a0c94260a5/frameset.htm
    Terry

Maybe you are looking for