XMLElement/XMLForest used together with schema

If I want to use schema when generating XML, looks like I have to put all the elements in global scope of the target namespace in the XML schema, otherwise XMLelement/XMLForest will complain that the defintion of the element can not be found.
For example, in the schema, if I use:
<xs:element name="Link">
     <xs:complexType>
     <xs:sequence>
     <xs:element name="NavStateID" type="xs:integer" minOccurs="0"/>
     </xs:sequence>
     </xs:complexType>      
</xs:element>
and Select XMLElement("Link", XMLForest(nav_id AS "NavStateID")) from table
it will complain that NavStateID is not defined in the target namespace of the schema.
I have to use following to get around of this issue:
<xs:element name="Link">
     <xs:complexType>
     <xs:sequence>
     <xs:element ref="NavStateID" minOccurs="0"/>
     </xs:sequence>
     </xs:complexType>      
</xs:element>
<xs:element name="NavStateID" type="xs:integer"/>
Is there other way to get aroud since if the schema is big, there will be name conflict issues if I put all the element defintions in the global scope.

Oops - my bad
Had the namespace for the Schema Instance incorrect in the above example. However I do the cause of the problem. It's the setting of the elementDefaultForm qualified attribute. With it ommitted it defaults to unqualified and you get the error you are reporting..
SQL> DECLARE
  2    xmlSchema xmlType := xmlType(
  3
  4     '<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.abc.com/goodmorning" xmlns="http://www.abc.com/g
oodmorning" xmlns:xdb="http://xmlns.oracle.com/xdb">
  5             <xs:element name="FeatureLinks" xdb:defaultTable="ST_LINK_FEATURE">
  6                     <xs:complexType>
  7                             <xs:sequence>
  8                                     <xs:element name="Link" type="LinkType" maxOccurs="unbounded"/>
  9                             </xs:sequence>
10                     </xs:complexType>
11             </xs:element>
12             <xs:complexType name="LinkType">
13                     <xs:sequence>
14                             <xs:element name="ID" type="xs:integer" minOccurs="0"/>
15                             <xs:element name="Nav_State_ID" type="xs:integer"/>
16                     </xs:sequence>
17             </xs:complexType>
18     </xs:schema>');
19
20     res boolean;
21     xmlData XMLTYPE;
22     schemaURL VARCHAR2(256):='http://localhost:8080/RDF/st_link_feature.xsd';
23     schemaPath VARCHAR2(256):='/public/st_link_feature.xsd';
24     xmlPath VARCHAR2(256):='/public/test.xml';
25
26  BEGIN
27     IF (dbms_xdb.existsResource(schemaPath)) THEN
28             dbms_xmlSchema.deleteSchema(schemaURL,4);
29             dbms_xdb.deleteResource(schemaPath);
30     END IF;
31     res := dbms_xdb.createResource(schemaPath,xmlSchema);
32     dbms_xmlschema.registerSchema(schemaURL,xdbURIType(schemaPath).getClob(),TRUE,TRUE,FALSE,TRUE);
33  END;
34
35  /
PL/SQL procedure successfully completed.
SQL> drop table ST_LINK_DATA
  2  /
Table dropped.
SQL> create table ST_LINK_DATA
  2  (
  3     ID     varchar2(20),
  4     NAV_ID varchar2(20)
  5  )
  6  /
Table created.
SQL> insert into ST_LINK_DATA values ('456','123')
  2  /
1 row created.
SQL> commit
  2  /
Commit complete.
SQL> set long 100000
SQL> --
SQL> select xmlelement
  2         (
  3            "FeatureLinks",
  4            xmlAttributes
  5            (
  6               'http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi",
  7               'http://www.abc.com/goodmorning' as "xmlns",
  8               'http://www.abc.com/goodmorning http://localhost:8080/RDF/st_link_feature.xsd' as "xsi:schemaLocation"
  9            ),
10            xmlElement
11            (
12               "Link",
13               xmlForest
14               (
15                  NAV_ID as "Nav_State_ID"
16               )
17            )
18        ).extract('/*')
19   from ST_LINK_DATA
20  /
ERROR:
ORA-30937: No schema definition for 'Link' (namespace
'http://www.abc.com/goodmorning') in parent '/FeatureLinks'
ORA-06512: at "SYS.XMLTYPE", line 111
no rows selected
SQL> declare
  2   myxml xmltype;
  3  begin
  4    select xmlelement
  5         (
  6            "FeatureLinks",
  7            xmlAttributes
  8            (
  9               'http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi",
10               'http://www.abc.com/goodmorning' as "xmlns",
11               'http://www.abc.com/goodmorning http://localhost:8080/RDF/st_link_feature.xsd' as "xsi:schemaLocation"
12            ),
13            xmlElement
14            (
15               "Link",
16               xmlForest
17               (
18                  NAV_ID as "Nav_State_ID"
19               )
20            )
21        ).extract('/*')
22    into myXML
23    from ST_LINK_DATA;
24    myXML := myXML.createSchemaBasedXML();
25    myXML.schemaValidate();
26  end;
27  /
declare
ERROR at line 1:
ORA-30937: No schema definition for 'Link' (namespace
'http://www.abc.com/goodmorning') in parent '/FeatureLinks'
ORA-06512: at "SYS.XMLTYPE", line 111
ORA-06512: at line 4
SQL>With it present and set to qualified everthing works as expected
SQL> DECLARE
  2    xmlSchema xmlType := xmlType(
  3
  4     '<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.abc.com/goodmorning" xmlns="http://www.abc.com/g
oodmorning" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="qualified">
  5             <xs:element name="FeatureLinks" xdb:defaultTable="ST_LINK_FEATURE">
  6                     <xs:complexType>
  7                             <xs:sequence>
  8                                     <xs:element name="Link" type="LinkType" maxOccurs="unbounded"/>
  9                             </xs:sequence>
10                     </xs:complexType>
11             </xs:element>
12             <xs:complexType name="LinkType">
13                     <xs:sequence>
14                             <xs:element name="ID" type="xs:integer" minOccurs="0"/>
15                             <xs:element name="Nav_State_ID" type="xs:integer"/>
16                     </xs:sequence>
17             </xs:complexType>
18     </xs:schema>');
19
20     res boolean;
21     xmlData XMLTYPE;
22     schemaURL VARCHAR2(256):='http://localhost:8080/RDF/st_link_feature.xsd';
23     schemaPath VARCHAR2(256):='/public/st_link_feature.xsd';
24     xmlPath VARCHAR2(256):='/public/test.xml';
25
26  BEGIN
27     IF (dbms_xdb.existsResource(schemaPath)) THEN
28             dbms_xmlSchema.deleteSchema(schemaURL,4);
29             dbms_xdb.deleteResource(schemaPath);
30     END IF;
31     res := dbms_xdb.createResource(schemaPath,xmlSchema);
32     dbms_xmlschema.registerSchema(schemaURL,xdbURIType(schemaPath).getClob(),TRUE,TRUE,FALSE,TRUE);
33  END;
34
35  /
PL/SQL procedure successfully completed.
SQL> drop table ST_LINK_DATA
  2  /
Table dropped.
SQL> create table ST_LINK_DATA
  2  (
  3     ID     varchar2(20),
  4     NAV_ID varchar2(20)
  5  )
  6  /
Table created.
SQL> insert into ST_LINK_DATA values ('456','123')
  2  /
1 row created.
SQL> commit
  2  /
Commit complete.
SQL> set long 100000
SQL> --
SQL> select xmlelement
  2         (
  3            "FeatureLinks",
  4            xmlAttributes
  5            (
  6               'http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi",
  7               'http://www.abc.com/goodmorning' as "xmlns",
  8               'http://www.abc.com/goodmorning http://localhost:8080/RDF/st_link_feature.xsd' as "xsi:schemaLocation"
  9            ),
10            xmlElement
11            (
12               "Link",
13               xmlForest
14               (
15                  NAV_ID as "Nav_State_ID"
16               )
17            )
18        ).extract('/*')
19   from ST_LINK_DATA
20  /
XMLELEMENT("FEATURELINKS",XMLATTRIBUTES('HTTP://WWW.W3.ORG/2001/XMLSCHEMA-INSTAN
<FeatureLinks xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http:
//www.abc.com/goodmorning" xsi:schemaLocation="http://www.abc.com/goodmorning ht
tp://localhost:8080/RDF/st_link_feature.xsd">
  <Link>
    <Nav_State_ID>123</Nav_State_ID>
  </Link>
</FeatureLinks>
SQL>

Similar Messages

  • Possible to use SAX2 with schema validation

    I am trying to wade through various options on validation.
    Is it possible with the Oracle schema validation code to use SAX2 as the underlying parser? The example code with the 9.0 XDK uses DOM.

    Yes, you don't have to use DOM parser.
    DOM is only needed for validating Identity constraints that require the tree.

  • How do you apply patch to MySQL Connector/ODBC used together with dg4odbc

    I found in mysql.com about this bug:
    http://bugs.mysql.com/bug.php?id=56677
    I am still trying to find a solution for my issue posted earlier on this forum
    dg4odbc 11.2 to mysql desc table issue, query return only one record
    Do you know how to apply a patch to MySQL Connector/ODBC driver? Thank you so much!

    the source file you're linking to is a MySQL c library belonging to the MySQL ODBC driver. This means you have to get the MySQL ODBC driver source files, replace the original lib with the lib from this patch and complie the whole driver.
    As an alternative you can get in touch with MySQL support (log a service request) and request a compiled ODBC driver containing the patch.

  • Family Sharing together with iTunes Match

    How can iTunes Match be used together with family sharing on e.g. the iPodof a child?
    When the child wants to use the App-Store over family sharing, it needs to be logged on in iTunes with the childs account - but then iTunes Match can't be used from the Parents account.

    I am very interested in this as well. I don't think there is currently a solution but I think (hope) it is something that Apple will enable in the near future. Let Apple know that this is a feature we want! Send feedback here:
    http://www.apple.com/feedback/icloud.html
    I just did.

  • Using timeout with oci_execute

    Hello everyone,
    is there any way to specify a timeout when executing query with oci_execute? We'd like to be able to limit the execution time. Sometimes, it's better to kill the query and tell the user the query has failed, instead of letting it run wild and eventually overload the whole system, when the user starts hitting reload in his browser.
    I know there is OCIBreak() ic C that can be used together with a background timer, but I do not know about any solution in PHP to handle this.
    Thanks for any ideas,
    Michal

    mapquest and [google maps|http://www.google-mapsdirections.com/index.php/google-maps.htm] uses oracle in their database

  • Using Types versus XMLElement/XMLForest

    Ok, no one seems to have an answer for my previous problems with oracle types and the OracleXMLQuery facility. So I have a new question.
    Basically what I have is a program that sends and receives XML messages. All the data elements in these messages must come from the database and be updated by the received XML.
    The oracle XSU seemed to answer that question easily. But it appears to have problems.
    Instead of creating an object-relational database would I be better off creating a generic relational database and using the oracle extensions for XML (XMLElement/XMLForest etc)?
    This adds significant complexity to the queries I will have to write, but leaves the database in a more standard format.
    What other options do I have for easily generating XML from queries to a database (and saving data contained in XML back to the database)?
    Thanks!
    Conrad D. Seaman

    Conrad,
    There are some articles by Johnathan Gennick regarding xmlelement/xmlforest and views.
    http://www.oracle.com/technology/oramag/oracle/03-may/o33xml.html
    http://www.oracle.com/technology/oramag/oracle/03-jan/o13xml.html

  • Using iPhoto together with Adobe Lightroom

    I use Adobe Lightroom for my image organizing/tagging needs, since it's way more powerful than iPhoto in this area. I would however like to use iPhoto for my daily image browsing, syncing with my iPhone and for ordering prints/books ++. The way I do this now, is I let iPhoto scan the folder where I have my images. After a while when it gets outdated, I delete the database and rescan in iPhoto. Kinda cumbersome...
    So:
    1. Is there a way I can make iPhoto rescan my image folder? Maybe some script or something that can do it for me?
    2. When I rate images in LR, the ratings are stored in the IPTC Urgency field. When I import to iPhoto it doesn't import this as rating. Any way I can convert IPTC Urgency to iPhoto rating?
    3. Would Aperture be a better choice for working together with iPhoto, or would it be just as cumbersome?

    In reverse order:
    3. Would Aperture be a better choice for working together with iPhoto, or would it be just as cumbersome?
    It’s a lot better. You can grab your previews from Aperture right into iPhoto using a Media Browser, but given that Aperture will do all those things - books, syncing with iPhone etc - you’ll probably need to do it less. Like iPhoto, Aperture is integrated throughout the OS, in every Open... Dialogue, through Media Browsers to integrate with other apps and so on. The primary advantage of using Aperture is that +at least the two apps know each other exist+.
    2. When I rate images in LR, the ratings are stored in the IPTC Urgency field. When I import to iPhoto it doesn't import this as rating. Any way I can convert IPTC Urgency to iPhoto rating
    I don’t think so. There is no real way to move ratings between any apps that I know of. This area of metadata is still in its infancy.
    1. Is there a way I can make iPhoto rescan my image folder? Maybe some script or something that can do it for me?
    No. However there are apps out there that can watch that folder for you and execute specific actions on events occurring. You may be able to cook up an Automator action or Folder Action script that will import to iPhoto when a file is added to the Folder. Or use an app like Hazel to do it for you.
    Update: I’m not sure what this Lightroom plug-in brings to the party, but it may help.
    Regards
    TD
    Message was edited by: Terence Devlin

  • Help! Plug-In SLL_PI 720_46C needed to use GTS 72 together with R/3 4.6C?

    Hi together,
    maybe anybody can help me with my question:
    We want to use GTS 7.2 together with ERP 4.6C. Do I have to install additionally the plug-in SLL_PI720_46C in my feeder system? Or is it ok if I have only the standard plug-in PI2004_1_46C, SP14 installed? Do I need both?
    Thanks very much for your help and answers.
    Cheers,
    Andreas

    Andreas,
    I believe in your case it would be sufficient to install the GTS7.2 plug-in.  SAP changed its plug-in strategy for GTS 7.2 and went from the plug-in that comes pre-installed with ECC 6.0 to a separate GTS plug in for 7.2.
    I also have used GTS 7.2 with the "old" plug-in which you're referring to.  This will work for the basic Compliance and Customs functionality but I am guessing that you would run into issues when trying to use functionality that is new in GTS 7.2.
    Sascha

  • Does someone use FCE together with Sony SR10, SR11 or SR12?

    I've tried to get a YES or NO in some discussions here and since I'm not alone with the FCE/AVCHD rendering issue, I'm kind of hoping that someone using Final Cut Express (or any other good Mac software) have got this to work. I've just tried FCE together with my camcorder once in a Mac store and the person working in the store, who showed me the new Macbook Pro didn't know anything about this either. The problem I noticed was that after import of the media from camera everything looked just fine but once I dragged one clip down on the timeline FCE had to render the clip before I could watch the project. This is not news but I wonder what settings one should use in FCE together with the Sony SR12 camcorder. Is there a way to setup the project so that FCE doesn't have to render all the time using full quality AVCHD clips? If it's not possible, is there any other Mac program that will work with AVCHD natively? Maybe the solution is to switch the camera to SD instead? What happens if I do that? If I shoot in highest MPG quality, does FCE handle those clips on the timeline without rendering the clips after every change I do?
    My thoughts about this is to get a howto/check-list from someone who know and then visit this Mac store once more with my camera and try it out.
    Regards
    Robert Nilsson
    (PC owner who really would like to use the new Macbook Pro)

    When you say import, did you mean the Import command in the menus? You don't use Import with AVCHD, you use the Log and Transfer command in the File Menu. That bring up another window which looks for your camera which it calls No Name and thn begins logging in each clip. From there you have to select the clips you want to load into the editor. Each of those clips must then be "rendered" by a HD Apple Intermdiate Codec, which is the rendering you see. Once "rendered" in Final Cut, when you drag them in the timeline, they are ready to go. There is no Mac Program that natively uses AVHCD, but Sony makes a product called Vegas for Windows that edits native AVCHD, though as I understand, it isn't as powerful as Final Cut.

  • Using generics and J2SE together with JSF

    Hi
    Has anybody experience with using JSF together with J2SE 1.5? Especially generics? I would like to use generics and other improvements from J2SE in the model objects.
    Thnaks in advance ... Rick

    JSF 1.1 is specified for J2SE 5, and the new specification (JSF 1.2 and JSP 2.1) does not include generics.
    If you are talking in terms of ValueBindings or MethodBindings, there really isn't any point since the implementation could only make the cast for you; and it would still not be able to garuantee type safety (the only reason to use generics).
    That's not to say you couldn't use generics in your own development, but I don't think you will see generics incorporated into the specification any time soon.
    Jacob Hookom (JSR-252 EG)

  • Using CSS class together with CSS Rule

    Hi,
    I design my web site in Dreamweaver and then use Web
    Developer 2005 Express for the dynamic stuff. I amalgamate all the
    work I have done in Dreamweaver into 2005 Express. However with the
    new server side controls I do not know how to add a CSS class
    together with a CSS rule.
    In the normal client side control in Dreamweaver I have -
    <input name="txtPassword" type="password" class="Input"
    id="SpacerBottom" />
    In the server side controls the ID keyword is used now -
    <asp:TextBox ID="txtPassword" runat="server"
    Style="z-index: 107" CssClass="Input" ></asp:TextBox>
    I have tried to use the name="txtPassword", but it ignores
    this.
    I would really like to know how I can use a class and an id
    selector with the new server side controls and would really
    appreciate some help on this.
    Many thanks,
    Polly Anna

    the explicit " match-any" will do just that.So, a nested ACL can be configured for multiple criteria.
    The alternate is a "match-all" where all nested options in your acl MUST be met. Hope this helps.
    T

  • Using the Image Processor together with an action - original files won't get closed

    Hi,
    I just made an action to position my website's name at the bottom left of my photos and to use it then together with the  Image Processor.
    When I tried it out, I realized, that my whole pc slowed extremely down. Then I saw that the original files didn't get closed during the image processing process ...
    Then I made some tests and the result was, that the Image Processor doesn't close the original files if the action in use has more than 26 steps.
    Could someone please check out if its the same with his/her Photoshop? I use Photoshop CS6 on Windows 7.
    Thanks a lot!

    Hi,
    The problem is caused by your project not 'knowing' about the
    picture. Robohelp will automatically include all images that are
    embedded in HTML docs, but if they are only displayed via a link,
    they do not form part of the files list that is created in the
    resulting .HHP file.
    A remedy: to resolve this in the past, I've created a 'dummy
    page' that is not indexed or included in the TOC, and contains
    embeds of all of these pictures that aren't directly set in the
    HTML. Make sure it is included with the correct conditional build
    tags and recompile, you should find that the linked image now shows
    up in the CHM okay.

  • Using connections with no schema

    Oracle Rdb can run in either multi-schema mode or in a mode where there are basically no schemas.
    When running in no schema mode I can turn off schema display in the connection drill-down tree by using the following rdb.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <navigator>
    <connection id="Rdb"
    supportsOtherSchemas="false"
    showAllSchemas="false"
    supportsCatalog="false"
    connectionTabName="OracleRdb"
    However when I drag/drop a table from the connection tree panel into the SQL worksheet, SQLDeveloper insists that the table is prefixed by a schema name (ie my connection user name)
    eg
    select from "murray".EMPLOYEES;
    anyone know how to turn off this auto-prefixing so that it simple drops the following :
    select from EMPLOYEES;
    any help will be appreciated
    jim

    Hope_Seeker wrote:
    Because I send the XML in different formats for different points, wait a minute, do you mean I can use XSLT instead, how this will be with JAXB ?Yes. you can use XSLT. First you generate the XML using JAXB and apply XSLT to convert to other format. Finally you return as String from web service.
    and if I still want to use different xml schemas with JAXB marashalling how gona to do this ?Its like creating different XML object (JAXB object) and returning it from the web service. The difference from above is: above return String from web service and this returns JAXB XML object. Ultimately, its the XML travel over the wire and client does not get affected.
    Another suggestion is that you should rethink of your approach of having different XML structure. Its the same data you are sending out of the system.

  • Git/gitHub supported or can used together (linked) with dreamweaver cs6

    git/gitHub supported or can used together (linked) with dreamweaver cs6? what is version control?
    server folder, web url fields,...when define a LOCAL HOST SERVER what must insert? I have XAMPP...htdocs/ win7...?

    It is best to download scripts from Github and save them in your local site folder.
    To set-up a local testing server in DW see screenshots below.  Replace C:\wamp\www\ with xampp\htdocs
    Make sure Xampp is running.
    Nancy O.

  • Using transaction activation policy together with TOPLINK Java object/relational mapping "commit and resume" transaction?

    Has any one has experience using WLE transaction context together with TOPLINK Java
    version of "commit and resume" context?

    Has any one has experience using WLE transaction context together with TOPLINK Java
    version of "commit and resume" context?

Maybe you are looking for