[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

04/26/2009 at 08:10PM PDT, ID: 24357090
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.3

Insert into XML TYPE table in Oracle

Asked by musicbeginner in Oracle SCM, Extensible HTML (XHTML), Oracle 11.x Database

Tags: Oracle XML table

I am trying to repeat the samples in this post, but run into some errors:
http://www.oracle.com/technology/pub/articles/quinlan-xml.html
I have 0 knowledge about XML and Oracle XMLDB
If you would like to repeat,  please note that xsd file needs being revised:
1.  change xmlns:xdb=http://xmlns.oracle.com/xdb    to
                  xmlns:xdb="http://xmlns.oracle.com/xdb"
2.  Add line </xs:complexType> right after <xs:attribute name="id" type="xs:string" use="required"/>.  
Before I made the changes,  I could not register the schema.  (I knows nothing about XML,  but somehow figured out that "bug" :-).
After I register the schema,  I tried to do the insert and erroed out
(See the last step in the Code section).
I copied the two txt and the xsd files here.  All 3 files are stored in /tmp directory.
Could some Oracle XMLDB or XML expert out here shed me some light what I
missing and how I can insert into the table after I register the schema?
I really appreciate it.  Thx  If you could,  please email your response to me:
musicbeginner@yahoo.com
Sean
=======================================================

invoicexml.txt file:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0">
<xs:element name="INVOICESCHEMA" xdb:defaultTable="INVOICESCHEMA">
   <xs:complexType>
        <xs:sequence>
             <xs:element name="MailAddressTo">
                   <xs:complexType>
                         <xs:sequence>
                              <xs:element name="Person" type="xs:string"/>
                              <xs:element name="Street" type="xs:string"/>
                         </xs:sequence>
                       <xs:attribute name="id" type="xs:string" use="required"/>
                   </xs:complexType>
             </xs:element>
        </xs:sequence>
  </xs:complexType>
</xs:element>
</xs:schema>

===============
invoiceformtest.xsd  and invoiceformtest.txt files:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0">
<xs:element name="INVOICEFORMTEST" xdb:defaultTable="INVOICEFORMTEST">
   <xs:complexType>
      <xs:sequence>
         <xs:element name="MailAddressTo">
            <xs:complexType>
               <xs:sequence>
                  <xs:element name="Person" type="xs:string"/>
                  <xs:element name="Street" type="xs:string"/>
                  <xs:element name="City" type="xs:string"/>
                  <xs:element name="State" type="xs:string"/>
                  <xs:element name="Zipcode" type="xs:string"/>
               </xs:sequence>
               <xs:attribute name="id" type="xs:string" use="required"/>
            </xs:complexType>
         </xs:element>
      </xs:sequence>
   </xs:complexType>
</xs:element>
</xs:schema>



1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
Here are the code I used try to repeat the samples:
 
create directory XMLDIR as '/tmp';    
 
create table invoiceXML_col (
inv_id number primary key,
inv_doc XMLType);
 
-- create table invoiceXML_tbl of XMLtype;
 
Insert into invoicexml_col values (1,
XMLType(bfilename('XMLDIR', 'invoicexml.txt'),
nls_charset_id('AL32UTF8') ));
 
Insert into invoicexml_tbl values
(XMLType(bfilename('XMLDIR', 'invoicexml.txt'),
 nls_charset_id('AL32UTF8')));
-- register schema
BEGIN
    DBMS_XMLSCHEMA.registerSchema(
        SCHEMAURL => 'http://xmlns.oracle.com/xdb/invoiceformtest.xsd',
        SCHEMADOC => bfilename('XMLDIR','invoiceformtest.xsd'),
        CSID => nls_charset_id('AL32UTF8'));
   END;
/
Insert into invoiceformtest values
(XMLType(bfilename('XMLDIR', 'invoiceformtest.txt'), nls_charset_id('AL32UTF8')
        )
);
 
ERROR at line 1:
ORA-30937: No schema definition for 'schema' (namespace 'http://www.w3.org/2001/XMLSchema') in parent '/'
[+][-]04/29/09 06:57 AM, ID: 24260477

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Oracle SCM, Extensible HTML (XHTML), Oracle 11.x Database
Tags: Oracle XML table
Sign Up Now!
Solution Provided By: schwertner
Participating Experts: 1
Solution Grade: A
 
 
[+][-]04/30/09 04:46 AM, ID: 24268825

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04/30/09 07:04 AM, ID: 24270033

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-91 - Hierarchy / EE_QW_3_20080625