Reregister modified XML Schema

I have some XML Schemas registered with my oracle 10g database. The types are created, but not the tables.
Now I have a change in field length in one of the Schemas and I need to reregister it. All the other schemas are dependent on this modified schema.
I used the following approach to delete the schema and register it.
dbms_xmlschema.deleteschema(schemaurl => 'my url',
delete_option => dbms_xmlschema.DELETE_CASCADE_FORCE);
dbms_xmlschema.registerschema(schemaurl => 'my url',
schemadoc => BFILENAME(SCHEMADIR, 'schema_name'),
local=>true,
genTypes=>true,
genbean=>false,
genTables=>false,
force=>false);
This successfully registered the schema.
But whenever the database is restarted, I face a dangling ref error whenever I try to access the OOT created for the Schema.
Any pointers on this will be of great help. Is this the right approach?
Also I read about dbms_xmlschema.copyevolve() procedure. I only need the types, so I am not interested in any transformations as I dont have any instance documents.

The last problem regarding dangling ref's on this forum ended up in creating an SR with support...
Before you register the schema you could set an event that will trace all statements that are executed in the "background" and stored in a trace file in the UDUMP directory
ALTER session SET events = '31098 trace name context forever';It is also always useful to check the database alert.log for errors...
Edited by: Marco Gralike on Nov 19, 2008 9:23 PM

Similar Messages

  • How can I modify a registered XML-Schema?

    Hi
    I have registered a XML-Schema document. Is it possible to modify it?
    Here is an example of an registered XML-Schema. What I have to do if I would like to change for example the MA_NR, without to delete and recreate the XML-Schema?
    DECLARE
    xml_schema VARCHAR2(1000) :=
    '<?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:adr="http://www.ordix.de/mitarbeiterAbteilung4.xsd"
    elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:complexType name="MitarbeiterType">
    <xs:sequence>
    <xs:element name="Ma_Nr"/>
    <xs:element name="Ma_Vorname"/>
    <xs:element name="Ma_Nachname"/>
    <xs:element name="Ma_Abteilung">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="Abteilung_NR"/>
         <xs:element name="Abteilung_Name"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    <xs:element name="Mitarbeiter" type="MitarbeiterType"/>
    </xs:schema>';
    BEGIN
    DBMS_XMLSCHEMA.registerSchema('http://www.ordix.de/mitarbeiterAbteilung4.xsd',xml_schema);
    END;

    I believe you want CopyEvolve

  • 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

  • Setting up default toString() in xml schema

    I have an xml schema and xml file that contains info for an app I created. Inside of the app, I load the objects into a combo box for the user to select an item. I want the actual objects in the combo box to access the data directly.
    Because of the nature of the combo box, it uses toString() for the actual display. In this case I have to modify the impl code to add in a toString() function for this to work correctly, and not give me the name of the object.
    Is there away to setup the xsd file to default one the attributes in the xml file to be returned with toString()?
    Example:
      <xsd:element name="JFeatsList" type="JFeatsType"/>
      <xsd:complexType name="JFeatsType">
        <xsd:sequence>
          <xsd:element name="JFeatItem" minOccurs="0" maxOccurs="unbounded">
            <xsd:complexType>
                <xsd:attribute name="FeatName" type="xsd:string"/>
                <xsd:attribute name="FeatType" type="xsd:string"/>
                <xsd:attribute name="Notes" type="xsd:string"/>
            </xsd:complexType>
          </xsd:element>
        </xsd:sequence>
      </xsd:complexType>
    ...I want the FeatName to be sent back with a toString() call.
    Thanks,
    Mike

    I'm an XML newbie myself, so I've probably just finished reinventing some wheels, but in any case, I've written some code that makes reading XML pretty easy.
    Here are some useful links:
    http://java.sun.com/webservices/docs/1.0/tutorial/index.html
    http://java.sun.com/webservices/download.html
    http://java.sun.com/webservices/downloads/webservicespack.html
    The latter contains C:\jwsdp-1_0_01\samples\jaxp\DOMEcho\DOMEcho.java, which creates a DOM from the XML file, and then traverses the DOM tree. For example, if I want to read the "Company motto" from my XML file:  <GUIconstants>
        <!-- Company motto
        -->
        <MOTTO value=""There's a sucker born every minute!""/>
        <!-- ComboBox mappings; can be any of DatabaseFieldDefinitions (and if you
             really, really, really don't want so many choices, you can completely
             remove the "combo_3" entry, for example).
          0 - ORIGIN_COLUMN       -> Origin airport    (ex. alternative: TIME_COLUMN)
          1 - DESTINATION_COLUMN  -> Destination airport (or: FLIGHT_NUMBER)
          2 - CARRIER_COLUMN      -> Carrier             (or: DAY_COLUMN)
          3 - FOSTERS_BEER_COLUMN -> pROGRAMMING pRODUCTIVITY aID
        -->
        <ComboBox_DatabaseField_Mappings
          combo_0="ORIGIN_COLUMN"
          combo_1="DESTINATION_COLUMN"
          combo_2="CARRIER_COLUMN"
          combo_3="DAY_COLUMN">
        </ComboBox_DatabaseField_Mappings>I have some code like:case Node.ELEMENT_NODE:
      category += "." + node.getNodeName();
      String temp = category;
      if (temp.startsWith(".FBNconfiguration")) {
        temp = temp.substring(".FBNconfiguration".length());
        // FBNconfiguration.GUIconstants
        else if (temp.startsWith(".GUIconstants")) {
          temp = temp.substring(".GUIconstants".length());
          // FBNconfiguration.GUIconstants.MOTTO
          if (temp.equals(".MOTTO"))
            Solitaires.MOTTO = new XMLconversion(node).get(Solitaires.MOTTO);
       * A class to package what's left over
      static class Solitaires {
        static String COMMAND_LINE_OPTIONS;
        static int PORT;
        static String WEEKDAYS;
        static int LOCK_DATABASE;
        static int LOCK_LEASE_DURATION;
        static String MOTTO;
        static int SCROLLPANE_JTABLE_WIDTH_DIFFERENCE;
        static boolean BUG_4736093_WORKAROUND;
      }XMLconversion is a pretty simple class:package suncertify.fbn.xml;
    import org.w3c.dom.*;
    * <p>Title: Fly by Night Travels</p>
    * <p>Description: Sun Certified Java Developer application</p>
    * <p>Copyright: Copyright (c) 2002</p>
    * <p>Company: Fly by Night Consultants</p>
    * @author Thomas Fly
    * @version 1.0
    * Convert a single ("Solitaire") XML entry
    public class XMLconversion {
      String value;
      public XMLconversion(Node node) {
        NamedNodeMap atts = node.getAttributes();
        value = atts.item(0).getNodeValue();
      public XMLconversion(Node node, boolean concatenate) {
        NamedNodeMap atts = node.getAttributes();
        value = "";
        for (int i = 0; i < atts.getLength(); i++) {
          Node att = atts.item(i);
          value += atts.item(i).getNodeValue() + "\n";
      public String get(String dataType) {
        return value;
      public int get(int dataType) {
        return new Integer(value).intValue();
      public boolean get(boolean dataType) {
        return value.equalsIgnoreCase("true");
    }Then in my FBNconstants class, I have stuff like:// GUIconstants
        MOTTO = Solitaires.MOTTO;
        COMBO_CONTENTS = comboBox_DatabaseField_Mappings.COMBO_CONTENTS;By extension, you can read into HashMap's & ArrayList's, and retrieve the translated objects as required.

  • XDB annotations on complex XML Schema

    I am currently testing this in 11gr2 Express, while I wait for our DBA to upgrade our main AIX dev instance to 11gr2 enterprise edition.
    I have a fairly complex xmlschema, provided by the IPTC and trying to annotate it to override some of the default sqltype mappings, but running into problems with how/where to annotate.
    From what I have learned so far, annotations to override the sqltype mappings can only be done on complexType and simpleTypes. ComplexTypes must map to a sql object type, and simpleTypes map to a basic atomic sqlType.
    How would you handle an instance where a complex type extends an xs:string.. but need to have this string map to a CLOB and not a varchar2(4000)?
    <xs:element name="inlineData">
                                                      <xs:annotation>
                                                           <xs:documentation>A rendition of the content using plain-text or encoded inline data</xs:documentation>
                                                      </xs:annotation>
                                                      <xs:complexType>
                                                           <xs:simpleContent>
                                                                <xs:extension base="xs:string">
                                                                     <xs:attributeGroup ref="newsContentAttributes" />
                                                                     <xs:attributeGroup ref="newsContentTypeAttributes" />
                                                                     <xs:attribute name="encoding" type="QCodeType">
                                                                          <xs:annotation>
                                                                               <xs:documentation>The encoding applied to the content before inclusion</xs:documentation>
                                                                          </xs:annotation>
                                                                     </xs:attribute>
                                                                     <xs:attributeGroup ref="newsContentCharacteristics" />
                                                                     <xs:attributeGroup ref="i18nAttributes" />
                                                                     <xs:anyAttribute namespace="##other" processContents="lax" />
                                                                </xs:extension>
                                                           </xs:simpleContent>
                                                      </xs:complexType>
                                                 </xs:element>Adding the xdb: mapUnboundedStringToLob annotation to element "inlineData" fails... not valid... and can't add it to the extension either.. so would a viable valid option in this case, be to create a simpleType, call it say "LargeStringToClob"..with a restriction of type xs:String... then annotate this simpleType to map it to a CLOB.
    Then change the inlineData element extension from xs:string to "LargeStringToClob" ? I plan to use an XMLType column with BinaryXML storage...
    I was hoping to not have to modify the xml schema too much, but I guess its to be expected when trying to map it into Oracle.
    I am faced with a similar issue when trying to annotate for Timestamp with time zone...
    some elements are declared as unions of other types. From what I have read, Oracle maps these to varchar2(4000)
    Example:
    <xs:simpleType name="DateOptTimeType">
              <xs:annotation>
                   <xs:documentation>The type of a date (required) and a time (optional).</xs:documentation>
              </xs:annotation>
              <xs:union memberTypes="xs:date xs:dateTime" />
         </xs:simpleType>Even though this is a simpleType... I cannot annotate it to map it to a TimeStamp with Timezone ... would I have to again... create simpleTypes for each of the memberTypes in the union, annotate each one to map to Timestampt with time zone.. then use these new simpleTypes in the union?
    Thanks for any tips or advice!

    odie_63 wrote:
    so if using Binary XML, you are stuck with what Oracle gives you? for instance, the inlineData element is an unbounded string in the schema... Oracle maps it to varchar2(4000).No, Binary XML stores data differently.
    Consider this simple example :
    SQL> begin
    2   dbms_xmlschema.registerSchema(
    3   schemaURL => 'test.xsd',
    4   schemaDoc => '<?xml version="1.0"?>
    5  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb">
    6  <xs:element name="note" xdb:defaultTable="NOTES_TABLE">
    7    <xs:complexType>
    8      <xs:sequence>
    9        <xs:element name="content" type="xs:string"/>
    10        <xs:element name="dt" type="xs:dateTime"/>
    11      </xs:sequence>
    12    </xs:complexType>
    13  </xs:element>
    14  </xs:schema>',
    15   local => true,
    16   genTypes => false,
    17   genTables => false,
    18   enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_NONE,
    19   options => dbms_xmlschema.REGISTER_BINARYXML
    20   );
    21  end;
    22  /
    PL/SQL procedure successfully completed
    SQL> CREATE TABLE notes_table OF XMLTYPE
    2  XMLTYPE STORE AS binary xml
    3  XMLSCHEMA "test.xsd"
    4  ELEMENT "note"
    5  ;
    Table created
    SQL> insert into notes_table values(xmltype(
    2  '<note>
    3  <content>'||lpad(to_clob('X'),8000,'X')||'</content>
    4  <dt>2011-11-16T11:56:23+01:00</dt>
    5  </note>'));
    1 row inserted
    SQL> select x.dt
    2       , x.content
    3       , length(x.content)
    4  from notes_table t
    5     , xmltable('/note' passing t.object_value
    6       columns dt      timestamp with time zone  path 'dt'
    7             , content clob                      path 'content'
    8       ) x
    9  ;
    DT                                CONTENT                                                                          LENGTH(X.CONTENT)
    16/11/11 11:56:23,000000 +01:00   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX              8000No issue in storing large strings.Very cool... that works... .. the string limit exceeded expcetion I got earlier was no fault to Binary XML.. but me pasting in too much text in SQLDeveloper insert statement.
    I think I may have been on this for too long... brain is getting fuzzy ;-)
    The approach you outline shows promise and I will go with BinaryXML storage option.
    I need to decide whether to use virtual columns or non-trivial columns at this point, to enforce integrity constraints and possibly some partitioning. We do have a few relational lookup tables to tie into this as well... and will also need to implement VPD.

  • Updating registered XML Schema

    We're going to use Oracle XML DB (Oracle 9.2.0.5). We will register our XML Schema files to Oracle. In case we later want to update one of the registered schemas I tested updating some example schemas.
    I found a thread here in the forum with some steps to update a registered schema we:
    forum
    >
    For each table or column based on the schema
    1. Create a table with a column of XMLType which is not based on the
    XMLSchema. EG XMLType stored as CLOB
    2. Copy the content of the existing table into the CLOB based table.
    3. Delete the existing schema
    4. REgister the New Schema.
    5. Recreate teh tables and columns
    6. COpy the data into the new tables using supplied XSL transformation where
    necessary
    7. Delete tempoarary tables....
    I followed the steps and it works.
    But there is one thing I want to know:
    I have a schema A and a schema B and I want to use definitions of schema B in schema A, using the <import> element. Now I want to update schema B. When i follow the steps above i have to backup all tables/coloumns which contain elements defined in schema B. Then i delete the schema and reregister it. When trying to query data in schema A i get an error message: ORA-04045: errors during recompilation/revalidation. This is even if i reregister the previous schema with annotations.
    For now i have to delete schema A too and reregister schema A and B. Is there a way to only update a single schema without affecting the schemas using definitions of this schema?
    Imagine i use a library schema with a lot of type definitions and other schemas import this schema because they need to use some of these types, then i have to update/reregister all the schemas. So any suggestions are welcomed.

    Please check if this helps:
    http://www.oracle.com/technology/oramag/oracle/03-jul/o43xml.html

  • Issues faced with XML (Objt-Rel) - Plan to move to Binary XML (schema-less)

    Hi All,
    Our Production DB has Oracle XMLDB implementation using 9 XMLDB Object-Relational
    Tables. These have been implemented almost since a year, and we faced several issues,
    have listed some of the most important ones:
    Obviously it is Object-Relational implementation, so we have 4-5 XSDs to start with that
    support the Object-Relational schema
    1) copyEvolve Issues : Due to changing Business Requirements constantly, we had to constantly
    and continuously modify/upgrade XSDs and then use "copyEvolve" to apply new XSDs
    Encountered several issues with CopyEvolve
    2) "Home-grown" solution to evolve XSD/Schema:
    We came up with our own Solution to migrate/evolve XSD schema.
    a) Backup all data from 9 XML DB Tables to 9 CLOB Tables (data is thus "dereferenced" and "delinked"
    from underlying XSDs
    b) Since data is backed up to CLOB Tables, go ahead and drop the entire schema and register
    new XSDs and recreate Tables. (GRANTS and PUBLIC SYNONYMS reappled, needless to say)
    c) Reload data from backed up CLOB Tables to newly created XMLDB (Obj-Relational) Tables
    Above approach (without "copyEvolve") has worked fine so far and helped in each Release/ every migration
    With our data sets becoming increasingly huge, downtime is not sufficient to follow this successful, home-grown
    approach and as a result we would like to get away from Object-Relational XMLDB Tables altogether.
    3) Our Application currently uses XPath heavily on all 9 XMLDB Tables and we understand XPath is already
    deprecated by Oracle (as of 11.2.0.2)
    We are seriously considering doing the following:
    1) Migrate all 9 XMLDB Tables and modify underlying Storage from "Object-Relational" to Binary XML (Schema-less)
    2) Modify Appln code with all XPath replaced by corresponding XQuery constructs
    3) Replace existing "B-TREE" based Indexes in Object-Relational XMLDB Tables with either a) Indexes on Virtual DB Columns to enforce Primary Key and Unique Constraints and b) XMLIndex on all other Non-Unique Columns instead of
    the corresponding "B-TREE" based Indexes
    What we hope to achieve with the above:
    1) Eliminate XSD Usage completely (and copyEvolve nightmares thereby)
    2) Eliminate Usage of XPath totally
    3) Better Performance overall :-)
    Would like to get some advice and feedback on our Proposed Plan and mainly are we taking the
    right direction especially in respect of Performance, Point 3) listed above
    Any feedback or tips would be truly appreciated
    Regards and Thanks
    Auro

    WRT to XPATH Vs XQuery.
    1. XPATH is a subset of XQuery.. Any XPATH expression is, by definition, an example of simple XQuery expression, so XPATH is not depricated.
    2. What we are depricateing are the older, oracle specific XML operators (EXTRACT(), EXTRACTVALUE(), EXISTSNODE()), that ONLY support XPATH. We are depricating these in favour of the new SQL/XML operators (XMLTABLE, XMLQUERY, XMLEXISTS) defined by the SQL standards committee. These operators provide support for the full XQquery standard, and implicitly all of the XPATH expressions that were supported by the older operators. This menas we strongly recommned that new code, developed to work with 11g make use of nrw newer operators. Personally I cannot see a point where we would ever consider de-supportting the older operators, we are well aware of how much code makes use of them.
    What this means is that any code that is written using the older operators will continue to work, unmodified. However should a bug surface in the use of the older operators, we would strongly recommend that the code in question be migrated to the new operators as part of the remidiation process.
    Also, once the initial pain of learning the new syntax is overcome, I truely believe that the new operators result in much more efficient and mantainable code, so taking the time to do code renevation when possible will probably pay off in the long term...
    WRT to moving away from Schema-Based OR storage, I would look at the kind of changes you have made to the XML Schema. If they are the kind of changes that would be supported by in-place evolution in 11g then you might want to re-consider this. If, on the other hand you are regularly making changes to the XML schema that are not backwardsly compatable with your older XML Schema then Schema-Based binary XML storeage (which is more flexible than Schema-Based Object-Relational storage) or even non-schema based Binary XML may be a better choice for your applicaiton..
    I would experment by registering the oldest version of your XML Schema in 11gR2, and then testing each of the evolutions you have gone through to see if 11GR2 inplace evolution would have managed them. Also, ask yourself do you expect your XML Schema to keep changing so drastically moving forward, or were some of these changes the results of the growing pains associated with learning how to use XML schema effectively. BTW the approach you outline is effectively what CopyEvolve is doing under the covers...
    Bear in mind that for the use-cases Object-Relational storage addesses, when all of the XPATH expressions are correctly re-written into SQL operations on the underlying tables, and where the majority of queries end up accessing or updating leaf-level nodes in the XML, it is unlikely that a Binary XML / Unstructured XML Index combination will deliver similar performance. If you are only accesss a small subset of the leaf-level nodes, creating structured XML Indexes that project out the nodes in question may be able to deliver similar performance to an Object-Relational storage model, but you will need to get the index definitions correct.
    -Mark
    Edited by: mdrake on Mar 7, 2011 7:40 PM

  • XML Schema for Java Bugs

    I've just downloaded your XML Schema for Java software are have been systematically testing it with a relatively simple document. A few bugs:
    1. the use="required" attribute of the attribute element doesn't have any effect (doesn't show any error message or throw any exceptions) when the required attribute is omitted.
    2. If I declare an element like:
    <element name="age">
    <simpleType>
    <restriction base="positiveInteger">
    <maxInclusive value="100"/>
    </restriction>
    </simpleType>
    </element>
    Then, if I modify my xml document instance to say:
    <age pointless="true">26</age>
    This will throw a non-parser exception with a message of null, instead of saying "Attribute 'pointless' not expected", as it does if I redefine the schema declaration as:
    <element name="age">
    <complexType>
    <simpleContent>
    <extension base="my:ageType"/>
    </simpleContent>
    </complexType>
    </element>
    Will Allan
    null

    I'm glad someone else has noticed that unique keyref and key don't seem to be working with the Dom Parser. If they don't work WHY ARE THEY (key, keyref, unique) IN THE EXAMPLE'S THAT ARE DOWNLOADED WITH THE SCHEMA PARSER. In report.xsd, a file downloaded with the example, it makes clear usage of unique, key, and key ref. But if you violate the schema definitions in the corresponding file report.xml the parser doesn't complain whatsoever. The only time it barfs is if you change the keyref refer attribute to something other than "pNumKey". It obviously has to work. No bone head would send example files along with their product that didn't work.
    So, if anyone at ORACLE or elsewhere has figured out how to use unique, key, or keyref please respond with an explination of how to correctly use them with the parser. Your name will be blessed throughout the ages as a most kind and venerable person. You will be a hallmark, a standard, a shining light for all future generations of what a human being should be! Okay maybe I'm going a little overboard but I'm DESPERATE. With no books or collateral on how this stupid thing works all I can do is hack.
    -Thanks

  • DOM, XML Schema, Java.  Confused!!!

    Hi all,
    Please help me to answer the 3 questions. I'm totally confused.
    1. Does DOM allow us to add invalid data based on the XML schema?
    2. I have an XML file. I want to use DOM to add, modify and delete nodes from the file, then print out an XML output file. If DOM does not prevent us from adding invalid data, I guess we have to run the validation after the output file is printed out?
    3. There are so many parsers, DOM, ... outthere that I am totally confused. Please give me your suggestions. I want to use Java to populate the DOM tree, check the data integrity based on the XML schema as I modify the DOM tree (if possible) or after printing the XML output to a file. What parser should I use? What DOM should I use (DOM or JDOM)? Can I use MS XML parser (because that what my main client uses), DOM, and Java? If so what do I need. I have read 2 books and many sites, but still don't have the answer clear yet.
    Very appreciate your help,
    Nam.

    1.
    never tried with Schema, with DTD: yes
    2.
    it is what I did*, which is pretty clumsy: currently AmauryDebou has started another thread on this subject but there's no answer yet.
    *in fact I do everything in RAM (no file needed): I ouptut the DOM in a byte array and then reparse it
    3.
    Xalan/Xerces is pretty standard (they are used in JAXP).
    JDOM has a reputation of being faster than DOM - depends on the amount of data you deal with.
    if you develop in Java, forget MSXML
    if parsing speed is an issue, you can achieve excellent performances with James Clark's XP.

  • Is JAXB the best solution to store XML schema in databse

    Hi, i have a doubt regarding which is better way to store XML schema to database.
    I have looked on JAXB, DOM, SAX.
    I should be able to modify the database and store back the changes in XML schema..
    i am really consfused about this.
    plz suggest me
    thanx

    Thank you for your reply
    As per as I know JAXB take XML schema as basis to
    create tables in database and store the XML data
    according to that . I want to store the XML Data in
    the database structured according to XML schema
    defined by me.I'm not sure how a schema would impact this. Schema is a data definition that constraints a given XML data document. The XML itself is stored as a string. Databases like Oracle now have XML column types and allow you to use XML querying languages and x-Path in normal SQL queries.
    There are 2 types of mapping from XML to datbase
    Table space and object relational
    A tablespace is conceptually similar to a namespace. Object relational mappers go from objects to relational databases and back. I do not see how either of these two concepts are mutually exclusive. And the latter makes no sense if you talking about an object database. There is no O/R mapping because there is no relational database, it's an object database.
    I want to do object-relational mapping from XML to
    o object oriented database . and the modifications
    done on the datbase want to store again in XML. As
    per as I know JAXB give us classes as per the XML
    schema and we can write DDL to store the data in
    databse
    JAXB is for marshalling and unmarshalling Java objects to and from XML. The XML itself can be stored in any LOB database column.
    Is it the right approach or do you have any better
    idea?I still do not really understand what you are trying to do. It seems like you have a bit too much technology soup to consume. What are the actual requirements?
    - Saish

  • Trouble including registered XML Schema in generated XML

    Hello,
    I'm new to XMLDB, and find myself wanting to build an XML document that conforms
    to a paricular XML schema. I'm looking for help in "passing" the shema into the
    xml query, and for advice (i may not be going about things in the best way possible).
    my data comes from three different sources: deliveries, origin of deliveries (warehouse),
    and a user-defined parameter (number of vehicles). I am putting the xml data together via union statements.
    this is slightly undesireable due to the limitations on union (no xmltypes, no clobs)
    and the size limitation of the varchar datatype. If there is a better way of structuring
    the end XML document (all three sources, one output record) then please advise me.
    I am having issues "passing" the registered XML schema to the SYS_XMLGEN function,
    so if you see where I've made a mistake, please point it out.
    Last thing, Oracle version: 9.2.0.4.0 (aka 9iR2)
    --Register a new XML schema
    --Since this is a GLOBAL schema, register it as privileged user (SYS).
    DECLARE
           vrp varchar2(10000) :=
    '<xs:schema targetNamespace="http://example.com/vrp.xsd"
        xmlns:vrp="http://example.com/vrp.xsd"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        elementFormDefault="qualified">
        <xs:complexType name="VehicleRoute">
            <xs:sequence>
                <xs:element name="Stops" type="vrp:Stops" minOccurs="1" maxOccurs="1" />
                <xs:element name="Vehicles" type="xs:string" minOccurs="1" maxOccurs="1" />
                <xs:element name="Warehouse" type="vrp:Warehouse" minOccurs="1" maxOccurs="1" />
            </xs:sequence>
        </xs:complexType>
        <xs:complexType name="Stops">
            <xs:sequence>
                <xs:element name="Stop" type="vrp:Stop" minOccurs="1" maxOccurs="unbounded" />
            </xs:sequence>
        </xs:complexType>
        <xs:complexType name="Stop">
            <xs:sequence>
                <xs:element name="Documents" type="vrp:Documents" minOccurs="1" maxOccurs="1" />
                <xs:element name="Stop_Address" type="xs:string" minOccurs="1" maxOccurs="1" />
                <xs:element name="Stop_Minutes" type="xs:double" minOccurs="1" maxOccurs="1" />
            </xs:sequence>
        </xs:complexType>
        <xs:complexType name="Documents">
            <xs:sequence>
                <xs:element name="Document" type="xs:string" minOccurs="1" maxOccurs="unbounded" />
            </xs:sequence>
        </xs:complexType>
        <xs:complexType name="Warehouse">
            <xs:sequence>
                <xs:element name="Warehouse_Address" type="xs:string" minOccurs="1" maxOccurs="1" />
            </xs:sequence>
        </xs:complexType>
        <xs:element name="Vehicle_Route" type="vrp:VehicleRoute" />
    </xs:schema>';  
    begin
      --"CUSTOM" is the name of my database user - the SCHEMA in which this development should occur.
         dbms_xmlschema.registerschema('http://example.com/vrp.xsd', vrp, false, false, false, false, false, 'CUSTOM');
    END;Here is the XML schema (as viewed by the 'CUSTOM' user):
    <xs:schema targetNamespace="http://example.com/vrp.xsd" xmlns:vrp="http://example.com/vrp.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:oraxdb="http://xmlns.oracle.com/xdb" oraxdb:flags="17" oraxdb:schemaURL="http://example.com/vrp.xsd" oraxdb:schemaOwner="CUSTOM" oraxdb:numProps="10">
      <xs:complexType name="VehicleRoute" oraxdb:SQLType="CLOB">
        <xs:sequence>
          <xs:element name="Stops" type="vrp:Stops" minOccurs="1" maxOccurs="1" oraxdb:propNumber="2225" oraxdb:global="false" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false"/>
          <xs:element name="Vehicles" type="xs:string" minOccurs="1" maxOccurs="1" oraxdb:propNumber="2226" oraxdb:global="false" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
          <xs:element name="Warehouse" type="vrp:Warehouse" minOccurs="1" maxOccurs="1" oraxdb:propNumber="2227" oraxdb:global="false" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false"/>
        </xs:sequence>
      </xs:complexType>
      <xs:complexType name="Stops" oraxdb:SQLType="CLOB">
        <xs:sequence>
          <xs:element name="Stop" type="vrp:Stop" minOccurs="1" maxOccurs="unbounded" oraxdb:propNumber="2228" oraxdb:global="false" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false"/>
        </xs:sequence>
      </xs:complexType>
      <xs:complexType name="Stop" oraxdb:SQLType="CLOB">
        <xs:sequence>
          <xs:element name="Documents" type="vrp:Documents" minOccurs="1" maxOccurs="1" oraxdb:propNumber="2229" oraxdb:global="false" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false"/>
          <xs:element name="Stop_Address" type="xs:string" minOccurs="1" maxOccurs="1" oraxdb:propNumber="2230" oraxdb:global="false" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
          <xs:element name="Stop_Minutes" type="xs:double" minOccurs="1" maxOccurs="1" oraxdb:propNumber="2231" oraxdb:global="false" oraxdb:memType="2" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
        </xs:sequence>
      </xs:complexType>
      <xs:complexType name="Documents" oraxdb:SQLType="CLOB">
        <xs:sequence>
          <xs:element name="Document" type="xs:string" minOccurs="1" maxOccurs="unbounded" oraxdb:propNumber="2232" oraxdb:global="false" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
        </xs:sequence>
      </xs:complexType>
      <xs:complexType name="Warehouse" oraxdb:SQLType="CLOB">
        <xs:sequence>
          <xs:element name="Warehouse_Address" type="xs:string" minOccurs="1" maxOccurs="1" oraxdb:propNumber="2233" oraxdb:global="false" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
        </xs:sequence>
      </xs:complexType>
      <xs:element name="Vehicle_Route" type="vrp:VehicleRoute" oraxdb:propNumber="2224" oraxdb:global="true" oraxdb:SQLType="CLOB" oraxdb:SQLName="Vehicle_Route" oraxdb:memType="258"/>
    </xs:schema>Here is sample data for reproducing what I'm seeing:
    --Create the "document" table
    create table vrp_document
    (document_num varchar2(10),
    document_minutes number(10),
    document_address varchar2(30));
    --Sample "document" data
    insert into vrp_document (document_num, document_minutes, document_address)
    values ('TEST1', 30, '1234 ELM ST');
    insert into vrp_document (document_num, document_minutes, document_address)
    values ('TEST2', 20, '1234 ELM ST');
    insert into vrp_document (document_num, document_minutes, document_address)
    values ('TEST3', 40, '1234 MAPLE ST');
    insert into vrp_document (document_num, document_minutes, document_address)
    values ('TEST3', 15, '1234 YEW ST');
    --Create the "warehouse" table
    create table vrp_warehouse
    (warehouse_id varchar2(3),
    warehouse_address varchar2(30));
    --Sample "warehouse" data
    insert into vrp_warehouse (warehouse_id, warehouse_address)
    values ('100', '900 MY OWN WAY');Query to produce XML
    Please note, I realize that for the data provided, the aggregations (and sub queries)
    are a little over the top. They are however necessary for my actual data set.
    SELECT SYS_XMLGEN(xmlagg(XMLTYPE(xmlroute)),  xmlformat.createFormat('Vehicle_Route')).getStringVal() Delivery_XML_Data
    FROM (SELECT XMLELEMENT("Stops",
              XMLAGG(XMLELEMENT("Stop",    
              XMLCONCAT(
                XMLELEMENT("Documents",
                    xmlagg(xmlelement("Document", t.document))),
                  xmlforest(t.document_address "Stop_Address",  
                 SUM(t.document_minutes) "Stop_Minutes"))))).getStringVal() AS xmlroute
    from     (select   s.document_num document, 
                       s.document_address,
                       sum(s.document_minutes) document_minutes
              from     vrp_document s       
              group by s.document_num, s.document_address) t
    GROUP BY t.document_address
    UNION
    SELECT   XMLELEMENT("Warehouse",
             xmlforest(
              w.warehouse_address "Warehouse_Address")).getstringval()
    from     vrp_warehouse w
    WHERE    w.warehouse_id = '100'
    union
    select   xmlelement("Vehicles", '&Number_Of_Vehicles').getstringval()
    FROM     dual) g;This query produces the following (Note. Answer "1" or any other integer for &Number_Of_Vehicles):
    The only other thing I want is to mention the above schema (that is, xmlns:http://example.com/vrp) or however that goes.
    I realize I can "fudge" this by assigning the attribute for various elements, but I think the "right" way would be to modify that call to createFormat().
    <?xml version="1.0"?>
    <Vehicle_Route>
    <Stops>
      <Stop>
        <Documents>
          <Document>TEST1</Document>
          <Document>TEST2</Document>
        </Documents>
        <Stop_Address>1234 ELM ST</Stop_Address>
        <Stop_Minutes>50</Stop_Minutes>
      </Stop>
      <Stop>
        <Documents>
          <Document>TEST3</Document>
        </Documents>
        <Stop_Address>1234 MAPLE ST</Stop_Address>
        <Stop_Minutes>40</Stop_Minutes>
      </Stop>
      <Stop>
        <Documents>
          <Document>TEST3</Document>
        </Documents>
        <Stop_Address>1234 YEW ST</Stop_Address>
        <Stop_Minutes>15</Stop_Minutes>
      </Stop>
    </Stops>
    <Vehicles>1</Vehicles>
    <Warehouse>
      <Warehouse_Address>900 MY OWN WAY</Warehouse_Address>
    </Warehouse>
    </Vehicle_Route>I have tried various permutation of the following with no success:
    Currently, the error is something serious:
    ORA-00600: internal error code, arguments: [kkdotat1], [], [], [], [], [], [], []
    00600. 00000 - "internal error code, arguments: [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s]"
    *Cause:    This is the generic internal error number for Oracle program
    exceptions.     This indicates that a process has encountered an
    exceptional condition.
    *Action:   Report as a bug - the first argument is the internal error number
    SELECT SYS_XMLGEN(xmlagg(XMLTYPE(xmlroute)),  xmlformat.createFormat('Vehicle_Route', 'USE_GIVEN_SCHEMA', 'http://example.com/vrp.xsd', 'http://example.com/vrp.xsd')).getStringVal() Delivery_XML_Data
    . . .Edited by: user2316919 on Jan 21, 2010 3:46 PM

    Cannot find a cleanest solution:
    SQL>  select xmltype('<?xml version="1.0"?>'||
      2                  xmlelement("Vehicle_Route",
      3                     xmlattributes('http://www.w3.org/2001/XMLSchema-instance' AS "xmlns:xsi",
      4                                   'http://example.com/vrp.xsd' AS "xsi:schemaLocation"
      5                                   ),
      6                     xmlagg(xmltype(xmlroute))
      7                     ).extract('/*')
      8                  ) Delivery_XML_Data
      9   FROM (SELECT XMLELEMENT("Stops",
    10             XMLAGG(XMLELEMENT("Stop",    
    11             XMLCONCAT(
    12               XMLELEMENT("Documents",
    13                   xmlagg(xmlelement("Document", t.document))),
    14             xmlforest(t.document_address "Stop_Address",  
    15                SUM(t.document_minutes) "Stop_Minutes"))))).getStringVal() AS xmlroute
    16   from     (select   s.document_num document, 
    17                      s.document_address,
    18                      sum(s.document_minutes) document_minutes
    19             from     vrp_document s       
    20             group by s.document_num, s.document_address) t
    21   GROUP BY t.document_address
    22   UNION
    23   SELECT   XMLELEMENT("Warehouse",
    24             xmlforest(
    25              w.warehouse_address "Warehouse_Address")).getstringval()
    26    from     vrp_warehouse w
    27    WHERE    w.warehouse_id = '100'
    28    union
    29    select   xmlelement("Vehicles", '&Number_Of_Vehicles').getstringval()
    30    FROM     dual) g;
    Immettere un valore per number_of_vehicles: 1
    vecchio  29:   select   xmlelement("Vehicles", '&Number_Of_Vehicles').getstringval()
    nuovo  29:   select   xmlelement("Vehicles", '1').getstringval()
    DELIVERY_XML_DATA
    <?xml version="1.0"?><Vehicle_Route xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schema
    http://example.com/vrp.xsd">
      <Stops>
        <Stop>
          <Documents>
            <Document>TEST1</Document>
            <Document>TEST2</Document>
          </Documents>
          <Stop_Address>1234 ELM ST</Stop_Address>
          <Stop_Minutes>50</Stop_Minutes>
        </Stop>
        <Stop>
          <Documents>
            <Document>TEST3</Document>
          </Documents>
          <Stop_Address>1234 MAPLE ST</Stop_Address>
          <Stop_Minutes>40</Stop_Minutes>
        </Stop>
        <Stop>
          <Documents>
            <Document>TEST3</Document>
          </Documents>
          <Stop_Address>1234 YEW ST</Stop_Address>
          <Stop_Minutes>15</Stop_Minutes>
        </Stop>
      </Stops>
      <Vehicles>1</Vehicles>
      <Warehouse>
        <Warehouse_Address>900 MY OWN WAY</Warehouse_Address>
      </Warehouse>
    </Vehicle_Route>
    {code}
    Max
    [My Italian Oracle blog|http://oracleitalia.wordpress.com/2010/01/17/supporto-di-xml-schema-in-oracle-xmldb/]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • XML Schemas & XML SCHEMA COLLECTIONS: XSD.exe & the tool in C:\Program Files (x86)\Microsoft SDKs\Windows\v7..0A\Bin\x64?.

    Hi all,
    I just read Pages 346-348 of the book "Microsoft SQL Server 2012 Bible" written by A. Jorgensen, P. LeBlanc, J. Chinchilla, J. Segarra & A. Nelson (published by Wiley) regarding XML Schemas and XML SCHEMA COLLECTIONS: Step 1.  create and
    save orderxml.xml
    <Order OrderID="1">
    <Item>
    <ItemNumber>V001</ItemNumber>
    <Quantity>1</Quantity>
    <Price>299.99</Price>
    </Item>
    </Order>
    Step 2.  using the tool in the following location:
    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\x64
    Open a command prompt, and navigate the preceding directory. The syntax for creating schema is: Xsd.exe C:\temp\orderxml.xml /outputdirectory:c:\temp  to create the orderxml.xsd file.  
    Step 3. Copy all the contents of the orderxml.xsd file to the clipboard, and create a new query window in SQL Server Management Studio, pasting in the content of the clipboard. To create the XML Schema Collection, you need to add the CREATE XML SCHEMA COLLECTION
    statement to the beginning of the schema as shown below:
    --MSss2012bibleP348.sql for XML Schema Collection OrderInformationSchemaCollection
    -- Copied and executed by SHC (Date & Time): 24 April 2015 8:05 AM
    USE ScottChangDB
    GO
    Create XML SCHEMA COLLECTION OrderInformationCollection AS
    N'<?xml version="1.0" encoding="utf-16"?>
    <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:msdata="urn:schema-microsoft-com:xml-msdata">
    <xs:element name="Order">
    <xs:sequence>
    <xs:element name="Item" minOccurs="0" maxOccurs="unbounded".
    <xs:complexType>
    <xs:sequence>
    <xs:element name="ItemNumber" type="xs:string" minOccurs="0" />
    <xs:element name="Quantity" type="xs:string" minOccurs="0" />
    <xs:element name="price" type="xs:string" minOccurs="0" />
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    <xs:attribute name="OrderID" type="xs:string" />
    </xs:complexType>
    </xs:element>
    <xs:element name="NewDataSet" msdata" msdata:IsDataSet="true"
    msdata:UseCurrentLocale="true">
    <xs:complexType>
    <xs:choice minOccurs="0" maxOccurs="unbounded'>
    <xs:element ref="Order" />
    </xs:choice>
    </xs:complexType>
    </xs:element>
    </xs:schema>' ;
    /* Apply it to the table/columns */
    ALTER TABLE ItemInfo
    ALTER COLUMN ItemData xml (OrderInformationCollection)
    GO
    I prepared (i) the orderxml.xml file for Step 1 and Step 2, and (ii) the MSss2012bibleP348.sql file for Step 3. But I am not sure that I can do the Steps (i) and (ii) in my PC that does not have the regular version of Microsoft SQL Server 2012 and Microsoft
    Visual Studio 2012. Furthermore, I  have difficulties to do Step 2 and Step 3 in my PC that is the part of Windows 7 Lan Computer System in my office: I navigated to my C:\Program Files (x86)\Microsoft SDKs\v7.0A\Bin\, I did not see the x64
    thing in the  Bin folder, but, I saw the xsd.exe in the Bin folder. If I click the xsd.exe and I get the following in the bottom of the PC screen:   
    xsd.exe Date modified:12/122011 12:55 PM    Date created:  12/12/2011  12:55 PM
    Applicaion    Size:81.8 KB
    Also, I see my PC screen flashes (and it looks like a dialog box with black background to flash for me to type the command) quickly. I am lost completely in this step and I don't understand the whole thing in doing Step 1, Step 2, and Step 3
    I briefly summarized/described/presented above.
    I need the following help from the experts of XML Schemas and XML Schema Collections in Microsoft SQL Server 2012 Management Studio:
    Help #1: I don't understan the concept of Step 1, Step2 and Step 3 to do XML Schema, XSD.exe, and XML Schema Collection in the SQL Server 2012!!?? I just have the SQL Server 2012 Management Studio (SSMS2012) in my PC.
    Help #2: How can I execute the xsd.exe in my C:\Program Files  (x86)\Microsoft SDKs\Windows\v7.0A\Bin\ folder?
    Help #3: I just learned the basic things of creating XML SCHEMA COLLECTIONS in my SSMS2012 directly. Is the MSss2012P348.sql (I created and presented above) right for the task? How can I use clipboard to create the XML Schema Collection in my ScottChangDB
    database?
    Please kindly help and give me the answers/comments for Help #1, Help #2 and Help #3.
    Thanks in advance,
    Scott Chang  

    Hi Scott,
    Help #1: I don't understan the concept of Step 1, Step2 and Step 3 to do XML Schema, XSD.exe, and XML Schema Collection in the SQL Server 2012!!?? I just have the SQL Server 2012 Management Studio (SSMS2012) in my PC.
    Step1 and Step2 not that related to SQL Server, you can get the XSD from a given XML with an online XSD generator.
    Google search: XSD generator
    Help #2: How can I execute the xsd.exe in my C:\Program Files  (x86)\Microsoft SDKs\Windows\v7.0A\Bin\ folder?
    Please see the link in the #1
    Help #3: I just learned the basic things of creating XML SCHEMA COLLECTIONS in my SSMS2012 directly. Is the MSss2012P348.sql (I created and presented above) right for the task? How can I use clipboard to create the XML Schema Collection in
    my ScottChangDB database?
    See the syntax and example in
    create XML schema collection
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • How to create default column in XML schema ?

    Hi All,
    I would like to define a default column let's say Run_Date as Date datatype in XML schema definition (XSD) and would like to populate SYSDATE to the column Run_Date, When XML records are parsed to that schema.
    Please let me know, how we can achieve?
    Thanks in Advance.

    Hi,
    Thanks for the update. Please find below my responses and let me know your thoughts.
    The Existing schema definition is as follows
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="true">
    <xs:element name="Emp" type="EmpType" xdb:defaultTable="EMPLOYEES" xdb:columnProps="CONSTRAINT emp_pk PRIMARY KEY (XMLDATA.EMP_NO)" />
    <xs:complexType name="EmpType" xdb:SQLType="EMPLOYEES_T">
    <xs:sequence>
    <xs:element name="EmpNo" xdb:SQLName="EMP_NO">
    <xs:simpleType>
    <xs:restriction base="xs:positiveInteger">
    <xs:totalDigits value="10"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="FirstName" xdb:SQLName="FIRST_NAME">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="30"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="LastName" xdb:SQLName="LAST_NAME">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="30"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="EmployeeType" xdb:SQLName="EMPLOYEE_TYPE">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:length value="25"/>
    <xs:enumeration value="Permanent"/>     
    <xs:enumeration value="Consultant"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="EmpLocation" xdb:SQLName="EMP_LOCATION">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="25"/>
    <xs:enumeration value="NewYork"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="EmpExperience" xdb:SQLName="EMP_EXPERIENCE">
    <xs:simpleType>
    <xs:restriction base="xs:positiveInteger">
    <xs:totalDigits value="10"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:schema>
    The sample XML file is as follows
    <?xml version="1.0"?>
    <Emp xsi:noNamespaceSchemaLocation="EMP.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xdb="http://xmlns.oracle.com/xdb">
    <EmpNo>1001</EmpNo>
    <FirstName>William</FirstName>
    <LastName>Don</LastName>
    <EmployeeType>Permanent</EmployeeType>
    <EmpLocation>NewYork</EmpLocation>
    <EmpExperience>10</EmpExperience>
    </Emp>
    The modified schema definition is as follows
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="true">
    <xs:element name="Emp" type="EmpType" xdb:defaultTable="EMPLOYEES" xdb:columnProps="CONSTRAINT emp_pk PRIMARY KEY (XMLDATA.EMP_NO)" />
    <xs:complexType name="EmpType" xdb:SQLType="EMPLOYEES_T">
    <xs:sequence>
    <xs:element name="EmpNo" xdb:SQLName="EMP_NO">
    <xs:simpleType>
    <xs:restriction base="xs:positiveInteger">
    <xs:totalDigits value="10"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="FirstName" xdb:SQLName="FIRST_NAME">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="30"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="LastName" xdb:SQLName="LAST_NAME">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="30"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="EmployeeType" xdb:SQLName="EMPLOYEE_TYPE">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:length value="25"/>
    <xs:enumeration value="Permanent"/>     
    <xs:enumeration value="Consultant"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="EmpLocation" xdb:SQLName="EMP_LOCATION">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="25"/>
    <xs:enumeration value="NewYork"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="EmpExperience" xdb:SQLName="EMP_EXPERIENCE">
    <xs:simpleType>
    <xs:restriction base="xs:positiveInteger">
    <xs:totalDigits value="10"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    <xs:element name="WorkHrs" maxOccurs="100" xdb:SQLName="WorkHrs" xdb:propNumber="3280" xdb:global="false" xdb:SQLType="WorkHrs_T" xdb:SQLSchema="APPS" xdb:memType="258" xdb:SQLInline="true" xdb:MemInline="false" xdb:JavaInline="false" xdb:SQLCollType="WORKHRS330_COLL" xdb:SQLCollSchema="APPS">
    <xs:complexType xdb:SQLType="WORKHRS_T" xdb:SQLSchema="APPS">
    <xs:attribute name="Day" xdb:SQLName="DAY" xdb:propNumber="3273" xdb:global="false" xdb:SQLType="VARCHAR2" xdb:memType="2">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="20"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="Hrs" xdb:SQLName="HRS" xdb:propNumber="3274" xdb:global="false" xdb:SQLType="NUMBER" xdb:memType="2">
    <xs:simpleType>
    <xs:restriction base="xs:decimal"/>
    </xs:simpleType>
    </xs:attribute>
    </xs:schema>
    The sample XML file is as follows
    <?xml version="1.0"?>
    <Emp xsi:noNamespaceSchemaLocation="EMP.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xdb="http://xmlns.oracle.com/xdb">
    <EmpNo>1001</EmpNo>
    <FirstName>William</FirstName>
    <LastName>Don</LastName>
    <EmployeeType>Permanent</EmployeeType>
    <EmpLocation>NewYork</EmpLocation>
    <EmpExperience>10</EmpExperience>
    <WorkHrs Day="Monday" Hrs="8.0"/>
    <WorkHrs Day="Tuesday" Hrs="6.5"/>
    <WorkHrs Day="Wednesday" Hrs="8.5"/>
    <WorkHrs Day="Thursday" Hrs="10.5"/>
    <WorkHrs Day="Friday" Hrs="5.5"/>
    </Emp>
    The Copy Evolve Procedure is as follows (I have added attributes to the above schema definition)
    DECLARE
    SCHEMA_TO_EVOLVE     XDB$STRING_LIST_T;
    NEW_SCHEMA               XMLSEQUENCETYPE;
    OLD_SCHEMA_URL          VARCHAR2(100) := 'EMP.xsd';
    V_NEW_XML_DOC          CLOB := '<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="true">
    <xs:element name="Emp" type="EmpType" xdb:defaultTable="EMPLOYEES" xdb:columnProps="CONSTRAINT emp_pk PRIMARY KEY (XMLDATA.EMP_NO)" />
    <xs:complexType name="EmpType" xdb:SQLType="EMPLOYEES_T">
    <xs:sequence>
    <xs:element name="EmpNo" xdb:SQLName="EMP_NO">
    <xs:simpleType>
    <xs:restriction base="xs:positiveInteger">
    <xs:totalDigits value="10"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="FirstName" xdb:SQLName="FIRST_NAME">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="30"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="LastName" xdb:SQLName="LAST_NAME">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="30"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="EmployeeType" xdb:SQLName="EMPLOYEE_TYPE">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:length value="25"/>
    <xs:enumeration value="Permanent"/>     
    <xs:enumeration value="Consultant"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="EmpLocation" xdb:SQLName="EMP_LOCATION">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="25"/>
    <xs:enumeration value="NewYork"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="EmpExperience" xdb:SQLName="EMP_EXPERIENCE">
    <xs:simpleType>
    <xs:restriction base="xs:positiveInteger">
    <xs:totalDigits value="10"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    <xs:element name="WorkHrs" maxOccurs="100" xdb:SQLName="WorkHrs" xdb:propNumber="3280" xdb:global="false" xdb:SQLType="WorkHrs_T" xdb:SQLSchema="APPS" xdb:memType="258" xdb:SQLInline="true" xdb:MemInline="false" xdb:JavaInline="false" xdb:SQLCollType="WORKHRS330_COLL" xdb:SQLCollSchema="APPS">
    <xs:complexType xdb:SQLType="WORKHRS_T" xdb:SQLSchema="APPS">
    <xs:attribute name="Day" xdb:SQLName="DAY" xdb:propNumber="3273" xdb:global="false" xdb:SQLType="VARCHAR2" xdb:memType="2">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="20"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="Hrs" xdb:SQLName="HRS" xdb:propNumber="3274" xdb:global="false" xdb:SQLType="NUMBER" xdb:memType="2">
    <xs:simpleType>
    <xs:restriction base="xs:decimal"/>
    </xs:simpleType>
    </xs:attribute>
    </xs:schema>';
    BEGIN
    DBMS_OUTPUT.PUT_LINE('B4 GETTING FILE FROM OS');
    EXECUTE IMMEDIATE 'DROP TABLE EMPLOYEES_TEMP';
    -- Getting file from the file system
    --V_NEW_XML_DOC           := XXTIF_EDI_UTL.GET_CLOB_DOCUMENT('COIL_1.1.xsd','UTF8');
    SCHEMA_TO_EVOLVE     := XDB$STRING_LIST_T(OLD_SCHEMA_URL);
    NEW_SCHEMA           := XMLSEQUENCETYPE(XMLTYPE(V_NEW_XML_DOC));
    DBMS_XMLSCHEMA.COPYEVOLVE(SCHEMA_TO_EVOLVE,NEW_SCHEMA, preserveOldDocs => TRUE, mapTabName => 'EMPLOYEES_TEMP', generateTables => FALSE);
    COMMIT;
    DBMS_OUTPUT.PUT_LINE('SUCCESSFULLY COPIED');
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('THE ERROR IS '||SQLERRM);
    END;
    The Table Creation is as follows
    CREATE TABLE EMPLOYEES (XMLDOC XMLTYPE,
                   CREATE_DATE DATE DEFAULT SYSDATE NOT NULL ,
    CONSTRAINT emp_pk PRIMARY KEY (XMLDOC."XMLDATA".EMP_NO)
    XMLTYPE COLUMN XMLDOC STORE AS OBJECT RELATIONAL
    XMLSCHEMA "EMP.xsd" ELEMENT "Emp"
    DECLARE
    TABLENAME VARCHAR2(2000) := 'EMPLOYEES1128';
    BEGIN
    SELECT TEMP_TABNAME
    INTO TABLENAME
    FROM EMPLOYEES_TEMP
    WHERE TABLE_NAME = USER || '.' || UPPER('RELATIE_DOCUMENTEN');
    EXECUTE IMMEDIATE 'INSERT INTO EMPLOYEES(XMLDOC) SELECT XMLTYPE(DATA) FROM ' || TABLENAME;
    COMMIT;
    END;
    When I executed the above SQL, It only populates main data(Perosnal Details such as EmpNo,FirstName,LastName) but not attributes (Workhrs.Day,WOrkhrs.Hrs).
    Please let me know, how can I move those attributes data?
    Again Oracle & XML versions are as follows
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE 10.2.0.3.0 Production
    Oracle XML Database 10.2.0.3.0
    Thanks in Advance.

  • Is it possible to use List Type in XML schema within the SOA Rule author?

    Is it possible to use List Type in XML schema within the SOA Suite Rule author? The reason is that with the following XSD, Rule author generates XML facts of type "List" for the element "ResultSet". Basically I want to check the Input facts (Input1, Input2, Input3) for some conditions and then assign action to the element Resultset of type List (array). The output Resultset can contain multiple values based on the input facts. My problem is that I am unable to see the ResultSet in the "Assign" action type of the action block. Is it possible to use the Resultset of type List with the Rule author or is there any limitation on the rule author and any workaround for this?
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.oracle.com/ns/TestMultipleOutputs"
    elementFormDefault="qualified">
    <element name="TestMultipleOutputs">
    <complexType>
    <sequence minOccurs="0">
    <element name="Input1" type="string" minOccurs="0"/>
    <element name="Input2" type="string" minOccurs="0"/>
    <element name="Input3" type="string" minOccurs="0"/>
    <element name="ResultSet" type="string" minOccurs="0"
    maxOccurs="unbounded"/>
    </sequence>
    </complexType>
    </element>
    </schema>
    --Thanks a lot                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi Richard,
    I have slightly modified the xml schema you suggested and was able to import into the rule author. the following is the modified XSD. Rule Author created a List type for the "ResultSet" . I still don't see "Resultset" in the assign action, so I tried creating RL function in order to assign the output to the "Resultset", but was unsuccessful so far. can you please let me know how to populate the resultset with the output values? Thanks a lot.
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema attributeFormDefault="unqualified"
    xmlns:ns1="http://www.oracle.com/ns/TestComplexOutputs"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.oracle.com/ns/TestComplexOutputs"
    xmlns:tns="http://www.oracle.com/ns/TestComplexOutputs"
    elementFormDefault="qualified">
    <xsd:element name="TestComplexOutputs">
    <xsd:complexType>
    <xsd:sequence minOccurs="0">
    <xsd:element name="Input1" type="xsd:string" minOccurs="0"/>
    <xsd:element name="Input2" type="xsd:string" minOccurs="0"/>
    <xsd:element name="Input3" type="xsd:string" minOccurs="0"/>
    <xsd:element name="ResultSet" type="tns:ResultSetType" minOccurs="0"
    maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:complexType name="ResultSetType">
    <xsd:sequence>
    <xsd:element name="ResultSet" type="tns:ResultSetStructure" minOccurs="1"
    maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="ResultSetStructure">
    <xsd:sequence>
    <xsd:element name="ErrorReason">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string"/>
    </xsd:simpleType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>

  • Comparing two XML Schemas

    Hi All,
    I want to compare two versions of the same XML Schema. I am working with Oracle 10g XML DB. I think we have something in 11g but I am constrainted to 10g.
    Requirement:
    1. I start afresh and register the XML Schema and also insert XML documents compliant to that schema in my XMLTYPE table.
    2. Now after some time, I need to add a new element. So, I modify the XML Schema and write the XSLT for its addition to XML documents and do a CopyEvolve(). Let us assume, I have a script for this.
    3. Now if accidentally, I rerun the script, I may run into errors as the element is already there.
    So, I thought I should find the differences between the new version of the schema and the old version and if there are differences apply the XSLT and also evolve the schema. How do we do this?
    Also, Can we generate the XSLT automatically based on the two versions of XML Schema?
    Thanks
    Ramesh

    XML Schemas are just XML documents.
    Compare the XML Schemas using the XDK's XMLDiff class and generate the XSLT from the differences.
    http://www.devx.com/Java/Article/30943

Maybe you are looking for

  • How do I run an app as root at Login?

    Hi, I need to run an application as root at login (not startup). The terminal command to do this is: sudo -b /Applications/MarcoPolo.app/Contents/MacOS/MarcoPolo Is there a way to run "/Applications/MarcoPolo.app/Contents/MacOS/MarcoPolo" as root whe

  • Can you convert a PDF to Word in Arabic?

    Hello, Can you convert a pdf to word in Arabic? When I want to convert a file, adobe does not offer me Arabic. Can you help me please? Thank's

  • Can't Calibrate My Display

    I have an iMac G5, running 10.4.2 and have some printing issues....which call for me to calibrate my display. When I run the utility the proflie of my display cannot be found. A call to AppleCare says that my only recourse it to run an archive and re

  • Need help figuring out permissions for a migration project

    Hi all We are in the middle of a migration from various Exchange environments over to a hybrid Exchange 2010 and Office 365 environment. Recently we had to change the setup for migrating mailboxes from on-premise to on-premise using Quest Migration M

  • We think 5.0.2 has fixed it! (InCopy Files Not Synchronizing Properly)

    Last year there was a topic (now archived) titled 'InCopy Files Not Synchronizing Properly' which discussed a problem with InCopy breaking the VC link after editing the story. 5.02 update ID and IC seems to have fixed it. We have only done a quick te