XDB 10.2g Structured Schema

Hello,
I am trying to insert 2 different kinds of instances(with the same root) into 1 xmltype table. the xml schema's are all registered and the object types were created for them. I want to know if oracle xdb is using the object types to manage the data i inserted into the table...even though the object types are not part of the table. It does not seem like its using the object types because when i change an element name in the instance, it still allows me to insert.
Here are the schemas i registered in order:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="qualified" attributeFormDefault="unqualified" xdb:storeVarrayAsTable="true">
<!-- |=================================================================================| -->
<xs:element name="Person" type="Person_Type" xdb:SQLName="PERSON" xdb:defaultTable="XDB_PERSON_TBL"/>
<!-- |=================================================================================| -->
<xs:complexType name="Person_Type" xdb:SQLType="PERSON_T">
<xs:sequence>
<xs:element name="FirstName" type="xs:string" xdb:SQLName="FIRSTNAME"/>
<xs:element name="LastName" type="xs:string" minOccurs="0" xdb:SQLName="LASTNAME"/>
<xs:element name="Employment" type="Employment_Type" minOccurs="0" xdb:SQLName="EMPLOYMENT"/>
</xs:sequence>
</xs:complexType>
<!-- |=================================================================================| -->
<xs:complexType name="Employment_Type" xdb:SQLType="EMPLOYMENT_T" >
<xs:sequence>
<xs:any minOccurs="0" processContents="lax" xdb:SQLName="ANY_EMPLOYMENT" namespace="##local"/>
</xs:sequence>
</xs:complexType>
<!-- |=================================================================================| -->
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://my.plumber.test/plumber/test" targetNamespace="http://my.plumber.test/plumber/test" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- |=================================================================================| -->
<xs:element name="Plumber" type="Plumber_Type"/>
<!-- |=================================================================================| -->
<xs:complexType name="Plumber_Type">
<xs:sequence>
<xs:element name="PlumberCompanyName" type="xs:string"/>
<xs:element name="PlumberCertID" type="xs:string" minOccurs="0"/>
<xs:element name="PlumberJobID" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<!-- |=================================================================================| -->
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://my.carpenter.test/carpenter/test" targetNamespace="http://my.carpenter.test/carpenter/test" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- |=================================================================================| -->
<xs:element name="Carpenter" type="Carpenter_Type"/>
<!-- |=================================================================================| -->
<xs:complexType name="Carpenter_Type">
<xs:sequence>
<xs:element name="CarpenterCompanyName" type="xs:string"/>
<xs:element name="CarpenterCertID" type="xs:string" minOccurs="0"/>
<xs:element name="CarpenterJobID" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<!-- |=================================================================================| -->
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:carpenter="http://my.carpenter.test/carpenter/test" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="qualified" attributeFormDefault="unqualified" xdb:storeVarrayAsTable="true">
<!-- |=================================================================================| -->
<xs:include schemaLocation="Person.xsd"/>
<xs:import namespace="http://my.carpenter.test/carpenter/test" schemaLocation="Carpenter.xsd"/>
<!-- |=================================================================================| -->
<xs:element name="CarpenterAdapter" type="CarpenterAdapter_Type" xdb:SQLName="CARPENTERADAPTER" xdb:defaultTable=""/>
<!-- |=================================================================================| -->
<xs:complexType name="CarpenterAdapter_Type" xdb:SQLType="CARPENTER_T">
<xs:complexContent>
<xs:extension base="Employment_Type">
<xs:sequence>
<xs:element ref="carpenter:Carpenter" minOccurs="0" xdb:SQLName="REF_CARPENTER" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- |=================================================================================| -->
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:plumber="http://my.plumber.test/plumber/test" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="qualified" attributeFormDefault="unqualified" xdb:storeVarrayAsTable="true">
<!-- |=================================================================================| -->
<xs:include schemaLocation="Person.xsd"/>
<xs:import namespace="http://my.plumber.test/plumber/test" schemaLocation="Plumber.xsd"/>
<!-- |=================================================================================| -->
<xs:element name="PlumberAdapter" type="PlumberAdapter_Type" xdb:SQLName="PLUMBERADAPTER" xdb:defaultTable=""/>
<!-- |=================================================================================| -->
<xs:complexType name="PlumberAdapter_Type" xdb:SQLType="PLUMBER_T">
<xs:complexContent>
<xs:extension base="Employment_Type">
<xs:sequence>
<xs:element ref="plumber:Plumber" minOccurs="0" xdb:SQLName="REF_PLUMBER" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- |=================================================================================| -->
</xs:schema>
These are the instances i insert.
<?xml version="1.0" encoding="UTF-8"?>
<Person>
<FirstName>Jeff</FirstName>
<LastName>Smith</LastName>
<Employment>
<PlumberAdapter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Plumber_Adapter.xsd">
<Plumber xmlns="http://my.plumber.test/plumber/test">
<PlumberCompanyName>Downtown Plumbing Inc.</PlumberCompanyName>
<PlumberCertID>23</PlumberCertID>
<PlumberJobID>009</PlumberJobID>
</Plumber>
</PlumberAdapter>
</Employment>
</Person>
<?xml version="1.0" encoding="UTF-8"?>
<Person>
<FirstName>Steve</FirstName>
<LastName>Smith</LastName>
<Employment>
<CarpenterAdapter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Carpenter_Adapter.xsd">
<Carpenter xmlns="http://my.carpenter.test/carpenter/test">
<CarpenterCompanyName>Up Town Carpenter Co.</CarpenterCompanyName>
<CarpenterCertID>222</CarpenterCertID>
<CarpenterJobID>12</CarpenterJobID>
</Carpenter>
</CarpenterAdapter>
</Employment>
</Person>
this is how i registered:
DBMS_XMLSCHEMA.registerSchema
SCHEMAURL => << uri >> ,
SCHEMADOC => << schema >> ,
LOCAL => TRUE ,
GENTYPES => TRUE ,
GENBEAN => FALSE ,
GENTABLES => TRUE ,
FORCE => FALSE ,
OWNER => << owner >>
This is how I insert:
v_xml := XMLTYPE.createXML( <<instance>> , <<uri>> , 0 , 0 );
INSERT INTO XDB_PERSON_TBL VALUES ( :v_xml.createSchemaBasedXML( 'Person.xsd' ) ) ;
EXECUTE IMMEDIATE tmpquery USING v_xml;
This all works fine but I still don't think its using the object types.
Hope someone can help.
thanks.

Hello,
I am trying to insert 2 different kinds of instances(with the same root) into 1 xmltype table. the xml schema's are all registered and the object types were created for them. I want to know if oracle xdb is using the object types to manage the data i inserted into the table...even though the object types are not part of the table. It does not seem like its using the object types because when i change an element name in the instance, it still allows me to insert.
Here are the schemas i registered in order:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="qualified" attributeFormDefault="unqualified" xdb:storeVarrayAsTable="true">
<!-- |=================================================================================| -->
<xs:element name="Person" type="Person_Type" xdb:SQLName="PERSON" xdb:defaultTable="XDB_PERSON_TBL"/>
<!-- |=================================================================================| -->
<xs:complexType name="Person_Type" xdb:SQLType="PERSON_T">
<xs:sequence>
<xs:element name="FirstName" type="xs:string" xdb:SQLName="FIRSTNAME"/>
<xs:element name="LastName" type="xs:string" minOccurs="0" xdb:SQLName="LASTNAME"/>
<xs:element name="Employment" type="Employment_Type" minOccurs="0" xdb:SQLName="EMPLOYMENT"/>
</xs:sequence>
</xs:complexType>
<!-- |=================================================================================| -->
<xs:complexType name="Employment_Type" xdb:SQLType="EMPLOYMENT_T" >
<xs:sequence>
<xs:any minOccurs="0" processContents="lax" xdb:SQLName="ANY_EMPLOYMENT" namespace="##local"/>
</xs:sequence>
</xs:complexType>
<!-- |=================================================================================| -->
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://my.plumber.test/plumber/test" targetNamespace="http://my.plumber.test/plumber/test" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- |=================================================================================| -->
<xs:element name="Plumber" type="Plumber_Type"/>
<!-- |=================================================================================| -->
<xs:complexType name="Plumber_Type">
<xs:sequence>
<xs:element name="PlumberCompanyName" type="xs:string"/>
<xs:element name="PlumberCertID" type="xs:string" minOccurs="0"/>
<xs:element name="PlumberJobID" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<!-- |=================================================================================| -->
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://my.carpenter.test/carpenter/test" targetNamespace="http://my.carpenter.test/carpenter/test" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- |=================================================================================| -->
<xs:element name="Carpenter" type="Carpenter_Type"/>
<!-- |=================================================================================| -->
<xs:complexType name="Carpenter_Type">
<xs:sequence>
<xs:element name="CarpenterCompanyName" type="xs:string"/>
<xs:element name="CarpenterCertID" type="xs:string" minOccurs="0"/>
<xs:element name="CarpenterJobID" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<!-- |=================================================================================| -->
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:carpenter="http://my.carpenter.test/carpenter/test" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="qualified" attributeFormDefault="unqualified" xdb:storeVarrayAsTable="true">
<!-- |=================================================================================| -->
<xs:include schemaLocation="Person.xsd"/>
<xs:import namespace="http://my.carpenter.test/carpenter/test" schemaLocation="Carpenter.xsd"/>
<!-- |=================================================================================| -->
<xs:element name="CarpenterAdapter" type="CarpenterAdapter_Type" xdb:SQLName="CARPENTERADAPTER" xdb:defaultTable=""/>
<!-- |=================================================================================| -->
<xs:complexType name="CarpenterAdapter_Type" xdb:SQLType="CARPENTER_T">
<xs:complexContent>
<xs:extension base="Employment_Type">
<xs:sequence>
<xs:element ref="carpenter:Carpenter" minOccurs="0" xdb:SQLName="REF_CARPENTER" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- |=================================================================================| -->
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:plumber="http://my.plumber.test/plumber/test" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="qualified" attributeFormDefault="unqualified" xdb:storeVarrayAsTable="true">
<!-- |=================================================================================| -->
<xs:include schemaLocation="Person.xsd"/>
<xs:import namespace="http://my.plumber.test/plumber/test" schemaLocation="Plumber.xsd"/>
<!-- |=================================================================================| -->
<xs:element name="PlumberAdapter" type="PlumberAdapter_Type" xdb:SQLName="PLUMBERADAPTER" xdb:defaultTable=""/>
<!-- |=================================================================================| -->
<xs:complexType name="PlumberAdapter_Type" xdb:SQLType="PLUMBER_T">
<xs:complexContent>
<xs:extension base="Employment_Type">
<xs:sequence>
<xs:element ref="plumber:Plumber" minOccurs="0" xdb:SQLName="REF_PLUMBER" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- |=================================================================================| -->
</xs:schema>
These are the instances i insert.
<?xml version="1.0" encoding="UTF-8"?>
<Person>
<FirstName>Jeff</FirstName>
<LastName>Smith</LastName>
<Employment>
<PlumberAdapter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Plumber_Adapter.xsd">
<Plumber xmlns="http://my.plumber.test/plumber/test">
<PlumberCompanyName>Downtown Plumbing Inc.</PlumberCompanyName>
<PlumberCertID>23</PlumberCertID>
<PlumberJobID>009</PlumberJobID>
</Plumber>
</PlumberAdapter>
</Employment>
</Person>
<?xml version="1.0" encoding="UTF-8"?>
<Person>
<FirstName>Steve</FirstName>
<LastName>Smith</LastName>
<Employment>
<CarpenterAdapter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Carpenter_Adapter.xsd">
<Carpenter xmlns="http://my.carpenter.test/carpenter/test">
<CarpenterCompanyName>Up Town Carpenter Co.</CarpenterCompanyName>
<CarpenterCertID>222</CarpenterCertID>
<CarpenterJobID>12</CarpenterJobID>
</Carpenter>
</CarpenterAdapter>
</Employment>
</Person>
this is how i registered:
DBMS_XMLSCHEMA.registerSchema
SCHEMAURL => << uri >> ,
SCHEMADOC => << schema >> ,
LOCAL => TRUE ,
GENTYPES => TRUE ,
GENBEAN => FALSE ,
GENTABLES => TRUE ,
FORCE => FALSE ,
OWNER => << owner >>
This is how I insert:
v_xml := XMLTYPE.createXML( <<instance>> , <<uri>> , 0 , 0 );
INSERT INTO XDB_PERSON_TBL VALUES ( :v_xml.createSchemaBasedXML( 'Person.xsd' ) ) ;
EXECUTE IMMEDIATE tmpquery USING v_xml;
This all works fine but I still don't think its using the object types.
Hope someone can help.
thanks.

Similar Messages

  • Cube structure / Schema

    Hello Friends ,
    Need an Immediate Help .
    I want to generate am empty CUBE Schema Structure . Below is the example
    I generated the List of dimensions and Measures using the CUBE DMV's of my CUBE individually.
    But i want all the dimensions and Measures to display in matrix formlike below :
                    M1       M2     M3
    D1
    D2
    D3
    D4
    Whatever be the count of Dimensions or whatever be the count of Measures ...
    PLease Help.

    Hi Rakesh,
    Its difficult to display the in the Browser for Dimensions and Measures to display in the matrix form .Keeping Measures in the Column side and Dimension Names in the row side .
    One Question Have you Installed
    BIDS Helper ?
    You can try with BIDS Helper property available in Dimension Usage tab, Which is Printer friendly dimension Usage. With this you can export the requested Out put in Excel and PDF format.
    Hope this will help you.
    Thanks,
    Suhas Kudekar
    Mark as Answer if this resolves your problem or "Vote as Helpful" if you find it helpful.
    My Blog
    Follow @SuhasKudekar

  • XML Data Load into releational structures

    Hi,
    I am very unexperienced in using XML and have the problem
    to import very large XML data files into existing reletional structures.
    In our production DB we don't use the java engine, so
    that PL/SQL an the SQL Loader are the only available ways to import the data.
    At the moment we get flat files and use the SQL Loader utility. But an interface to a new system send XML data now and I have to fill the same old releational structure with the new data.
    Can anybody give me a hint about the best technic for an high performance import. Are there any existing tools for the relational mapping?
    Regards Ralph

    Thank you for your reply.
    You are right. We only want to break the XML to fill our relational structures. We don't need the XML data further on. But we have to load the data in temporary structures, because we have to transform the data in our own format. (The system which delivers the XML data is external and uses another data model)
    Is there no more elegant way with use of databse built in technics? The XML data we get can be validated against a XML schema.
    So I thought, it could be a way to load the XML in the XDB and register the schema in the database. After that store the XML data in the default generated object relational structures and then programm the data transformation and the data flow between these default structures to our target data structures with PL/SQL.
    I don't know if this way is performant enough.
    If I use an external tool i have to code the relational mapping outside the database and insert the data with use of ODBC in temporary structures which i have to create manualy.
    So I hoped to find a way to load the data in any relational structure using the advantages of XML and XML schema and code the neccasary logic inside the DB.
    Do you have any further hints for my problem?
    Regards Ralph

  • Storing non-schema based data

    Hi!
    (1)When I use ftp or win explorer to transfer a file to the repository it works and I can see the doc and its contents in the OEM/win explorer. This file is not based on any registered schema. In what tables does it get stored in scott's schema?
    (2)also on trying to access the repository resources, very frequently the win explorer gives error messages saying that 'The current operation can not be completed as an unexpected error has occurred'.
    appreciate any help....

    Non-schema based XML in the repository are handled by a "default" XMLSchema,
    which is XDBSchema.xsd. Is it true?What I meant by XDB schema, is a set of database tables owned by the Database User XDB. The contents of these tables are exposed to other database users as the RESOURCE_VIEW and PATH_VIEW. There are a number of tables that provide the infrastructure that supported the XML DB repository. These tables should never be accessed directly.
    All non schema based content is stored in the XML DB repository. The primary table in the XML DB repository is XDB$RESOURCE, which is an XMLType table, as you can see from the following:
    C:\Documents and Settings\MDRAKE>sqlplus xdb/xdb
    SQL*Plus: Release 9.2.0.1.0 - Production on Tue Jul 23 23:06:45 2002
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.1.0 - Production
    SQL> describe XDB$RESOURCE
    Name                                      Null?    Type
    TABLE of SYS.XMLTYPE(XMLSchema "http://xmlns.oracle.com/xdb/XDBResource.xsd" E
    ment "Resource") STORAGE Object-relational TYPE "XDB$RESOURCE_T"XDB$RESOURCE is an XMLType table which manages Resource elements defined by the schema.
    /sys/schemas/public/xmlns.oracle.com/xdb/XDBResource.xsd
    They are stored as XMLType somewhere in the XDB schema.
    Where exactly? The structure of the associated object is shown below
    SQL> describe XDB$RESOURCE_T
    Name                                      Null?    Type
    VERSIONID                                          NUMBER(38)
    CREATIONDATE                                       TIMESTAMP(6)
    MODIFICATIONDATE                                   TIMESTAMP(6)
    AUTHOR                                             VARCHAR2(128)
    DISPNAME                                           VARCHAR2(128)
    RESCOMMENT                                         VARCHAR2(128)
    LANGUAGE                                           VARCHAR2(128)
    CHARSET                                            VARCHAR2(128)
    CONTYPE                                            VARCHAR2(128)
    REFCOUNT                                           RAW(4)
    LOCKS                                              RAW(2000)
    ACLOID                                             RAW(16)
    OWNERID                                            RAW(16)
    CREATORID                                          RAW(16)
    LASTMODIFIERID                                     RAW(16)
    ELNUM                                              NUMBER(38)
    SCHOID                                             RAW(16)
    XMLREF                                             REF OF XMLTYPE
    XMLLOB                                             BLOB
    FLAGS                                              RAW(4)
    RESEXTRA                                           CLOB
    ACTIVITYID                                         NUMBER(38)
    VCRUID                                             RAW(16)
    PARENTS                                            XDB$PREDECESSOR_LIST_T
    SQL>Non-schema based documents, regardles of whether they are XML, or other kinds of content (Word, JPEG etc) are stored in the XMLLOB column in the XDB$RESOURCE_T object. The information above is provided simply to clarify where the content is stored in the case of non schema based documents. Again, I remind you that we do not support accessing this information directly.

  • Is there a way to extract information from a registered schema ?

    Hello,
    with the aid of the XSOM project in java.net, and using the following after I loaded the appropriate jars and creating the wrapper PL/SQL
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED GMS10.XSOMNAVIGATOR AS
    import java.util.Vector;
    import com.sun.xml.xsom.XSComplexType;
    import com.sun.xml.xsom.XSElementDecl;
    import com.sun.xml.xsom.XSFacet;
    import com.sun.xml.xsom.XSModelGroup;
    import com.sun.xml.xsom.XSModelGroupDecl;
    import com.sun.xml.xsom.XSParticle;
    import com.sun.xml.xsom.XSRestrictionSimpleType;
    import com.sun.xml.xsom.XSSimpleType;
    import com.sun.xml.xsom.XSTerm;
    import com.sun.xml.xsom.parser.XSOMParser;
    public class XSOMNavigator
        public static class SimpleTypeRestriction
            public String[] enumeration = null;
            public String   maxValue    = null;
            public String   minValue    = null;
            public String   length      = null;
            public String   maxLength   = null;
            public String   minLength   = null;
            public String[] pattern     = null;
            public String   totalDigits = null;
            public String toString()
                String enumValues = "";
                if (enumeration != null)
                    for(String val : enumeration)
                        enumValues += val + ", ";
                    enumValues = enumValues.substring(0, enumValues.lastIndexOf(','));
                String patternValues = "";
                if (pattern != null)
                    for(String val : pattern)
                        patternValues += "(" + val + ")|";
                    patternValues = patternValues.substring(0, patternValues.lastIndexOf('|'));
                String retval = "";
                retval += maxValue    == null ? "" : "[MaxValue  = "   + maxValue      + "]\t";
                retval += minValue    == null ? "" : "[MinValue  = "   + minValue      + "]\t";
                retval += maxLength   == null ? "" : "[MaxLength = "   + maxLength     + "]\t";
                retval += minLength   == null ? "" : "[MinLength = "   + minLength     + "]\t";
                retval += pattern     == null ? "" : "[Pattern(s) = "  + patternValues + "]\t";
                retval += totalDigits == null ? "" : "[TotalDigits = " + totalDigits   + "]\t";
                retval += length      == null ? "" : "[Length = "      + length        + "]\t";         
                retval += enumeration == null ? "" : "[Values = "      + enumValues    + "]\t";
                return retval;
        private static void initRestrictions(XSSimpleType xsSimpleType, SimpleTypeRestriction simpleTypeRestriction)
            XSRestrictionSimpleType restriction = xsSimpleType.asRestriction();
            if (restriction != null)
                Vector<String> enumeration = new Vector<String>();
                Vector<String> pattern     = new Vector<String>();
                for (XSFacet facet : restriction.getDeclaredFacets())
                    if (facet.getName().equals(XSFacet.FACET_ENUMERATION))
                        enumeration.add(facet.getValue().value);
                    if (facet.getName().equals(XSFacet.FACET_MAXINCLUSIVE))
                        simpleTypeRestriction.maxValue = facet.getValue().value;
                    if (facet.getName().equals(XSFacet.FACET_MININCLUSIVE))
                        simpleTypeRestriction.minValue = facet.getValue().value;
                    if (facet.getName().equals(XSFacet.FACET_MAXEXCLUSIVE))
                        simpleTypeRestriction.maxValue = String.valueOf(Integer.parseInt(facet.getValue().value) - 1);
                    if (facet.getName().equals(XSFacet.FACET_MINEXCLUSIVE))
                        simpleTypeRestriction.minValue = String.valueOf(Integer.parseInt(facet.getValue().value) + 1);
                    if (facet.getName().equals(XSFacet.FACET_LENGTH))
                        simpleTypeRestriction.length = facet.getValue().value;
                    if (facet.getName().equals(XSFacet.FACET_MAXLENGTH))
                        simpleTypeRestriction.maxLength = facet.getValue().value;
                    if (facet.getName().equals(XSFacet.FACET_MINLENGTH))
                        simpleTypeRestriction.minLength = facet.getValue().value;
                    if (facet.getName().equals(XSFacet.FACET_PATTERN))
                        pattern.add(facet.getValue().value);
                    if (facet.getName().equals(XSFacet.FACET_TOTALDIGITS))
                        simpleTypeRestriction.totalDigits = facet.getValue().value;
                if (enumeration.size() > 0)
                    simpleTypeRestriction.enumeration = enumeration.toArray(new String[] {});
                if (pattern.size() > 0)
                    simpleTypeRestriction.pattern = pattern.toArray(new String[] {});
        private static void printParticle(XSParticle particle, String occurs, String absPath, String indent)
            occurs = "  MinOccurs = " + particle.getMinOccurs() + ", MaxOccurs = " + particle.getMaxOccurs();
            XSTerm term = particle.getTerm();
            if (term.isModelGroup())
                printGroup(term.asModelGroup(), occurs, absPath, indent);   
            else if(term.isModelGroupDecl())
                printGroupDecl(term.asModelGroupDecl(), occurs, absPath, indent);   
            else if (term.isElementDecl())
                printElement(term.asElementDecl(), occurs, absPath, indent);
            else
        private static void printGroup(XSModelGroup modelGroup, String occurs, String absPath, String indent)
            System.out.println(indent + "[Start of " + modelGroup.getCompositor() + occurs + "]" );
            for (XSParticle particle : modelGroup.getChildren())
                printParticle(particle, occurs, absPath, indent + "\t");
            System.out.println(indent + "[End of " + modelGroup.getCompositor() + "]");
        private static void printGroupDecl(XSModelGroupDecl modelGroupDecl, String occurs, String absPath, String indent)
            System.out.println(indent + "[Group " + modelGroupDecl.getName() + occurs + "]");
            printGroup(modelGroupDecl.getModelGroup(), occurs, absPath, indent);
        private static void printComplexType(XSComplexType complexType, String occurs, String absPath, String indent)
            System.out.println();
            XSParticle particle = complexType.getContentType().asParticle();
            if (particle != null)
                printParticle(particle, occurs, absPath, indent);
        private static void printSimpleType(XSSimpleType simpleType, String occurs, String absPath, String indent)
            SimpleTypeRestriction restriction = new SimpleTypeRestriction();
            initRestrictions(simpleType, restriction);
            System.out.println(restriction.toString());
        private static void printElement(XSElementDecl element, String occurs, String absPath, String indent)
            absPath += "/" + element.getName();
            System.out.print(indent + "[Element " + absPath + "   " + occurs + "] of type [" + element.getType().getBaseType().getName() + "]");
            if (element.getType().isComplexType())
                printComplexType(element.getType().asComplexType(), occurs, absPath, indent);
            else
                printSimpleType(element.getType().asSimpleType(), occurs, absPath, indent);
        public static void xsomNavigate(String xsdFile, String rootElement)
            String occurs  = "";
            String absPath = "";
            String indent  = "";
            try
                XSOMParser parser = new XSOMParser();
                parser.parse(xsdFile);
                printElement(parser.getResult().getSchema(1).getElementDecl(rootElement), occurs, absPath, indent);
            catch (Exception exp)
                exp.printStackTrace(System.out);
    /I obtained the following (correct) result
    [Element /CD026A   ] of type [anyType]
    [Start of sequence  MinOccurs = 1, MaxOccurs = 1]
         [Group HEADER  MinOccurs = 1, MaxOccurs = 1]
         [Start of sequence  MinOccurs = 1, MaxOccurs = 1]
              [Element /CD026A/SynIdeMES1     MinOccurs = 1, MaxOccurs = 1] of type [string][Values = UNOC]     
              [Element /CD026A/SynVerNumMES2     MinOccurs = 1, MaxOccurs = 1] of type [string][Values = 3]     
              [Element /CD026A/MesSenMES3     MinOccurs = 1, MaxOccurs = 1] of type [string][MaxLength = 70]     
              [Element /CD026A/SenIdeCodQuaMES4     MinOccurs = 0, MaxOccurs = 1] of type [string][MaxLength = 4]     
              [Element /CD026A/MesRecMES6     MinOccurs = 1, MaxOccurs = 1] of type [string][MaxLength = 35]     
              [Element /CD026A/RecIdeCodQuaMES7     MinOccurs = 0, MaxOccurs = 1] of type [string][MaxLength = 4]     
              [Element /CD026A/DatOfPreMES9     MinOccurs = 1, MaxOccurs = 1] of type [nonNegativeInteger][Pattern(s) = ([1-2][0-9]{3}[0][1-9][0][1-9])|([1-2][0-9]{3}[0][1-9][1|2][0-9])|([1-2][0-9]{3}[0][1-9][3][0|1])|([1-2][0-9]{3}[1][0-2][0][1-9])|([1-2][0-9]{3}[1][0-2][1|2][0-9])|([1-2][0-9]{3}[1][0-2][3][0|1])|([0-9]{2}[0][1-9][0][1-9])|([0-9]{2}[0][1-9][1|2][0-9])|([0-9]{2}[0][1-9][3][0|1])|([0-9]{2}[1][0-2][0][1-9])|([0-9]{2}[1][0-2][1|2][0-9])|([0-9]{2}[1][0-2][3][0|1])]     
              [Element /CD026A/TimOfPreMES10     MinOccurs = 1, MaxOccurs = 1] of type [string][Pattern(s) = ([0-1]{1}[0-9]{1}[0-5]{1}[0-9]{1})|([2]{1}[0-3]{1}[0-5]{1}[0-9]{1})]     [Length = 4]     
              [Element /CD026A/IntConRefMES11     MinOccurs = 1, MaxOccurs = 1] of type [string][MaxLength = 14]     
              [Element /CD026A/RecRefMES12     MinOccurs = 0, MaxOccurs = 1] of type [string][MaxLength = 14]     
              [Element /CD026A/RecRefQuaMES13     MinOccurs = 0, MaxOccurs = 1] of type [string][Length = 2]     
              [Element /CD026A/AppRefMES14     MinOccurs = 0, MaxOccurs = 1] of type [string][MaxLength = 14]     
              [Element /CD026A/PriMES15     MinOccurs = 0, MaxOccurs = 1] of type [string][MaxLength = 1]     
              [Element /CD026A/AckReqMES16     MinOccurs = 0, MaxOccurs = 1] of type [nonNegativeInteger][Values = 0, 1]     
              [Element /CD026A/ComAgrIdMES17     MinOccurs = 0, MaxOccurs = 1] of type [string][MaxLength = 35]     
              [Element /CD026A/TesIndMES18     MinOccurs = 0, MaxOccurs = 1] of type [nonNegativeInteger][Values = 0, 1]     
              [Element /CD026A/MesIdeMES19     MinOccurs = 1, MaxOccurs = 1] of type [string][MaxLength = 14]     
              [Element /CD026A/MesTypMES20     MinOccurs = 1, MaxOccurs = 1] of type [string][Values = CC004A, CC005A, CC007A, CC008A, CC009A, CC013A, CC014A, CC015A, CC016A, CC017A, CC019A, CC021A, CC023A, CC025A, CC026A, CC028A, CC029A, CC035A, CC043A, CC044A, CC045A, CC051A, CC054A, CC055A, CC058A, CC060A, CC062A, CC100A, CC102A, CC103A, CC224A, CC225A, CC228A, CC229A, CC231A, CC907A, CC917A, CD001A, CD002A, CD003A, CD006A, CD010A, CD018A, CD020A, CD024A, CD027A, CD030A, CD031A, CD032A, CD033A, CD034A, CD037A, CD038A, CD050A, CD059A, CD063A, CD104A, CD105A, CD106A, CD111A, CD112A, CD114A, CD115A, CD118A, CD200A, CD201A, CD203A, CD204A, CD205A, CD209A, CD411A, CD901A, CD904A, CD905A, CD906A, CD907A, CD912A, CD913A, CD914A, CD916A, CD931A, CD932A, AT004A, AT005A, AT007A, AT008A, AT009A, AT013A, AT014A, AT015A, AT016A, AT017A, AT019A, AT021A, AT023A, AT025A, AT026A, AT028A, AT029A, AT035A, AT043A, AT044A, AT045A, AT051A, AT054A, AT055A, AT058A, AT060A, AT062A, AT100A, AT102A, AT103A, AT224A, AT225A, AT228A, AT229A, AT231A, AT907A, AT917A, BE004A, BE005A, BE007A, BE008A, BE009A, BE013A, BE014A, BE015A, BE016A, BE017A, BE019A, BE021A, BE023A, BE025A, BE026A, BE028A, BE029A, BE035A, BE043A, BE044A, BE045A, BE051A, BE054A, BE055A, BE058A, BE060A, BE062A, BE100A, BE102A, BE103A, BE224A, BE225A, BE228A, BE229A, BE231A, BE907A, BE917A, CY004A, CY005A, CY007A, CY008A, CY009A, CY013A, CY014A, CY015A, CY016A, CY017A, CY019A, CY021A, CY023A, CY025A, CY026A, CY028A, CY029A, CY035A, CY043A, CY044A, CY045A, CY051A, CY054A, CY055A, CY058A, CY060A, CY062A, CY100A, CY102A, CY103A, CY224A, CY225A, CY228A, CY229A, CY231A, CY907A, CY917A, CZ004A, CZ005A, CZ007A, CZ008A, CZ009A, CZ013A, CZ014A, CZ015A, CZ016A, CZ017A, CZ019A, CZ021A, CZ023A, CZ025A, CZ026A, CZ028A, CZ029A, CZ035A, CZ043A, CZ044A, CZ045A, CZ051A, CZ054A, CZ055A, CZ058A, CZ060A, CZ062A, CZ100A, CZ102A, CZ103A, CZ224A, CZ225A, CZ228A, CZ229A, CZ231A, CZ907A, CZ917A, DE004A, DE005A, DE007A, DE008A, DE009A, DE013A, DE014A, DE015A, DE016A, DE017A, DE019A, DE021A, DE023A, DE025A, DE026A, DE028A, DE029A, DE035A, DE043A, DE044A, DE045A, DE051A, DE054A, DE055A, DE058A, DE060A, DE062A, DE100A, DE102A, DE103A, DE224A, DE225A, DE228A, DE229A, DE231A, DE907A, DE917A, DK004A, DK005A, DK007A, DK008A, DK009A, DK013A, DK014A, DK015A, DK016A, DK017A, DK019A, DK021A, DK023A, DK025A, DK026A, DK028A, DK029A, DK035A, DK043A, DK044A, DK045A, DK051A, DK054A, DK055A, DK058A, DK060A, DK062A, DK100A, DK102A, DK103A, DK224A, DK225A, DK228A, DK229A, DK231A, DK907A, DK917A, EE004A, EE005A, EE007A, EE008A, EE009A, EE013A, EE014A, EE015A, EE016A, EE017A, EE019A, EE021A, EE023A, EE025A, EE026A, EE028A, EE029A, EE035A, EE043A, EE044A, EE045A, EE051A, EE054A, EE055A, EE058A, EE060A, EE062A, EE100A, EE102A, EE103A, EE224A, EE225A, EE228A, EE229A, EE231A, EE907A, EE917A, ES004A, ES005A, ES007A, ES008A, ES009A, ES013A, ES014A, ES015A, ES016A, ES017A, ES019A, ES021A, ES023A, ES025A, ES026A, ES028A, ES029A, ES035A, ES043A, ES044A, ES045A, ES051A, ES054A, ES055A, ES058A, ES060A, ES062A, ES100A, ES102A, ES103A, ES224A, ES225A, ES228A, ES229A, ES231A, ES907A, ES917A, FI004A, FI005A, FI007A, FI008A, FI009A, FI013A, FI014A, FI015A, FI016A, FI017A, FI019A, FI021A, FI023A, FI025A, FI026A, FI028A, FI029A, FI035A, FI043A, FI044A, FI045A, FI051A, FI054A, FI055A, FI058A, FI060A, FI062A, FI100A, FI102A, FI103A, FI224A, FI225A, FI228A, FI229A, FI231A, FI907A, FI917A, FR004A, FR005A, FR007A, FR008A, FR009A, FR013A, FR014A, FR015A, FR016A, FR017A, FR019A, FR021A, FR023A, FR025A, FR026A, FR028A, FR029A, FR035A, FR043A, FR044A, FR045A, FR051A, FR054A, FR055A, FR058A, FR060A, FR062A, FR100A, FR102A, FR103A, FR224A, FR225A, FR228A, FR229A, FR231A, FR907A, FR917A, GB004A, GB005A, GB007A, GB008A, GB009A, GB013A, GB014A, GB015A, GB016A, GB017A, GB019A, GB021A, GB023A, GB025A, GB026A, GB028A, GB029A, GB035A, GB043A, GB044A, GB045A, GB051A, GB054A, GB055A, GB058A, GB060A, GB062A, GB100A, GB102A, GB103A, GB224A, GB225A, GB228A, GB229A, GB231A, GB907A, GB917A, GF004A, GF005A, GF007A, GF008A, GF009A, GF013A, GF014A, GF015A, GF016A, GF017A, GF019A, GF021A, GF023A, GF025A, GF026A, GF028A, GF029A, GF035A, GF043A, GF044A, GF045A, GF051A, GF054A, GF055A, GF058A, GF060A, GF062A, GF100A, GF102A, GF103A, GF224A, GF225A, GF228A, GF229A, GF231A, GF907A, GF917A, GP004A, GP005A, GP007A, GP008A, GP009A, GP013A, GP014A, GP015A, GP016A, GP017A, GP019A, GP021A, GP023A, GP025A, GP026A, GP028A, GP029A, GP035A, GP043A, GP044A, GP045A, GP051A, GP054A, GP055A, GP058A, GP060A, GP062A, GP100A, GP102A, GP103A, GP224A, GP225A, GP228A, GP229A, GP231A, GP907A, GP917A, GR004A, GR005A, GR007A, GR008A, GR009A, GR013A, GR014A, GR015A, GR016A, GR017A, GR019A, GR021A, GR023A, GR025A, GR026A, GR028A, GR029A, GR035A, GR043A, GR044A, GR045A, GR051A, GR054A, GR055A, GR058A, GR060A, GR062A, GR100A, GR102A, GR103A, GR224A, GR225A, GR228A, GR229A, GR231A, GR907A, GR917A, HU004A, HU005A, HU007A, HU008A, HU009A, HU013A, HU014A, HU015A, HU016A, HU017A, HU019A, HU021A, HU023A, HU025A, HU026A, HU028A, HU029A, HU035A, HU043A, HU044A, HU045A, HU051A, HU054A, HU055A, HU058A, HU060A, HU062A, HU100A, HU102A, HU103A, HU224A, HU225A, HU228A, HU229A, HU231A, HU907A, HU917A, IE004A, IE005A, IE007A, IE008A, IE009A, IE013A, IE014A, IE015A, IE016A, IE017A, IE019A, IE021A, IE023A, IE025A, IE026A, IE028A, IE029A, IE035A, IE043A, IE044A, IE045A, IE051A, IE054A, IE055A, IE058A, IE060A, IE062A, IE100A, IE102A, IE103A, IE224A, IE225A, IE228A, IE229A, IE231A, IE907A, IE917A, IT004A, IT005A, IT007A, IT008A, IT009A, IT013A, IT014A, IT015A, IT016A, IT017A, IT019A, IT021A, IT023A, IT025A, IT026A, IT028A, IT029A, IT035A, IT043A, IT044A, IT045A, IT051A, IT054A, IT055A, IT058A, IT060A, IT062A, IT100A, IT102A, IT103A, IT224A, IT225A, IT228A, IT229A, IT231A, IT907A, IT917A, LT004A, LT005A, LT007A, LT008A, LT009A, LT013A, LT014A, LT015A, LT016A, LT017A, LT019A, LT021A, LT023A, LT025A, LT026A, LT028A, LT029A, LT035A, LT043A, LT044A, LT045A, LT051A, LT054A, LT055A, LT058A, LT060A, LT062A, LT100A, LT102A, LT103A, LT224A, LT225A, LT228A, LT229A, LT231A, LT907A, LT917A, LU004A, LU005A, LU007A, LU008A, LU009A, LU013A, LU014A, LU015A, LU016A, LU017A, LU019A, LU021A, LU023A, LU025A, LU026A, LU028A, LU029A, LU035A, LU043A, LU044A, LU045A, LU051A, LU054A, LU055A, LU058A, LU060A, LU062A, LU100A, LU102A, LU103A, LU224A, LU225A, LU228A, LU229A, LU231A, LU907A, LU917A, LV004A, LV005A, LV007A, LV008A, LV009A, LV013A, LV014A, LV015A, LV016A, LV017A, LV019A, LV021A, LV023A, LV025A, LV026A, LV028A, LV029A, LV035A, LV043A, LV044A, LV045A, LV051A, LV054A, LV055A, LV058A, LV060A, LV062A, LV100A, LV102A, LV103A, LV224A, LV225A, LV228A, LV229A, LV231A, LV907A, LV917A, MC004A, MC005A, MC007A, MC008A, MC009A, MC013A, MC014A, MC015A, MC016A, MC017A, MC019A, MC021A, MC023A, MC025A, MC026A, MC028A, MC029A, MC035A, MC043A, MC044A, MC045A, MC051A, MC054A, MC055A, MC058A, MC060A, MC062A, MC100A, MC102A, MC103A, MC224A, MC225A, MC228A, MC229A, MC231A, MC907A, MC917A, MQ004A, MQ005A, MQ007A, MQ008A, MQ009A, MQ013A, MQ014A, MQ015A, MQ016A, MQ017A, MQ019A, MQ021A, MQ023A, MQ025A, MQ026A, MQ028A, MQ029A, MQ035A, MQ043A, MQ044A, MQ045A, MQ051A, MQ054A, MQ055A, MQ058A, MQ060A, MQ062A, MQ100A, MQ102A, MQ103A, MQ224A, MQ225A, MQ228A, MQ229A, MQ231A, MQ907A, MQ917A, MT004A, MT005A, MT007A, MT008A, MT009A, MT013A, MT014A, MT015A, MT016A, MT017A, MT019A, MT021A, MT023A, MT025A, MT026A, MT028A, MT029A, MT035A, MT043A, MT044A, MT045A, MT051A, MT054A, MT055A, MT058A, MT060A, MT062A, MT100A, MT102A, MT103A, MT224A, MT225A, MT228A, MT229A, MT231A, MT907A, MT917A, NL004A, NL005A, NL007A, NL008A, NL009A, NL013A, NL014A, NL015A, NL016A, NL017A, NL019A, NL021A, NL023A, NL025A, NL026A, NL028A, NL029A, NL035A, NL043A, NL044A, NL045A, NL051A, NL054A, NL055A, NL058A, NL060A, NL062A, NL100A, NL102A, NL103A, NL224A, NL225A, NL228A, NL229A, NL231A, NL907A, NL917A, PL004A, PL005A, PL007A, PL008A, PL009A, PL013A, PL014A, PL015A, PL016A, PL017A, PL019A, PL021A, PL023A, PL025A, PL026A, PL028A, PL029A, PL035A, PL043A, PL044A, PL045A, PL051A, PL054A, PL055A, PL058A, PL060A, PL062A, PL100A, PL102A, PL103A, PL224A, PL225A, PL228A, PL229A, PL231A, PL907A, PL917A, PT004A, PT005A, PT007A, PT008A, PT009A, PT013A, PT014A, PT015A, PT016A, PT017A, PT019A, PT021A, PT023A, PT025A, PT026A, PT028A, PT029A, PT035A, PT043A, PT044A, PT045A, PT051A, PT054A, PT055A, PT058A, PT060A, PT062A, PT100A, PT102A, PT103A, PT224A, PT225A, PT228A, PT229A, PT231A, PT907A, PT917A, RE004A, RE005A, RE007A, RE008A, RE009A, RE013A, RE014A, RE015A, RE016A, RE017A, RE019A, RE021A, RE023A, RE025A, RE026A, RE028A, RE029A, RE035A, RE043A, RE044A, RE045A, RE051A, RE054A, RE055A, RE058A, RE060A, RE062A, RE100A, RE102A, RE103A, RE224A, RE225A, RE228A, RE229A, RE231A, RE907A, RE917A, SE004A, SE005A, SE007A, SE008A, SE009A, SE013A, SE014A, SE015A, SE016A, SE017A, SE019A, SE021A, SE023A, SE025A, SE026A, SE028A, SE029A, SE035A, SE043A, SE044A, SE045A, SE051A, SE054A, SE055A, SE058A, SE060A, SE062A, SE100A, SE102A, SE103A, SE224A, SE225A, SE228A, SE229A, SE231A, SE907A, SE917A, SI004A, SI005A, SI007A, SI008A, SI009A, SI013A, SI014A, SI015A, SI016A, SI017A, SI019A, SI021A, SI023A, SI025A, SI026A, SI028A, SI029A, SI035A, SI043A, SI044A, SI045A, SI051A, SI054A, SI055A, SI058A, SI060A, SI062A, SI100A, SI102A, SI103A, SI224A, SI225A, SI228A, SI229A, SI231A, SI907A, SI917A, SK004A, SK005A, SK007A, SK008A, SK009A, SK013A, SK014A, SK015A, SK016A, SK017A, SK019A, SK021A, SK023A, SK025A, SK026A, SK028A, SK029A, SK035A, SK043A, SK044A, SK045A, SK051A, SK054A, SK055A, SK058A, SK060A, SK062A, SK100A, SK102A, SK103A, SK224A, SK225A, SK228A, SK229A, SK231A, SK907A, SK917A, CH004A, CH005A, CH007A, CH008A, CH009A, CH013A, CH014A, CH015A, CH016A, CH017A, CH019A, CH021A, CH023A, CH025A, CH026A, CH028A, CH029A, CH035A, CH043A, CH044A, CH045A, CH051A, CH054A, CH055A, CH058A, CH060A, CH062A, CH100A, CH102A, CH103A, CH224A, CH225A, CH228A, CH229A, CH231A, CH907A, CH917A, IS004A, IS005A, IS007A, IS008A, IS009A, IS013A, IS014A, IS015A, IS016A, IS017A, IS019A, IS021A, IS023A, IS025A, IS026A, IS028A, IS029A, IS035A, IS043A, IS044A, IS045A, IS051A, IS054A, IS055A, IS058A, IS060A, IS062A, IS100A, IS102A, IS103A, IS224A, IS225A, IS228A, IS229A, IS231A, IS907A, IS917A, NO004A, NO005A, NO007A, NO008A, NO009A, NO013A, NO014A, NO015A, NO016A, NO017A, NO019A, NO021A, NO023A, NO025A, NO026A, NO028A, NO029A, NO035A, NO043A, NO044A, NO045A, NO051A, NO054A, NO055A, NO058A, NO060A, NO062A, NO100A, NO102A, NO103A, NO224A, NO225A, NO228A, NO229A, NO231A, NO907A, NO917A, SJ004A, SJ005A, SJ007A, SJ008A, SJ009A, SJ013A, SJ014A, SJ015A, SJ016A, SJ017A, SJ019A, SJ021A, SJ023A, SJ025A, SJ026A, SJ028A, SJ029A, SJ035A, SJ043A, SJ044A, SJ045A, SJ051A, SJ054A, SJ055A, SJ058A, SJ060A, SJ062A, SJ100A, SJ102A, SJ103A, SJ224A, SJ225A, SJ228A, SJ229A, SJ231A, SJ907A, SJ917A]     
              [Element /CD026A/ComAccRefMES21     MinOccurs = 0, MaxOccurs = 1] of type [string][MaxLength = 35]     
              [Element /CD026A/MesSeqNumMES22     MinOccurs = 0, MaxOccurs = 1] of type [nonNegativeInteger][TotalDigits = 2]     
              [Element /CD026A/FirAndLasTraMES23     MinOccurs = 0, MaxOccurs = 1] of type [string][Values = F, L]     
         [End of sequence]
         [Element /CD026A/TRAPRIPC1     MinOccurs = 1, MaxOccurs = 1] of type [anyType]
         [Start of sequence  MinOccurs = 1, MaxOccurs = 1]
              [Element /CD026A/TRAPRIPC1/TINPC159     MinOccurs = 1, MaxOccurs = 1] of type [string][MaxLength = 17]     
         [End of sequence]
         [Element /CD026A/CUSTOFFGUARNT     MinOccurs = 1, MaxOccurs = 1] of type [anyType]
         [Start of sequence  MinOccurs = 1, MaxOccurs = 1]
              [Element /CD026A/CUSTOFFGUARNT/RefNumRNT1     MinOccurs = 1, MaxOccurs = 1] of type [string][Length = 8]     
         [End of sequence]
         [Element /CD026A/GUAREF2     MinOccurs = 1, MaxOccurs = 1] of type [anyType]
         [Start of sequence  MinOccurs = 1, MaxOccurs = 1]
              [Element /CD026A/GUAREF2/GuaRefNumGRNREF21     MinOccurs = 1, MaxOccurs = 1] of type [string][MaxLength = 24]     
              [Element /CD026A/GUAREF2/ACCDOC728     MinOccurs = 0, MaxOccurs = 99] of type [anyType]
              [Start of sequence  MinOccurs = 1, MaxOccurs = 1]
                   [Element /CD026A/GUAREF2/ACCDOC728/AccCodCOD729     MinOccurs = 1, MaxOccurs = 1] of type [string][Length = 4]     
              [End of sequence]
              [Element /CD026A/GUAREF2/ACCDOCPC4     MinOccurs = 1, MaxOccurs = 1] of type [anyType]
              [Start of sequence  MinOccurs = 1, MaxOccurs = 1]
                   [Element /CD026A/GUAREF2/ACCDOCPC4/AccCodPC41     MinOccurs = 1, MaxOccurs = 1] of type [string][Length = 4]     
              [End of sequence]
              [Element /CD026A/GUAREF2/ACCCODPC3     MinOccurs = 1, MaxOccurs = 1] of type [anyType]
              [Start of sequence  MinOccurs = 1, MaxOccurs = 1]
                   [Element /CD026A/GUAREF2/ACCCODPC3/AccCodPC31     MinOccurs = 1, MaxOccurs = 1] of type [string][Length = 4]     
              [End of sequence]
         [End of sequence]
    [End of sequence]I still thing this is a bit of an overkill, but I will use it as a last resort in order to substitute the built-in parser so I can collect all the errors of an XML source in one go.
    Is there a way to obtain the same information from the XDB registry where my schemas will reside ? If yes, I will gladly substitute this Java class with whatever your suggestion is :)
    If not, I intend to store the extracted information in suitably constructed database tables and use a PL/SQL procedure to do the validation by traversing the table information accordingly (XPath by XPath) collecting the errors as I traverse the XML. Hopefully, due to the XPaths being very targeted towards the information that will be checked, I will avoid the DOM memory tree overhead.
    Finally, if I follow the path I described, is there a way to put some sort of trigger for the cases of copyEvolve(), inPlaceEvolve() and drop-and-reinsert so that my process will be called again for the new data ?
    Apologies for the lengthy code and result set.
    Best Regards
    Philip
    PS: I did not include the XSD file itself because it includes another four XSDs. If needed I will do it in a reply post though ...

    Good morning Marco,
    I am back at the office today, so I am trying to catch up with everything.
    If I remember though, RESOURCE_VIEW and PATH_VIEW are related to the "exploration" of the XDB registry (but I may very well be wrong !).
    What I want is to retrieve schema information (if XDB actually shreds the XML schema on registration) like elements paths, simple and complex type contents, sequence information, particle occurence information, groups and group declarations etc.
    I think it makes sense that Oracle stores these somewhere, since it uses the information on OR storage to generate types and tables anyway ;) That is of course if the whole OR shredding is not done totally on-the-fly...
    I managed to get clearance to release partial information about some of the schemas and their related documentation, so I will be passing them to you and Mark through private emails (of course) in order to give you a clearer understanding of the whole project.
    Just give me a day to write a few pages that explain how the whole operation is performed.
    Best Regards
    Philip

  • Importing table data from one schema to another schema

    Hi All,
    I exported tablerows only of Schema A, and same I am trying to imported in Schema B.
    While importing I am getting oracle error "row rejected, Integrity constraint violated
    parent key not found".
    What I did is I disabled all the constraints through script in Schema B, and imported data. Data imported successfully, but while executing the enabling the constraints script in Schema B constraints are not enabled due to parent and chile relationship problems, even I executed this script many times.
    Note:- Schema A and Schema B are same structure, Schema A contains data but
    Schema B does not
    Can any body have any idea on this?
    Thanks,

    Hi,
    But I want data to be completely imported without losing.
    I am trying to disable the constraints using the following queries for enabling and
    disabling
    select 'ALTER TABLE '||A.TABLE_NAME||' DISABLE CONSTRAINT '||B.CONSTRAINT_NAME||';'
    FROM user_constraints A, USER_CONSTRAINTS B
    WHERE A.TABLE_NAME = B.TABLE_NAME
    AND A.CONSTRAINT_TYPE = 'P'
    Foreign constraints  -
    select 'ALTER TABLE '||A.TABLE_NAME||' DISABLE CONSTRAINT '||B.CONSTRAINT_NAME||';'
    FROM user_constraints A, USER_CONSTRAINTS B
    WHERE A.TABLE_NAME = B.TABLE_NAME
    AND A.CONSTRAINT_TYPE = 'R'
    -- Check constraints ---
    select 'ALTER TABLE '||A.TABLE_NAME||' DISABLE CONSTRAINT '||B.CONSTRAINT_NAME||';'
    FROM user_constraints A, USER_CONSTRAINTS B
    WHERE A.TABLE_NAME = B.TABLE_NAME
    AND A.CONSTRAINT_TYPE = 'C'

  • Schema TM04

    Hi All,
       I have question regarding TM04 Schema . as i knew that it is used for Negative time evaluation by considering deveation which is entered in the infotype  2001, 2002. that is fine. if my customer wants set up time recording terminal for clock in and clock out. how do i process these entries in TM04. i heard that TM04 can also be used for Positive time evaluation.
    Let me clear you more on this. we are using negive time evaluation using TM04. is it possible to read time recording termainal information(clock in/out) in this schema. if its possible. how IT 2002(attendance)infotype get updated.
    Please clarifiy me on this.
    Thanks,
    Ashok.

    Below is the information you are looking for (from help.sap.com)
    Schema TM04 is a standard schema used to evaluate employee time data that is recorded as a number of hours and not using clock times.Structure
    Schema TM04 is based on the following requirements and objectives:
    Schema TM04 forms time balances, time wage types and time quotas. It is processed using the time evaluation report RPTIME00.
    The schema imports and processes time data that has been entered online. Employee working time is recorded in the Attendances infotype (2002).
    You can record only exceptions to the work schedule, or all times to be included in the working time (actual times).
    Clock times are not required for evaluation of time data. Attendance/absence times must be entered as hours and not as clock-in/out times, and only these hours are evaluated in pair formation. The times specified in the daily work schedule are insignificant. Only entries in hours such as planned working hours or minimum daily working timeare evaluated. Checks are not performed against the maximum daily working time specified in the daily work schedule when planned working time and overtime are calculated.
    When exceptions to the work schedule are entered, the planned working hours are generated according to the daily work schedule. Recorded absences and certain attendance times are deducted.
    All recorded times are seen as working time when overtime is calculated. The following overtime rules apply:
    Overtime begins after x number of hours per day
    Overtime begins after y number of hours per week
    Overtime begins after z number of consecutive workdays.
    In schema TM04, you can store rules which refer to the payroll period. These payroll periods can be different for different employees, and do not have to correspond to the time evaluation period.

  • Manually Migrating from Oracle 10g to 11g

    Hello, I'm currently a student in an Oracle DBA class. I'm totally new to the Oracle world.
    One of our final assignments concerns upgrading Oracle instances without the use of DBUA.
    I've currently got Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 and am trying to upgrade to 11.1.0.7.0
    This is all inside of VirtualBox, running Windows Server 2008. I've been using 10g with absolutely no issues for the duration of this class.
    I successfully installed 11g, choosing to install the software only and not use dbua.
    I changed my environment variables to point towards the 10g installation; ORACLE_HOME, ORACLE_SID, PATH, and LD_LIBRARY_PATH.
    Then logged into 10g's SQLPlus and ran utlu111i.sql, which ran successfully. I issued a shutdown immediate and exited SQLPlus.
    Changed my environment variables to point towards the 11g home and set ORACLE_SID as the 10g database name. I was able to log into 11g's SQL plus, was told I was connected to an idle instance, which I expected. I issued a startup upgrade command, and then attempted to run catupgrd.sql, but got an error stating that I had to run the script from 11g.
    If I don't set the environment variables then when I try to log into 11g's sqlplus, I get an ORA-12560: TNS:protocol adapter error... I've tried reinstalling 11g from scratch, but to no avail. My instructor and I have been emailing back and forth frequently over the past few days but we have not been able to reach a solution, so I thought I would see if I could pick your brains.
    Here's all of the terminal output from the process:
    C:\Users\Administrator>sqlplus
    SQL*Plus: Release 10.2.0.3.0 - Production on Fri Apr 29 20:15:09 2011
    Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
    Enter user-name: connect /as sysdba
    Enter password:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> @?
    SP2-0310: unable to open file "C:\270Oracle.sql"
    SQL> @C:\NewCIS270\product\11.1.0\db_1\rdbms\admin\utlu111i
    Oracle Database 11.1 Pre-Upgrade Information Tool 04-29-2011 20:16:16
    Database:
    --> name: KYLMAN
    --> version: 10.2.0.3.0
    --> compatible: 10.2.0.3.0
    --> blocksize: 8192
    --> platform: Microsoft Windows IA (32-bit)
    --> timezone file: V4
    Tablespaces: [make adjustments in the current environment]
    --> SYSTEM tablespace is adequate for the upgrade.
    .... minimum required size: 729 MB
    .... AUTOEXTEND additional space required: 249 MB
    --> UNDOTBS1 tablespace is adequate for the upgrade.
    .... minimum required size: 417 MB
    .... AUTOEXTEND additional space required: 352 MB
    --> SYSAUX tablespace is adequate for the upgrade.
    .... minimum required size: 455 MB
    .... AUTOEXTEND additional space required: 215 MB
    --> TEMP tablespace is adequate for the upgrade.
    .... minimum required size: 61 MB
    .... AUTOEXTEND additional space required: 33 MB
    --> EXAMPLE tablespace is adequate for the upgrade.
    .... minimum required size: 78 MB
    Update Parameters: [Update Oracle Database 11.1 init.ora or spfile]
    -- No update parameter changes are required.
    Renamed Parameters: [Update Oracle Database 11.1 init.ora or spfile]
    -- No renamed parameters found. No changes are required.
    Obsolete/Deprecated Parameters: [Update Oracle Database 11.1 init.ora or spfile]
    --> "background_dump_dest" replaced by "diagnostic_dest"
    --> "user_dump_dest" replaced by "diagnostic_dest"
    --> "core_dump_dest" replaced by "diagnostic_dest"
    Components: [The following database components will be upgraded or installed]
    --> Oracle Catalog Views [upgrade] VALID
    --> Oracle Packages and Types [upgrade] VALID
    --> JServer JAVA Virtual Machine [upgrade] VALID
    --> Oracle XDK for Java [upgrade] VALID
    --> Oracle Workspace Manager [upgrade] VALID
    --> OLAP Analytic Workspace [upgrade] VALID
    --> OLAP Catalog [upgrade] VALID
    --> EM Repository [upgrade] VALID
    --> Oracle Text [upgrade] VALID
    --> Oracle XML Database [upgrade] VALID
    --> Oracle Java Packages [upgrade] VALID
    --> Oracle interMedia [upgrade] VALID
    --> Spatial [upgrade] VALID
    --> Data Mining [upgrade] VALID
    --> Expression Filter [upgrade] VALID
    --> Rule Manager [upgrade] VALID
    --> Oracle OLAP API [upgrade] VALID
    Miscellaneous Warnings
    WARNING: --> Database contains stale optimizer statistics.
    .... Refer to the 11g Upgrade Guide for instructions to update
    .... statistics prior to upgrading the database.
    .... Component Schemas with stale statistics:
    .... SYS
    .... OLAPSYS
    .... SYSMAN
    .... CTXSYS
    .... XDB
    WARNING: --> Database contains schemas with objects dependent on network
    packages.
    .... Refer to the 11g Upgrade Guide for instructions to configure Network ACLs.
    WARNING: --> EM Database Control Repository exists in the database.
    .... Direct downgrade of EM Database Control is not supported. Refer to the
    .... 11g Upgrade Guide for instructions to save the EM data prior to upgrade.
    PL/SQL procedure successfully completed.
    SQL> shutdown immediate;
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL> exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Pr
    oduction
    With the Partitioning, OLAP and Data Mining options
    C:\Users\Administrator>set ORACLE_HOME=C:\NewCIS270\product\11.1.0\db_1
    C:\Users\Administrator>set ORACLE_SID=KYLMAN
    C:\Users\Administrator>set PATH=%ORACLE_HOME%\bin
    C:\Users\Administrator>sqlplus "/as sysdba"
    SQL*Plus: Release 11.1.0.7.0 - Production on Fri Apr 29 20:22:49 2011
    Copyright (c) 1982, 2008, Oracle. All rights reserved.
    Connected to an idle instance.
    SQL> startup upgrade;
    ORACLE instance started.
    Total System Global Area 440401920 bytes
    Fixed Size 1291072 bytes
    Variable Size 146803904 bytes
    Database Buffers 289406976 bytes
    Redo Buffers 2899968 bytes
    Database mounted.
    Database opened.
    SQL> @?
    SP2-0310: unable to open file "C:\NewCIS270\product\11.1.0\db_1.sql"
    SQL> @?/rdbms/admin/catupgrd
    DOC>#######################################################################
    DOC>#######################################################################
    DOC>
    DOC> The first time this script is run, there should be no error messages
    DOC> generated; all normal upgrade error messages are suppressed.
    DOC>
    DOC> If this script is being re-run after correcting some problem, then
    DOC> expect the following error which is not automatically suppressed:
    DOC>
    DOC> ORA-00001: unique constraint (<constraint_name>) violated
    DOC> possibly in conjunction with
    DOC> ORA-06512: at "<procedure/function name>", line NN
    DOC>
    DOC> These errors will automatically be suppressed by the Database Upgrade
    DOC> Assistant (DBUA) when it re-runs an upgrade.
    DOC>
    DOC>#######################################################################
    DOC>#######################################################################
    DOC>#
    DOC>######################################################################
    DOC>######################################################################
    DOC> The following statement will cause an "ORA-01722: invalid number"
    DOC> error if the user running this script is not SYS. Disconnect
    DOC> and reconnect with AS SYSDBA.
    DOC>######################################################################
    DOC>######################################################################
    DOC>#
    no rows selected
    DOC>######################################################################
    DOC>######################################################################
    DOC> The following statement will cause an "ORA-01722: invalid number"
    DOC> error if the database server version is not correct for this script.
    DOC> Shutdown ABORT and use a different script or a different server.
    DOC>######################################################################
    DOC>######################################################################
    DOC>#
    SELECT TO_NUMBER('MUST_BE_11_1') FROM v$instance
    ERROR at line 1:
    ORA-01722: invalid number
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Pr
    oduction
    With the Partitioning, OLAP and Data Mining options
    C:\Users\Administrator>
    Edited by: 855732 on Apr 29, 2011 6:59 PM

    Hi,
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Pr
    oduction
    With the Partitioning, OLAP and Data Mining options
    Your instance is started from the 10g ORACLE_HOME. You mentioned you started it from the 11g ORACLE_HOME but it's not the case.
    Here is an example with a 10gR2 database started from a 11gR2 ORACLE_HOME :
    SQL> startup upgrade pfile =/u01/app/oracle/product/10.2.0/db_1/dbs/initP102.ora
    ORA-32006: BACKGROUND_DUMP_DEST initialization parameter has been deprecated
    ORA-32006: USER_DUMP_DEST initialization parameter has been deprecated
    ORACLE instance started.
    Total System Global Area  167387136 bytes
    Fixed Size                  1335248 bytes
    Variable Size              88080432 bytes
    Database Buffers           75497472 bytes
    Redo Buffers                2473984 bytes
    Database mounted.
    Database opened.
    SQL> exit
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing optionsNotice the Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 part.
    In your case it was Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0
    To solve the issue follow the official documentation, you have specific actions with oradim etc. to do (it's always a bit more complicated than with Unix/Linux but it's documented) :
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28300/upgrade.htm#insertedID8
    Best regards
    Phil

  • UPgrade from 10g to 11g

    Dear All,
    I am using 10.2.0.1 database and planning to upgrade to 11.1.0.6 and while executing the utlu102i.sql I found the database is using the old timezone.
    SQL> select * from v$timezone_file;
    FILENAME VERSION
    timezlrg.dat 2
    The issue is there is no patch available for the timezone upgrade for the windows platform in metalink.
    Questions?
    1. How can I upgrade the Time zone version before upgrading the database to 11g, if there is no patch available.
    2. It is mandatory to upgrade the timezone or 11g will automatically upgrade it.
    3. If I will go for the database upgrade without updating the timezone, will update fail.
    4. Do I have to upgrade the timezone to the current database (10.2.0.1) and then install the 11g binaries and start the upgrade or install the 11g binary first and apply the patch on 11g and then start the database upgrade.
    Below is the some part of the output of utlu102i.sql
    Miscellaneous Warnings
    WARNING: --> Database is using an old timezone file version.
    .... Patch the 10.2.0.1.0 database to timezone file version 4
    .... BEFORE upgrading the database. Re-run utlu111i.sql after
    .... patching the database to record the new timezone file version.
    WARNING: --> Database contains stale optimizer statistics.
    .... Refer to the 11g Upgrade Guide for instructions to update
    .... statistics prior to upgrading the database.
    .... Component Schemas with stale statistics:
    .... SYS
    .... OLAPSYS
    .... SYSMAN
    .... CTXSYS
    .... XDB
    WARNING: --> Database contains schemas with objects dependent on network
    packages.
    .... Refer to the 11g Upgrade Guide for instructions to configure Network ACLs.
    .... USER SYSMAN has dependent objects.
    WARNING: --> EM Database Control Repository exists in the database.
    .... Direct downgrade of EM Database Control is not supported. Refer to the
    .... 11g Upgrade Guide for instructions to save the EM data prior to upgrade.
    Eagarly waiting for your response.
    Thanks in advance.

    1. How can I upgrade the Time zone version before upgrading the database to 11g, if there is no patch available.
    See Metalink Document How To Apply The V4 DST Patches To Windows Clients or Servers [ID 417893.1], this should help you here.
    2. It is mandatory to upgrade the timezone or 11g will automatically upgrade it.
    You will need to update the Timezone to V4 prior to attempting an upgrade
    3. If I will go for the database upgrade without updating the timezone, will update fail.
    Yes that upgrade will not work without first updating the timezone for the 10.2.0.1 database you have
    4. Do I have to upgrade the timezone to the current database (10.2.0.1) and then install the 11g binaries and start the upgrade or install the 11g binary first and apply the patch on 11g and then start the database upgrade.
    The binary installations can be handled separately, however no upgrade operations can happen until the DST v4 is taken care of for the upgrade.
    Edited by: mrmessin on Dec 31, 2009 1:41 AM

  • Is it possible to create a form that allows users to import data from an excel spreadsheet

    I have not been able to start my reading on scripting or other livecycle features to be able to try to figure this out but I was wondering if anyone else had ever created a form with this feature or had any ideas of how it would be possible.  Our company currently uses and excel form that would have a variable number of rows of data for each time it is filled out and we would be replacing it with an adobe form.  I would like to know if the users, who will be using the new adobe form in adobe reader, could have the capability to imort the lines from the previous excel form into the new adobe version.

    Hi,
    You can set up a data connection with an Excel spreadsheet. However for the data connection to work for users with Reader, you would need to Reader Enable the form with the LiveCycle Reader Extensions ES2.5 (server component). See here for summary: http://assure.ly/etkFNU.
    However if you are just trying to get the existing data into the form, you should have a look at some of Stefan Cameron's posts: http://forms.stefcameron.com/ (try a search). You can start a new form using the wizzard and select import from Excel. This will allow you to paste from your spreadsheet to a new form. This should help set up the data structure/schema, which you can then replicate in a new form. I haven't done this before, but it should be possible.
    Hope that helps,
    Niall

  • XML in the database

    Having just attended a session on Oracle/XML at OpenWorld... it
    is still not clear where or when Oracle will provide a suitable
    solution for the storage and retreival of XML documents with
    highly-flexible schemas.
    As I understand it, the existing solutions (8.1.5) (with
    performance as an imporant consideration) are:
    - Use Intermedia with section searching/indexing. This is not
    suitable for applications with highly-flexible schemas. From my
    understanding of Intermedia, indexing for section searching
    requires explicit section definitions -- an expensive operation
    for large databases. This would be similar to creating a new
    index on a table for each new element the user desires to search
    on.
    - Map to a structured schema. While this is effective for
    applications with very static schemas or leveraging existing
    database schemas, with a highly-flexible document schema this
    implies either a) creating new "shadow" tables for each distinct
    schema or b) altering the table with each addition of a new
    document element.
    I am very eager to see what Oracle has to offer in this area. I
    can find no technical documentation discussion any soon-to-come
    approaches. I have heard mention at OpenWorld of expansions to
    Intermedia to support name-value pair searching, etc., but still
    no in-depth explanations.
    Can anyone here shed any light on this?
    null

    Craig Willis (guest) wrote:
    : Having just attended a session on Oracle/XML at OpenWorld...
    it
    : is still not clear where or when Oracle will provide a
    suitable
    : solution for the storage and retreival of XML documents with
    : highly-flexible schemas.
    : As I understand it, the existing solutions (8.1.5) (with
    : performance as an imporant consideration) are:
    : - Use Intermedia with section searching/indexing. This is not
    : suitable for applications with highly-flexible schemas. From
    my
    : understanding of Intermedia, indexing for section searching
    : requires explicit section definitions -- an expensive
    operation
    : for large databases. This would be similar to creating a new
    : index on a table for each new element the user desires to
    search
    : on.
    : - Map to a structured schema. While this is effective for
    : applications with very static schemas or leveraging existing
    : database schemas, with a highly-flexible document schema this
    : implies either a) creating new "shadow" tables for each
    distinct
    : schema or b) altering the table with each addition of a new
    : document element.
    : I am very eager to see what Oracle has to offer in this area.
    I
    : can find no technical documentation discussion any soon-to-
    come
    : approaches. I have heard mention at OpenWorld of expansions
    to
    : Intermedia to support name-value pair searching, etc., but
    still
    : no in-depth explanations.
    : Can anyone here shed any light on this?
    If you are looking for a document-centric solution, you should
    check out the Oracle Internet File System (iFS) which supports
    XML. They have a demo at the Oracle campground.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    null

  • Oracle 9i query processing

    Oracle 9.2.0.4.0
    Hi,
    Does oracle9i employ "Lazy Evaluation" in query processing?
    Thanks
    JN

    Lazy Evaluation applies in a number of cases, as does XPATH re-write. Both require structured (Schema based) XML documents. Can you provide more details about the queries you are interested in.

  • File Info XAP XMP XML

    I'm not having any luck trying to figure out how to store some XML data into an AI file using the SDK. I was wondering if anyone had any suggestions on how to accomplish what I am trying to do:<br /><br />My plugin is notified when the file is being saved.<br /><br />At this point, I extract some information, and want it to be stored with the file when it's saved, so it can be extracted later.<br /><br />If you open the AI file in a text editor, you will see that there is a readable XML packet (<x:xmpmeta>) near the top of the file.<br /><br />Using AIXMLDocumentSuite and AIXMLNodeSuite I'm able to save some nodes to the file, however, that information does -not- get stored in the human readable <x:xmpmeta> text packet at the top of the file. This is not good enough for my purposes.<br /><br />I tried using:<br /><br />AIDocumentSuite::GetDocumentXAP<br />Which seems to return exactly the information I'm referring to in the file.. Make modifications, then:<br />AIDocumentSuite::SetDocumentXAP<br /><br />My changes are not saved into the file. I suspect that maybe I write the data with Set, and then immediately afterward, as Illustrator finishes the saving process, it's overwritten.<br /><br />I need to insert my data into the AI structure somehow, so that it is written when the file is saved...<br /><br />This information is available through illustrator if you choose the menu options "File -> File Info" then click on "Advanced" in the list on the left.<br /><br />Does anyone know how I can properly manipulate this "File Info" data? and store custom information? There are no XML related examples in the Illustrator SDK, and very little documentation on how it is supposed to be used.<br /><br />Thanks in advance.

    Ok, I've made some progress on this issue, that being I finally forced my way to getting my data saved into the file.<br /><br />I talked about this a bit in another thread, but I'll reiterate here, hoping that someone else searching for solutions to this problem can know where to start.<br /><br />I did exactly as I suggested above:<br /><br />AIDocumentSuite::GetDocumentXAP<br /><br />Make modifications, then:<br /><br />AIDocumentSuite::SetDocumentXAP <br /><br />It was not easy to avoid the phenomenon I described above however.<br /><br />The modifications you make must comply with some undocumented rules; because if you pass some text in that does not pass the rule, all of your changes are discarded; replaced by whatever was there originally.<br /><br />There is no error reported. There should be an error when calling SetDocumentXAP if you pass in 'invalid' data, or at the very least, the valid data structure (schema) should be defined in the documentation (it's not).<br /><br />What I did was put all of my additions inside a <rdf:Description> tag and put it right after the other ones already in there.<br /><br />Sample:<br /><br />     <rdf:Description rdf:about=""<br />            xmlns:my_tagname="http://www.mycompany.com/1.0/"><br />         <my_tagname:my_metadata rdf:parseType="Resource"><br />            <my_tagname:my_parameter>value</my_tagname:my_parameter><br />            <my_tagname:my_data_1><br />               <rdf:Bag><br />                 <rdf:lirdf:parseType="Resource">                     <br /><my_tagname:my_parameter_2>Value</my_tagname:my_parameter_2><br />                     <my_tagname:my_parameter_3>Value</my_tagname:my_parameter_3><br />                     <my_tagname:my_parameter_4><br />                        <rdf:Seq>                        <br />                        <rdf:li>some data</rdf:li><br />                        <rdf:li>some data</rdf:li><br />                        </rdf:Seq><br />                     </my_tagname:my_parameter_4><br />                  </rdf:li><br />               </rdf:Bag><br />            </my_tagname:my_data_1><br />         </my_tagname:my_metadata><br />      </rdf:Description><br /><br />I hope this helps someone else. (Excuse the bad formatting in this forum post)

  • User defined xquery function with index enabled

    If I use user defined xquery function, can the index be applied within the function?
    trados.xsd
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by () -->
    <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:tns="http://ecoit.hp.com/ecg/repository/trados" targetNamespace="http://ecoit.hp.com/ecg/repository/trados" elementFormDefault="qualified">
         <complexType name="entry">
              <sequence>
                   <element name="base" type="string"/>
                   <element name="translation" maxOccurs="unbounded">
                        <complexType>
                             <simpleContent>
                                  <extension base="string">
                                       <attribute name="lang"/>
                                  </extension>
                             </simpleContent>
                        </complexType>
                   </element>
              </sequence>
              <attribute name="xpath" type="string" use="required" xdb:SQLName="XPATH"/>
              <attribute name="locator" type="string" use="required"/>
         </complexType>
         <simpleType name="languages">
              <list itemType="string"/>
         </simpleType>
         <element name="trados" xdb:defaultTable="ECG_REP_TRADOS_TAB" xdb:tableProps="VARRAY XMLDATA.ENTRY STORE AS TABLE ECG_REP_TRADOS_ENTRY_TAB ((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$)) ORGANIZATION INDEX OVERFLOW)">
              <complexType>
                   <sequence>
                        <element name="entry" type="tns:entry" minOccurs="0" maxOccurs="unbounded" xdb:SQLName="ENTRY"/>
                   </sequence>
                   <attribute name="cid" type="string"/>
                   <attribute name="path" type="string"/>
                   <attribute name="lang" type="string"/>
                   <attribute name="langs" type="tns:languages"/>
                   <attribute name="oldversion" type="string"/>
              </complexType>
         </element>
    </schema>
    CREATE INDEX ECG_REP_ENTRY_XPATH_IDX ON ECG_REP_TRADOS_ENTRY_TAB ("XPATH", "NESTED_TABLE_ID")
    eco_category.xsd
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- edited with XMLSpy v2008 (http://www.altova.com) by Jan-Erik Pedersen (HEWLETT PACKARD) -->
    <!--W3C Schema generated by XMLSpy v2007 (http://www.altova.com) by Scott Dismukes (Hewlett Packard)-->
    <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:tns="http://ecoit.hp.com/ecg/repository/eco/category" xmlns:cns="http://ecoit.hp.com/ecg/repository/types" targetNamespace="http://ecoit.hp.com/ecg/repository/eco/category" elementFormDefault="qualified">
         <import namespace="http://ecoit.hp.com/ecg/repository/types" schemaLocation="../types.xsd"/>
         <complexType name="productFamilies">
              <sequence>
                   <element name="productFamily" type="tns:productFamily" minOccurs="0" maxOccurs="unbounded"/>
                   <element name="product" type="tns:product" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
              <attribute name="lang" use="required" xdb:SQLName="LANG">
                   <simpleType>
                        <restriction base="string">
                             <length value="5"/>
                        </restriction>
                   </simpleType>
              </attribute>
              <attribute name="version" use="required" xdb:SQLName="VERSION">
                   <simpleType>
                        <restriction base="string">
                             <maxLength value="100"/>
                        </restriction>
                   </simpleType>
              </attribute>
         </complexType>
         <complexType name="productCategory">
              <sequence>
                   <element name="label" type="cns:label"/>
                   <element name="productCategory" type="tns:productCategory" minOccurs="0" maxOccurs="unbounded" xdb:defaultTable="ECG_REP_ECO_CATALOG_PC_TAB"/>
                   <element name="product" type="tns:product" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
              <attribute name="id" type="cns:id" use="required"/>
         </complexType>
         <complexType name="productCategories">
              <sequence>
                   <element name="productCategory" type="tns:productCategory" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
         </complexType>
         <complexType name="column">
              <sequence>
                   <element name="label" type="cns:label"/>
              </sequence>
              <attribute name="id" type="cns:id" use="required"/>
         </complexType>
         <complexType name="product">
              <sequence>
                   <element name="label" type="cns:label"/>
                   <element name="column" type="tns:column" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
              <attribute name="id" type="cns:id" use="required"/>
         </complexType>
         <complexType name="productFamily">
              <sequence>
                   <element name="label" type="cns:label"/>
                   <element name="image" type="cns:image" minOccurs="0" maxOccurs="unbounded"/>
                   <element name="link" type="cns:link" minOccurs="0" maxOccurs="unbounded"/>
                   <element name="column" type="tns:column" minOccurs="0" maxOccurs="unbounded"/>
                   <element name="productCategories" type="tns:productCategories" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
              <attribute name="id" type="cns:id" use="required"/>
         </complexType>
         <element name="productFamilies" type="tns:productFamilies" xdb:defaultTable="ECG_REP_ECO_CATALOG_TAB"/>
    </schema>
    xquery
    xquery version "1.0";
    declare namespace typ = "http://ecoit.hp.com/ecg/repository/types";
    declare namespace c = "http://ecoit.hp.com/ecg/repository/eco/category";
    declare namespace t = "http://ecoit.hp.com/ecg/repository/trados";
    declare variable $c := $res/c:productFamilies;
    declare function local:pc($pc as element(c:productCategory), $x as xs:string) as element()
         <c:productCategory id="{$pc/@id}">
              <c:label>{data($es/t:entry[@xpath eq concat($x, "/label")]/t:translation)}</c:label>
              for $p in $pc/c:product
              return local:p($p, concat($x, "/product/[@id=", $p/@id, "]"))
              for $pcc in $pc/c:productCategory
              return local:pc($pcc, concat($x, "/productCategory[@id=", $pcc/@id, "]"))
         </c:productCategory>
    declare function local:p($p as element(c:product), $x as xs:string) as element()
         <c:product id="{$p/@id}">
              <c:label>{string($es/t:entry[@xpath eq concat($x, "/label")]/t:translation)}</c:label>
              for $col in $p/c:column
              return
              <c:column id="{$col/@id}">
                   <c:label>
                        let $e := $es/t:entry[@xpath eq concat($x, "/column[@id=", $col/@id, "]/label")]
                        return
                        if(exists($e)) then string($e/t:translation)
                        else $col/c:label/text()
                   </c:label>
              </c:column>
         </c:product>
    <c:productFamiles xsi:schemaLocation="http://ecoit.hp.com/ecg/repository/eco/category http://ecoit.hp.com/ecg/repository/eco/category.xsd http://ecoit.hp.com/ecg/repository/types http://ecoit.hp.com/ecg/repository/types.xsd" lang="{$lang/lang/text()}" version="{$c/@version}">
         for $pf in $c/c:productFamily
         let $x := concat("/productFamily[@id=", $pf/@id, "]")
         return
         <c:productFamily id="{$pf/@id}">
    (:xpath index can not be applied within function:)
              <c:label>{data($es/t:entry[@xpath eq concat($x, "/label")]/t:translation)}</c:label>
              for $img in $pf/c:image
              return $img
              for $link in $pf/c:link
              return $link
              for $col in $pf/c:column
              return
              <c:column id="{$col/@id}">
                   <c:label>{data($es/t:entry[@xpath eq concat($x, "/column[@id=", $col/@id, "]/label")]/t:translation)}</c:label>
              </c:column>
              for $pcs in $pf/c:productCategories
              return
              <c:productCategories>
                   for $pc in $pcs/c:productCategory
                   return local:pc($pc, concat($x, "/productCategories/productCategory[@id=", $pc/@id, "]"))
              </c:productCategories>
         </c:productFamily>
         for $p in $c/c:product
         return local:p($p, concat("/product[@id=", $p/@id, "]"))
    </c:productFamiles>
    Message was edited by:
    John Lee

    John
    Am i missing a bit of the Xquery
    In 11.1,0.6.0 I get
    Elapsed: 00:00:00.04
    SQL> set echo on
    SQL> spool testcase.log
    SQL> --
    SQL> connect sys/ as sysdba
    Enter password:
    Connected.
    SQL> set define on
    SQL> set timing on
    SQL> --
    SQL> define USERNAME = HPECO
    SQL> --
    SQL> def PASSWORD = HPECO
    SQL> --
    SQL> def USER_TABLESPACE = USERS
    SQL> --
    SQL> def TEMP_TABLESPACE = TEMP
    SQL> --
    SQL> drop user &USERNAME cascade
      2  /
    old   1: drop user &USERNAME cascade
    new   1: drop user HPECO cascade
    User dropped.
    Elapsed: 00:00:18.12
    SQL> grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSW
    ORD
      2  /
    old   1: grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &P
    ASSWORD
    new   1: grant create any directory, drop any directory, connect, resource, alter session, create view to HPECO identified by HPECO
    Grant succeeded.
    Elapsed: 00:00:00.03
    SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
      2  /
    old   1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
    new   1: alter user HPECO default tablespace USERS temporary tablespace TEMP
    User altered.
    Elapsed: 00:00:00.00
    SQL> connect &USERNAME/&PASSWORD
    Connected.
    SQL> --
    SQL> alter session set events ='19027 trace name context forever, level 0x800'
      2  /
    Session altered.
    Elapsed: 00:00:00.00
    SQL> --
    SQL> declare
      2    xmlschema xmltype := XMLTYPE(
      3  '<?xml version="1.0" encoding="UTF-8"?>
      4  <!-- edited with XMLSpy v2008 (http://www.altova.com) by Jan-Erik Pedersen (HEWLETT PACKARD) -->
      5  <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:tns="http://ecoit.hp.com/ecg/rep
    ository/types" targetNamespace="http://ecoit.hp.com/ecg/repository/types" elementFormDefault="qualified">
      6     <complexType name="item">
      7             <simpleContent>
      8                     <extension base="tns:content">
      9                             <attribute name="id" type="tns:id" use="required"/>
    10                     </extension>
    11             </simpleContent>
    12     </complexType>
    13     <complexType name="items">
    14             <sequence>
    15                     <element name="item" type="tns:item" maxOccurs="unbounded"/>
    16             </sequence>
    17             <attribute name="id" type="tns:id" use="required"/>
    18     </complexType>
    19     <complexType name="mappings">
    20             <sequence>
    21                     <element name="item" type="tns:item" minOccurs="0" maxOccurs="unbounded"/>
    22                     <element name="items" type="tns:items" minOccurs="0" maxOccurs="unbounded"/>
    23             </sequence>
    24     </complexType>
    25     <complexType name="local">
    26             <sequence>
    27                     <element name="common">
    28                             <complexType>
    29                                     <sequence>
    30                                             <element name="texts" type="tns:mappings"/>
    31                                             <element name="images" type="tns:mappings" minOccurs="0"/>
    32                                     </sequence>
    33                             </complexType>
    34                     </element>
    35                     <element name="section" minOccurs="0" maxOccurs="unbounded">
    36                             <complexType>
    37                                     <sequence>
    38                                             <element name="texts" type="tns:mappings"/>
    39                                             <element name="images" type="tns:mappings" minOccurs="0"/>
    40                                     </sequence>
    41                                     <attribute name="id" use="required">
    42                                             <simpleType>
    43                                                     <restriction base="string">
    44                                                             <maxLength value="32"/>
    45                                                     </restriction>
    46                                             </simpleType>
    47                                     </attribute>
    48                             </complexType>
    49                     </element>
    50             </sequence>
    51             <attribute name="lang" use="required" xdb:SQLName="LANG">
    52                     <simpleType>
    53                             <restriction base="string">
    54                                     <length value="5"/>
    55                             </restriction>
    56                     </simpleType>
    57             </attribute>
    58     </complexType>
    59     <complexType name="link">
    60             <sequence>
    61                     <element name="url" type="tns:url"/>
    62                     <element name="label" type="tns:label"/>
    63                     <element name="image" type="tns:image" minOccurs="0"/>
    64             </sequence>
    65             <attribute name="id" type="tns:id"/>
    66     </complexType>
    67     <complexType name="image">
    68             <sequence>
    69                     <element name="url" type="string"/>
    70                     <element name="label" type="tns:label" minOccurs="0"/>
    71             </sequence>
    72             <attribute name="id" type="tns:id" use="optional"/>
    73     </complexType>
    74     <simpleType name="id">
    75             <restriction base="string">
    76                     <maxLength value="100"/>
    77             </restriction>
    78     </simpleType>
    79     <simpleType name="label">
    80             <restriction base="string">
    81                     <maxLength value="200"/>
    82             </restriction>
    83     </simpleType>
    84     <simpleType name="content">
    85             <restriction base="string">
    86                     <maxLength value="4000"/>
    87             </restriction>
    88     </simpleType>
    89     <simpleType name="url">
    90             <restriction base="string">
    91                     <maxLength value="256"/>
    92             </restriction>
    93     </simpleType>
    94  </schema>');
    95  begin
    96    dbms_xmlschema.registerSchema
    97    (
    98        schemaurl => 'http://ecoit.hp.com/ecg/repository/types.xsd'
    99       ,schemadoc => xmlschema
    100       ,local     => TRUE
    101       ,genBean   => false
    102       ,genTypes  => TRUE
    103       ,genTables => TRUE
    104       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    105    );
    106  end;
    107  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:01.35
    SQL>
    SQL> declare
      2    xmlschema xmltype := XMLTYPE(
      3  '<?xml version="1.0" encoding="UTF-8"?>
      4  <!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by  () -->
      5  <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:tns="http://ecoit.hp.com/ecg/rep
    ository/trados" targetNamespace="http://ecoit.hp.com/ecg/repository/trados" elementFormDefault="qualified">
      6     <complexType name="entry">
      7             <sequence>
      8                     <element name="base" type="string"/>
      9                     <element name="translation" maxOccurs="unbounded">
    10                             <complexType>
    11                                     <simpleContent>
    12                                             <extension base="string">
    13                                                     <attribute name="lang"/>
    14                                             </extension>
    15                                     </simpleContent>
    16                             </complexType>
    17                     </element>
    18             </sequence>
    19             <attribute name="xpath" type="string" use="required" xdb:SQLName="XPATH"/>
    20             <attribute name="locator" type="string" use="required"/>
    21     </complexType>
    22     <simpleType name="languages">
    23             <list itemType="string"/>
    24     </simpleType>
    25     <element name="trados" xdb:defaultTable="ECG_REP_TRADOS_TAB" xdb:tableProps="VARRAY XMLDATA.ENTRY STORE AS TABLE ECG_REP_TRA
    DOS_ENTRY_TAB ((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$)) ORGANIZATION INDEX OVERFLOW)">
    26             <complexType>
    27                     <sequence>
    28                             <element name="entry" type="tns:entry" minOccurs="0" maxOccurs="unbounded" xdb:SQLName="ENTRY"/>
    29                     </sequence>
    30                     <attribute name="cid" type="string"/>
    31                     <attribute name="path" type="string"/>
    32                     <attribute name="lang" type="string"/>
    33                     <attribute name="langs" type="tns:languages"/>
    34                     <attribute name="oldversion" type="string"/>
    35             </complexType>
    36     </element>
    37  </schema>');
    38  begin
    39    dbms_xmlschema.registerSchema
    40    (
    41        schemaurl => 'http://ecoit.hp.com/ecg/repository/trados.xsd'
    42       ,schemadoc => xmlschema
    43       ,local     => TRUE
    44       ,genBean   => false
    45       ,genTypes  => TRUE
    46       ,genTables => TRUE
    47       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    48    );
    49  end;
    50  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.68
    SQL> declare
      2    xmlschema xmltype := XMLTYPE(
      3  '<?xml version="1.0" encoding="UTF-8"?>
      4  <!-- edited with XMLSpy v2008 (http://www.altova.com) by Jan-Erik Pedersen (HEWLETT PACKARD) -->
      5  <!--W3C Schema generated by XMLSpy v2007 (http://www.altova.com) by Scott Dismukes (Hewlett Packard)-->
      6  <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:tns="http://ecoit.hp.com/ecg/rep
    ository/eco/category" xmlns:cns="http://ecoit.hp.com/ecg/repository/types" targetNamespace="http://ecoit.hp.com/ecg/repository/eco/c
    ategory" elementFormDefault="qualified">
      7     <import namespace="http://ecoit.hp.com/ecg/repository/types" schemaLocation="http://ecoit.hp.com/ecg/repository/types.xsd"/>
      8     <complexType name="productFamilies">
      9             <sequence>
    10                     <element name="productFamily" type="tns:productFamily" minOccurs="0" maxOccurs="unbounded"/>
    11                     <element name="product" type="tns:product" minOccurs="0" maxOccurs="unbounded"/>
    12             </sequence>
    13             <attribute name="lang" use="required" xdb:SQLName="LANG">
    14                     <simpleType>
    15                             <restriction base="string">
    16                                     <length value="5"/>
    17                             </restriction>
    18                     </simpleType>
    19             </attribute>
    20             <attribute name="version" use="required" xdb:SQLName="VERSION">
    21                     <simpleType>
    22                             <restriction base="string">
    23                                     <maxLength value="100"/>
    24                             </restriction>
    25                     </simpleType>
    26             </attribute>
    27     </complexType>
    28     <complexType name="productCategory">
    29             <sequence>
    30                     <element name="label" type="cns:label"/>
    31                     <element name="productCategory" type="tns:productCategory" minOccurs="0" maxOccurs="unbounded" xdb:defaultTa
    ble="ECG_REP_ECO_CATALOG_PC_TAB"/>
    32                     <element name="product" type="tns:product" minOccurs="0" maxOccurs="unbounded"/>
    33             </sequence>
    34             <attribute name="id" type="cns:id" use="required"/>
    35     </complexType>
    36     <complexType name="productCategories">
    37             <sequence>
    38                     <element name="productCategory" type="tns:productCategory" minOccurs="0" maxOccurs="unbounded"/>
    39             </sequence>
    40     </complexType>
    41     <complexType name="column">
    42             <sequence>
    43                     <element name="label" type="cns:label"/>
    44             </sequence>
    45             <attribute name="id" type="cns:id" use="required"/>
    46     </complexType>
    47     <complexType name="product">
    48             <sequence>
    49                     <element name="label" type="cns:label"/>
    50                     <element name="column" type="tns:column" minOccurs="0" maxOccurs="unbounded"/>
    51             </sequence>
    52             <attribute name="id" type="cns:id" use="required"/>
    53     </complexType>
    54     <complexType name="productFamily">
    55             <sequence>
    56                     <element name="label" type="cns:label"/>
    57                     <element name="image" type="cns:image" minOccurs="0" maxOccurs="unbounded"/>
    58                     <element name="link" type="cns:link" minOccurs="0" maxOccurs="unbounded"/>
    59                     <element name="column" type="tns:column" minOccurs="0" maxOccurs="unbounded"/>
    60                     <element name="productCategories" type="tns:productCategories" minOccurs="0" maxOccurs="unbounded"/>
    61             </sequence>
    62             <attribute name="id" type="cns:id" use="required"/>
    63     </complexType>
    64     <element name="productFamilies" type="tns:productFamilies" xdb:defaultTable="ECG_REP_ECO_CATALOG_TAB"/>
    65  </schema>
    66  ');
    67  begin
    68    dbms_xmlschema.registerSchema
    69    (
    70        schemaurl => 'http://ecoit.hp.com/ecg/repository/eco/category.xsd'
    71       ,schemadoc => xmlschema
    72       ,local     => TRUE
    73       ,genBean   => false
    74       ,genTypes  => TRUE
    75       ,genTables => TRUE
    76       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    77    );
    78  end;
    79  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:01.65
    SQL> CREATE INDEX ECG_REP_ENTRY_XPATH_IDX ON ECG_REP_TRADOS_ENTRY_TAB ("XPATH", "NESTED_TABLE_ID")
      2  /
    Index created.
    Elapsed: 00:00:00.01
    SQL> set pages 0 lines 160
    SQL> set long 10000
    SQL> --
    SQL> set autotrace on explain
    SQL> --
    SQL> xquery
      2  xquery version "1.0";
      3
      4  declare namespace typ = "http://ecoit.hp.com/ecg/repository/types";
      5  declare namespace c = "http://ecoit.hp.com/ecg/repository/eco/category";
      6  declare namespace t = "http://ecoit.hp.com/ecg/repository/trados";
      7
      8  declare variable $c := $res/c:productFamilies;
      9
    10  declare function local:pc($pc as element(c:productCategory), $x as xs:string) as element() {
    11     <c:productCategory id="{$pc/@id}">
    12     {
    13             <c:label>{data($es/t:entry[@xpath eq concat($x, "/label")]/t:translation)}</c:label>
    14             ,
    15             for $p in $pc/c:product
    16             return local:p($p, concat($x, "/product/[@id=", $p/@id, "]"))
    17             ,
    18             for $pcc in $pc/c:productCategory
    19             return local:pc($pcc, concat($x, "/productCategory[@id=", $pcc/@id, "]"))
    20     }
    21     </c:productCategory>
    22  };
    23
    24  declare function local:p($p as element(c:product), $x as xs:string) as element() {
    25     <c:product id="{$p/@id}">
    26     {
    27             <c:label>{string($es/t:entry[@xpath eq concat($x, "/label")]/t:translation)}</c:label>
    28             ,
    29             for $col in $p/c:column
    30             return
    31             <c:column id="{$col/@id}">
    32                     <c:label>
    33                     {
    34                             let $e := $es/t:entry[@xpath eq concat($x, "/column[@id=", $col/@id, "]/label")]
    35                             return
    36                             if(exists($e)) then string($e/t:translation)
    37                             else $col/c:label/text()
    38                     }
    39                     </c:label>
    40             </c:column>
    41     }
    42     </c:product>
    43  };
    44
    45  <c:productFamiles xsi:schemaLocation="http://ecoit.hp.com/ecg/repository/eco/category http://ecoit.hp.com/ecg/repository/eco/ca
    tegory.xsd  http://ecoit.hp.com/ecg/repository/types  http://ecoit.hp.com/ecg/repository/types.xsd" lang="{$lang/lang/text()}" versi
    on="{$c/@version}"> {
    46     for $pf in $c/c:productFamily
    47     let $x := concat("/productFamily[@id=", $pf/@id, "]")
    48     return
    49     <c:productFamily id="{$pf/@id}">
    50     {
    51             (:xpath index can not be applied within function:)
    52             <c:label>{data($es/t:entry[@xpath eq concat($x, "/label")]/t:translation)}</c:label>
    53             ,
    54             for $img in $pf/c:image
    55             return $img
    56             ,
    57             for $link in $pf/c:link
    58             return $link
    59             ,
    60             for $col in $pf/c:column
    61             return
    62             <c:column id="{$col/@id}">
    63                     <c:label>{data($es/t:entry[@xpath eq concat($x, "/column[@id=", $col/@id, "]/label")]/t:translation)}</c:lab
    el>
    64             </c:column>
    65             ,
    66             for $pcs in $pf/c:productCategories
    67             return
    68             <c:productCategories>
    69             {
    70                     for $pc in $pcs/c:productCategory
    71                     return local:pc($pc, concat($x, "/productCategories/productCategory[@id=", $pc/@id, "]"))
    72             }
    73             </c:productCategories>
    74     }
    75     </c:productFamily>
    76     ,
    77     for $p in $c/c:product
    78     return local:p($p, concat("/product[@id=", $p/@id, "]")) } </c:productFamiles>
    79  /
    ERROR:
    ORA-19228: XPST0008 - undeclared identifier: prefix 'res' local-name ''
    Elapsed: 00:00:00.01
    SQL>

  • Problem in XSD and XSLT

    Actually I have a problem relating to Oracle 10g XML DB. I’ll explain the scenario.
    1.     First an xml file needs to be loaded into the database( after registering the schema)
    2.     Later maybe after inserting suppose 10 xml files into the table, I need to add an element in the xml.
    3. And the new xml's which are later loaded will have that additional field coming in. so how should I go about from here.
    What I’ve thought is:
    1.     Generate a new XSD schema (don’t know how to generate this automatically), implementing the additional field change.(can u help me in this)
    2.     Create a new XSL depending on the new XSD schema (don’t know how to generate this automatically). (can u help me in this)
    3.     apply the new xsl to the original xml to get the new xml.
    4.     in the meantime, keep the old xml in a temporary tables, and later, update those xml corresponding to the new schema (can u help me in this)
    I don’t know if this a correct procedure, if in case, there is a different and an easy method to do it, please let me know.
    regards,
    athar

    Does the following help
    SQL> set long 10000 pages 50
    SQL> --
    SQL> declare
      2    res boolean;
      3    xmlschema xmltype := xmltype(
      4  '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://x
      5     <xsd:complexType name="T_person" xdb:SQLType="PERSON_T">
      6       <xsd:all>
      7         <xsd:element name="first_name" type="xsd:string" />
      8         <xsd:element name="last_name" type="xsd:string" />
      9         <xsd:element name="birth_day" type="xsd:date" />
    10       </xsd:all>
    11       <xsd:attribute name="employee_id" type="xsd:positiveInteger" />
    12     </xsd:complexType>
    13     <xsd:element name="person" type="T_person" xdb:defaultTable="XML_LOAD"/>
    14  </xsd:schema>');
    15  begin
    16    if (dbms_xdb.existsResource('/public/testcase.xsd')) then
    17      dbms_xdb.deleteResource('/public/testcase.xsd');
    18    end if;
    19    res := dbms_xdb.createResource('/public/testcase.xsd',xmlschema);
    20  end;
    21  /
    PL/SQL procedure successfully completed.
    SQL> call dbms_xmlschema.deleteSchema('www.WMDurl.com',4)
      2  /
    Call completed.
    SQL> begin
      2    dbms_xmlschema.registerSchema ('www.WMDurl.com',xdburitype('/public/testcas
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SQL> desc XML_LOAD
    Name                                      Null?    Type
    TABLE of SYS.XMLTYPE(XMLSchema "www.WMDurl.com" Element "person") STORAGE Object-r
    SQL> --
    SQL> desc PERSON_T
    PERSON_T is NOT FINAL
    Name                                      Null?    Type
    SYS_XDBPD$                                         XDB.XDB$RAW_LIST_T
    employee_id                                        NUMBER(38)
    first_name                                         VARCHAR2(4000 CHAR)
    last_name                                          VARCHAR2(4000 CHAR)
    birth_day                                          DATE
    SQL> --
    SQL> insert into xml_load values (xmltype(
      2  '<person employee_id="1">
      3     <first_name>mark</first_name>
      4     <last_name>drake</last_name>
      5     <birth_day>2006-01-31</birth_day>
      6   </person>'
      7  ))
      8  /
    1 row created.
    SQL> commit
      2  /
    Commit complete.
    SQL> set long 10000
    SQL> --
    SQL> select * from xml_load
      2  /
    SYS_NC_ROWINFO$
    <person employee_id="1">
      <first_name>mark</first_name>
      <last_name>drake</last_name>
      <birth_day>2006-01-31</birth_day>
    </person>
    SQL> insert into xml_load values (xmltype(
      2  '<person employee_id="1">
      3     <first_name>barney</first_name>
      4     <last_name>rubble</last_name>
      5     <birth_day>2006-01-31</birth_day>
      6     <address>Bedrock</address>
      7   </person>'
      8  ))
      9  /
    insert into xml_load values (xmltype(
    ERROR at line 1:
    ORA-30937: No schema definition for 'address' (namespace '##local') in parent
    '/person'
    SQL> commit
      2  /
    Commit complete.
    SQL> set long 10000
    SQL> --
    SQL> select * from xml_load
      2  /
    SYS_NC_ROWINFO$
    <person employee_id="1">
      <first_name>mark</first_name>
      <last_name>drake</last_name>
      <birth_day>2006-01-31</birth_day>
    </person>
    SQL> select xdbUriType('/public/testcase.xsd').getXML()
      2    from dual
      3  /
    XDBURITYPE('/PUBLIC/TESTCASE.XSD').GETXML()
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns
    .oracle.com/xdb">
      <xsd:complexType name="T_person" xdb:SQLType="PERSON_T">
        <xsd:all>
          <xsd:element name="first_name" type="xsd:string"/>
          <xsd:element name="last_name" type="xsd:string"/>
          <xsd:element name="birth_day" type="xsd:date"/>
        </xsd:all>
        <xsd:attribute name="employee_id" type="xsd:positiveInteger"/>
      </xsd:complexType>
      <xsd:element name="person" type="T_person" xdb:defaultTable="XML_LOAD"/>
    </xsd:schema>
    SQL> declare
      2    xmlschema xmltype := xdburitype('/public/testcase.xsd').getXML();
      3    res boolean;
      4  begin
      5    select insertChildXML
      6           (
      7             xmlschema,
      8             '/xsd:schema/xsd:complexType[@name="T_person"]/xsd:all',
      9             'xsd:element',
    10             xmltype('<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    11             'xmlns:xsd="http://www.w3.org/2001/XMLSchema"'
    12           )
    13      into xmlSchema
    14      from dual;
    15    if (dbms_xdb.existsResource('/public/newTestcase.xsd')) then
    16      dbms_xdb.deleteResource('/public/newTestcase.xsd');
    17    end if;
    18    res := dbms_xdb.createResource('/public/newTestcase.xsd',xmlschema);
    19  end;
    20  /
    PL/SQL procedure successfully completed.
    SQL> select xdbUriType('/public/newTestcase.xsd').getXML()
      2    from dual
      3  /
    XDBURITYPE('/PUBLIC/NEWTESTCASE.XSD').GETXML()
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns
    .oracle.com/xdb">
      <xsd:complexType name="T_person" xdb:SQLType="PERSON_T">
        <xsd:all>
          <xsd:element name="first_name" type="xsd:string"/>
          <xsd:element name="last_name" type="xsd:string"/>
          <xsd:element name="birth_day" type="xsd:date"/>
          <xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="address" t
    ype="xsd:string"/>
        </xsd:all>
        <xsd:attribute name="employee_id" type="xsd:positiveInteger"/>
      </xsd:complexType>
      <xsd:element name="person" type="T_person" xdb:defaultTable="XML_LOAD"/>
    </xsd:schema>
    SQL> begin
      2    dbms_xmlschema.CopyEvolve
      3    (
      4       xdb$string_list_t('www.WMDurl.com'),
      5       XMLSequenceType(xdburitype('/public/newTestcase.xsd').getXML()),
      6       null
      7    );
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    SQL> desc XML_LOAD
    Name                                      Null?    Type
    TABLE of SYS.XMLTYPE(XMLSchema "www.WMDurl.com" Element "person") STORAGE Object-r
    SQL> --
    SQL> desc PERSON_T
    PERSON_T is NOT FINAL
    Name                                      Null?    Type
    SYS_XDBPD$                                         XDB.XDB$RAW_LIST_T
    employee_id                                        NUMBER(38)
    first_name                                         VARCHAR2(4000 CHAR)
    last_name                                          VARCHAR2(4000 CHAR)
    birth_day                                          DATE
    address                                            VARCHAR2(4000 CHAR)
    SQL> --
    SQL> insert into xml_load values (xmltype(
      2  '<person employee_id="2">
      3     <first_name>barney</first_name>
      4     <last_name>rubble</last_name>
      5     <birth_day>2006-01-31</birth_day>
      6     <address>Bedrock</address>
      7   </person>'
      8  ))
      9  /
    1 row created.
    SQL> commit
      2  /
    Commit complete.
    SQL> set long 10000
    SQL> --
    SQL> select * from xml_load
      2  /
    SYS_NC_ROWINFO$
    <person employee_id="1">
      <first_name>mark</first_name>
      <last_name>drake</last_name>
      <birth_day>2006-01-31</birth_day>
    </person>
    <person employee_id="2">
      <first_name>barney</first_name>
      <last_name>rubble</last_name>
      <birth_day>2006-01-31</birth_day>
      <address>Bedrock</address>
    </person>
    SQL> update XML_LOAD
      2     set object_value = insertChildXML
      3                        (
      4                          object_value,
      5                          '/person',
      6                          'address',
      7                          xmltype('<address/>')
      8                        )
      9   where existsNode(object_value,'/person/address') = 0
    10  /
    1 row updated.
    SQL> commit
      2  /
    Commit complete.
    SQL> select * from xml_load
      2  /
    SYS_NC_ROWINFO$
    <person employee_id="1">
      <first_name>mark</first_name>
      <last_name>drake</last_name>
      <birth_day>2006-01-31</birth_day>
      <address/>
    </person>
    <person employee_id="2">
      <first_name>barney</first_name>
      <last_name>rubble</last_name>
      <birth_day>2006-01-31</birth_day>
      <address>Bedrock</address>
    </person>

Maybe you are looking for