ORA-30937

I want to copy a xml-document into the database. with 9.2.0.1 this works correctly but after upgrade to 9.2.0.4 it does not work and gives ORA-30937.
Can anybody kindly help?
Anna

I found that for a 9.2.0.4 database "noNameSpaceSchemaLocation" has to be replaced with "noNamespaceSchemaLocation". Then it works.
regards
Anna

Similar Messages

  • ORA-30937: No schema definition for

    Here are the steps I followed to load the xml
    DBMS_XMLSCHEMA.REGISTERSCHEMA(
    SCHEMAURL => 'security.xsd',
    SCHEMADOC => BFILENAME('XML_DIR', 'security.xsd')
    LOCAL => TRUE
    CREATE TABLE TMP_XML_TABLES
    xml_document XMLType
    XMLType COLUMN xml_document
    XMLSchema "security.xsd"
    ELEMENT "security"
    INSERT INTO TMP_XML_TABLES
    VALUES
    xmltype
    BFILENAME('XML_CLOB_DIR', 'sec.xml'),
    nls_charset_id('AL32UTF8')
    I am getting below error.
    ORA-30937: No schema definition for 'fido_flag' (namespace '##local') in parent '/security/security_
    ORA-06512: at "SYS.XMLTYPE", line 295
    ORA-06512: at line 1
    Below is the XSD and XML file. Please let me know what is wrong with it.
    security.xsd
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- edited with XMLSPY v2004 rel. 4 U (http://www.xmlspy.com) by Cary Liu (Cary Liu) -->
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
         <xs:element name="security">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="security_row" minOccurs="0" maxOccurs="unbounded"/>
                        <xs:element ref="variable_rate_row" minOccurs="0" maxOccurs="unbounded"/>
                   </xs:sequence>
                   <xs:attribute name="security_count" type="xs:long" use="optional"/>
                   <xs:attribute name="variable_rate_count" type="xs:long" use="optional"/>
              </xs:complexType>
         </xs:element>
         <xs:element name="security_row">
              <xs:complexType>
                   <xs:all>
                        <xs:element ref="security_id"/>
                        <xs:element ref="primary_asset_id"/>
                        <xs:element ref="delay_days"/>
                        <xs:element ref="arm_indicator"/>
                        <xs:element ref="camra_abs_und_coll"/>
                        <xs:element ref="camra_abs_und_coll_cpn"/>
                        <xs:element ref="initial_principal_pay_date"/>
                        <xs:element ref="final_principal_pay_date"/>
                        <xs:element ref="mtg_term"/>
                        <xs:element ref="original_face"/>
                        <xs:element ref="pool_number"/>
                        <xs:element ref="principal_pay_frequency"/>
                        <xs:element ref="pay_down_date"/>
                        <xs:element ref="principal_pay_bus_day_rule"/>
                        <xs:element ref="seasoned_mbs"/>
                        <xs:element ref="tba_stlmt_month"/>
                        <xs:element ref="accrual_flag"/>
                        <xs:element ref="accrual_rule"/>
                        <xs:element ref="base_payment_date"/>
                        <xs:element ref="day_count"/>
                        <xs:element ref="ex_interest_bond_code"/>
                        <xs:element ref="ex_days"/>
                        <xs:element ref="ex_div_date"/>
                        <xs:element ref="last_coupon_date"/>
                        <xs:element ref="for_bond_security_type"/>
                        <xs:element ref="dated_date"/>
                        <xs:element ref="issue_date"/>
                        <xs:element ref="first_coupon_date"/>
                        <xs:element ref="second_coupon_date"/>
                        <xs:element ref="mat_date"/>
                        <xs:element ref="interest_accrual_method"/>
                        <xs:element ref="odd_first_coupon_date"/>
                        <xs:element ref="odd_last_coupon_date"/>
                        <xs:element ref="payment_eom_rule"/>
                        <xs:element ref="pay_frequency"/>
                        <xs:element ref="pay_business_day_rule"/>
                        <xs:element ref="yield_day_count"/>
                        <xs:element ref="zero_coupon_type"/>
                        <xs:element ref="analyst"/>
                        <xs:element ref="analyst_recomm"/>
                        <xs:element ref="approval_flag"/>
                        <xs:element ref="camra_sec_type"/>
                        <xs:element ref="class"/>
                        <xs:element ref="comments"/>
                        <xs:element ref="holding_style"/>
                        <xs:element ref="issued_capital"/>
                        <xs:element ref="issued_capital_currency"/>
                        <xs:element ref="min_denomination"/>
                        <xs:element ref="price_multiplier"/>
                        <xs:element ref="pricing_identifier"/>
                        <xs:element ref="quantity_issued"/>
                        <xs:element ref="shares_outstanding"/>
                        <xs:element ref="quantity_type"/>
                        <xs:element ref="redemption_value"/>
                        <xs:element ref="scb_industry"/>
                        <xs:element ref="issue_desc1"/>
                        <xs:element ref="issue_desc2"/>
                        <xs:element ref="issue_desc3"/>
                        <xs:element ref="issue_short_name"/>
                        <xs:element ref="trading_lot_size"/>
                        <xs:element ref="unit_factor"/>
                        <xs:element ref="camra_exercise_date"/>
                        <xs:element ref="camra_expiration_date"/>
                        <xs:element ref="alliance_sector"/>
                        <xs:element ref="alliance_industry"/>
                        <xs:element ref="apace_security_type"/>
                        <xs:element ref="camra_gl_type"/>
                        <xs:element ref="emerg_mkt_ind"/>
                        <xs:element ref="form_13f_flag"/>
                        <xs:element ref="instrument_class"/>
                        <xs:element ref="issue_type"/>
                        <xs:element ref="mortgage_sector"/>
                        <xs:element ref="naic_code"/>
                        <xs:element ref="performance_segment"/>
                        <xs:element ref="program_type"/>
                        <xs:element ref="camra_sic_code2"/>
                        <xs:element ref="camra_sched_d_group"/>
                        <xs:element ref="camra_sched_d_state"/>
                        <xs:element ref="security_form"/>
                        <xs:element ref="security_type_distrib"/>
                        <xs:element ref="camra_sic_code"/>
                        <xs:element ref="structured_note_flag"/>
                        <xs:element ref="underlying_category"/>
                        <xs:element ref="primary_asset_id_type"/>
                        <xs:element ref="superticker"/>
                        <xs:element ref="default_status"/>
                        <xs:element ref="default_date"/>
                        <xs:element ref="accrue_in_default_ind"/>
                        <xs:element ref="ctd_bond"/>
                        <xs:element ref="contract_size"/>
                        <xs:element ref="derivative_type"/>
                        <xs:element ref="delivery_method"/>
                        <xs:element ref="conversion_factor"/>
                        <xs:element ref="flex_option_ind"/>
                        <xs:element ref="leap_option_ind"/>
                        <xs:element ref="orig_strike_price"/>
                        <xs:element ref="otc_flag"/>
                        <xs:element ref="part_paid_percent"/>
                        <xs:element ref="strike_price"/>
                        <xs:element ref="put_call_flag"/>
                        <xs:element ref="strike_price_type"/>
                        <xs:element ref="pay_currency"/>
                        <xs:element ref="rec_currency"/>
                        <xs:element ref="premium_amount"/>
                        <xs:element ref="warrant_style"/>
                        <xs:element ref="pay_status"/>
                        <xs:element ref="tick_amount"/>
                        <xs:element ref="right_warrant_option_type"/>
                        <xs:element ref="underlying_cusip"/>
                        <xs:element ref="var_margin_rule"/>
                        <xs:element ref="nominal_annual_income"/>
                        <xs:element ref="dividend_frequency"/>
                        <xs:element ref="dividend_reinvestment_ind"/>
                        <xs:element ref="dr_sponsoring"/>
                        <xs:element ref="dr_sponsor"/>
                        <xs:element ref="claim_type"/>
                        <xs:element ref="dated_date_cpi"/>
                        <xs:element ref="when_issued_ind"/>
                        <xs:element ref="series"/>
                        <xs:element ref="tranche"/>
                        <xs:element ref="guarantee_type"/>
                        <xs:element ref="deep_discount_ind"/>
                        <xs:element ref="perpetual_flag"/>
                        <xs:element ref="maturity_override"/>
                        <xs:element ref="camra_index_desc"/>
                        <xs:element ref="camra_index_spread"/>
                        <xs:element ref="coupon"/>
                        <xs:element ref="rate_benchmark"/>
                        <xs:element ref="rate_multiplier"/>
                        <xs:element ref="spread_to_benchmark"/>
                        <xs:element ref="rate_reset_frequency"/>
                        <xs:element ref="rate_base_reset_date"/>
                        <xs:element ref="reset_lag_days"/>
                        <xs:element ref="reset_lockout_days"/>
                        <xs:element ref="next_reset_date"/>
                        <xs:element ref="rate_calculate_switch"/>
                        <xs:element ref="rate_reset_bus_day_rule"/>
                        <xs:element ref="rate_reset_eom_rule"/>
                        <xs:element ref="rate_type"/>
                        <xs:element ref="mutual_fund_sponsor"/>
                        <xs:element ref="regulated_flag"/>
                        <xs:element ref="tia_1961_flag"/>
                        <xs:element ref="accumulation_income_flag"/>
                        <xs:element ref="fsa_indicator"/>
                        <xs:element ref="income_dist_policy"/>
                        <xs:element ref="mutual_fund_charge_type"/>
                        <xs:element ref="holdings_flag"/>
                        <xs:element ref="issuer_type"/>
                        <xs:element ref="issuer_id"/>
                        <xs:element ref="parent_issuer_id"/>
                        <xs:element ref="country"/>
                        <xs:element ref="currency"/>
                        <xs:element ref="country_of_origin"/>
                        <xs:element ref="risk_country"/>
                        <xs:element ref="currency_of_earnings"/>
                        <xs:element ref="currency_of_income"/>
                        <xs:element ref="currency_of_trade"/>
                        <xs:element ref="principal_currency"/>
                        <xs:element ref="exchange"/>
                        <xs:element ref="state_code"/>
                        <xs:element ref="muni_insurance"/>
                        <xs:element ref="conduit"/>
                        <xs:element ref="muni_note_type"/>
                        <xs:element ref="muni_issuer"/>
                        <xs:element ref="obligation_type"/>
                        <xs:element ref="oes_next_call_date"/>
                        <xs:element ref="offering_yield"/>
                        <xs:element ref="remarketing_agent"/>
                        <xs:element ref="tax_exempt_region"/>
                        <xs:element ref="fed_wire"/>
                        <xs:element ref="oid_flag"/>
                        <xs:element ref="oid_number"/>
                        <xs:element ref="oi_price"/>
                        <xs:element ref="camra_moody_sector"/>
                        <xs:element ref="restricted"/>
                        <xs:element ref="camra_class_144"/>
                        <xs:element ref="foreign_restriction_ind"/>
                        <xs:element ref="foreign_restriction_req"/>
                        <xs:element ref="sec_144a"/>
                        <xs:element ref="reg_s"/>
                        <xs:element ref="prvt_place_ind"/>
                        <xs:element ref="liquid_flag"/>
                        <xs:element ref="call_protection_period"/>
                        <xs:element ref="call_protection_type"/>
                        <xs:element ref="camra_make_whole_ind"/>
                        <xs:element ref="camra_conversion_price"/>
                        <xs:element ref="convertible_flag"/>
                        <xs:element ref="nra_tax_code"/>
                        <xs:element ref="tax_relief_at_source_ind"/>
                        <xs:element ref="tax_withholding_code"/>
                        <xs:element ref="tax_status"/>
                        <xs:element ref="voting_rights"/>
                        <xs:element ref="votes_per_share"/>
                        <xs:element ref="cum_voting_flag"/>
                        <xs:element ref="coupon_cap"/>
                        <xs:element ref="coupon_floor"/>
                        <xs:element ref="cross_currency_country"/>
                        <xs:element ref="cross_currency_fwd_rate"/>
                        <xs:element ref="cross_rate"/>
                        <xs:element ref="fwd_base_rate"/>
                        <xs:element ref="fwd_rate"/>
                        <xs:element ref="fwd_reset_date"/>
                        <xs:element ref="spot_base_rate"/>
                        <xs:element ref="spot_cross_rate"/>
                        <xs:element ref="fwd_point_difference"/>
                        <xs:element ref="fwd_broker_code"/>
                        <xs:element ref="fwd_side"/>
                        <xs:element ref="redemption_currency"/>
                        <xs:element ref="redenomination_date"/>
                        <xs:element ref="redenomination_flag"/>
                        <xs:element ref="amt_flag"/>
                        <xs:element ref="orig_entrydate"/>
                        <xs:element ref="orig_enteredby"/>
                        <xs:element ref="last_entrydate"/>
                        <xs:element ref="last_enteredby"/>
                        <xs:element ref="credit_family_id"/>
                        <xs:element ref="cusip"/>
                        <xs:element ref="isin"/>
                        <xs:element ref="sedol"/>
                        <xs:element ref="ticker"/>
                        <xs:element ref="apace_accrual_type"/>
                        <xs:element ref="capital_income_flag"/>
                        <xs:element ref="wal_date"/>
                        <xs:element ref="cfb_level_pay"/>
                        <xs:element ref="pending_corp_action"/>
                        <xs:element ref="pending_proxy_vote"/>
                        <xs:element ref="pms_live_indicator"/>
                        <xs:element ref="pms_price_type"/>
                        <xs:element ref="spark_flag"/>
                        <xs:element ref="whittingdale_debt_cat"/>
                        <xs:element ref="whittingdale_rating"/>
                        <xs:element ref="whittingdale_code"/>
                        <xs:element ref="expiration_date"/>
                        <xs:element ref="maturity_price"/>
                        <xs:element ref="commencement_date"/>
                        <xs:element ref="declared_payment_date"/>
                        <xs:element ref="drawer"/>
                        <xs:element ref="fv_volatility"/>
                        <xs:element ref="mv_volatility"/>
                        <xs:element ref="settle_period"/>
                        <xs:element ref="trading_margin"/>
                        <xs:element ref="compound_frequency"/>
                        <xs:element ref="coupon_rounding"/>
                        <xs:element ref="duration_to_reset"/>
                        <xs:element ref="float_rate_index_location"/>
                        <xs:element ref="periodic_basis_point_cap"/>
                        <xs:element ref="weighted_average_coupon"/>
                        <xs:element ref="whittingdale_issuer"/>
                        <xs:element ref="settlement_location"/>
                        <xs:element ref="attachment_lower"/>
                        <xs:element ref="attachment_upper"/>
                        <xs:element ref="exposure_type"/>
                        <xs:element ref="nth2default"/>
                        <xs:element ref="restruct_doc_clause"/>
                        <xs:element ref="swap_counterparty"/>
                        <xs:element ref="swaption_issue_date"/>
                        <xs:element ref="swaption_mat_date"/>
                        <xs:element ref="apace_call_price"/>
                        <xs:element ref="apace_call_date"/>
                        <xs:element ref="apace_callable_flag"/>
                        <xs:element ref="apace_put_price"/>
                        <xs:element ref="apace_put_date"/>
                        <xs:element ref="apace_putable_flag"/>
                        <xs:element ref="apace_day_count"/>
                        <xs:element ref="apace_io_ind"/>
                        <xs:element ref="apace_pass_thru_flag"/>
                        <xs:element ref="apace_price_method"/>
                        <xs:element ref="apace_price_source"/>
                        <xs:element ref="apace_depository_type"/>
                        <xs:element ref="apace_conv_ratio"/>
                        <xs:element ref="apace_floating_rate"/>
                        <xs:element ref="apace_frn_reset_code"/>
                        <xs:element ref="apace_frn_reset_date"/>
                        <xs:element ref="apace_step_conversion_date"/>
                        <xs:element ref="apace_step_conversion_rate"/>
                        <xs:element ref="apace_accrual_date_code"/>
                        <xs:element ref="apace_payment_date_code"/>
                        <xs:element ref="apace_payment_cycle_code"/>
                        <xs:element ref="apace_par_call_date"/>
                        <xs:element ref="apace_prerefund_price"/>
                        <xs:element ref="apace_prerefund_date"/>
                        <xs:element ref="apace_sink_fund_flag"/>
                        <xs:element ref="make_whole_call_flag"/>
                        <xs:element ref="fido_security_type_jvst"/>
                        <xs:element ref="fido_security_type_jstp"/>
                        <xs:element ref="fido_issuer_id"/>
                        <xs:element ref="fido_guarantor_id"/>
                        <xs:element ref="fido_name"/>
                        <xs:element ref="draft_id"/>
                        <xs:element ref="bbsw_at_last_reset"/>
                        <xs:element ref="delta"/>
                        <xs:element ref="price"/>
                        <xs:element ref="benchmark_index_sec"/>
                        <xs:element ref="index_multiplier"/>
                        <xs:element ref="index_spread"/>
                        <xs:element ref="index_link_location"/>
                        <xs:element ref="index_lag"/>
                        <xs:element ref="benchmark_rounding"/>
                        <xs:element ref="index_link_bus_day_rule"/>
                        <xs:element ref="calculation_type"/>
                        <xs:element ref="start_day_of_month"/>
                        <xs:element ref="pms_issue"/>
                        <xs:element ref="pms_name"/>
                        <xs:element ref="camra_cusip"/>
                        <xs:element ref="infoexpress_id"/>
                        <xs:element ref="issuer_desc"/>
                        <xs:element ref="parent_issuer_desc"/>
                        <xs:element ref="lead_mgr"/>
                        <xs:element ref="co_mgr"/>
                        <xs:element ref="superticker_desc"/>
                        <xs:element ref="fmc_id"/>
                        <xs:element ref="spintl_id"/>
                        <xs:element ref="tranche_type"/>
                        <xs:element ref="collateral_type"/>
                        <xs:element ref="ab_fund_desc"/>
                        <xs:element ref="adp_number"/>
                        <xs:element ref="underlying_account_id"/>
                   </xs:all>
              </xs:complexType>
         </xs:element>
         <xs:element name="variable_rate_row">
              <xs:complexType>
                   <xs:all>
                        <xs:element ref="security_id"/>
                        <xs:element ref="primary_asset_id"/>
                        <xs:element ref="sedol"/>
                        <xs:element ref="rate_type"/>
                        <xs:element ref="coupon"/>
                        <xs:element ref="effective_date"/>
                        <xs:element ref="delete_flag"/>
                        <xs:element ref="update_flag"/>
                        <xs:element ref="last_enteredby"/>
                        <xs:element ref="last_entrydate"/>
                        <xs:element ref="pms_live_indicator"/>
                   </xs:all>
              </xs:complexType>
         </xs:element>
         <xs:element name="security_id" type="xs:string"/>
         <xs:element name="primary_asset_id" type="xs:string"/>
         <xs:element name="delay_days" type="xs:double" nillable="true"/>
         <xs:element name="arm_indicator" type="xs:string" nillable="true"/>
         <xs:element name="camra_abs_und_coll" type="xs:string" nillable="true"/>
         <xs:element name="camra_abs_und_coll_cpn" type="xs:double" nillable="true"/>
         <xs:element name="initial_principal_pay_date" type="xs:date" nillable="true"/>
         <xs:element name="final_principal_pay_date" type="xs:date" nillable="true"/>
         <xs:element name="mtg_term" type="xs:int" nillable="true"/>
         <xs:element name="original_face" type="xs:double" nillable="true"/>
         <xs:element name="pool_number" type="xs:string" nillable="true"/>
         <xs:element name="principal_pay_frequency" type="xs:string" nillable="true"/>
         <xs:element name="pay_down_date" type="xs:string" nillable="true"/>
         <xs:element name="principal_pay_bus_day_rule" type="xs:string" nillable="true"/>
         <xs:element name="seasoned_mbs" type="xs:string" nillable="true"/>
         <xs:element name="tba_stlmt_month" type="xs:string" nillable="true"/>
         <xs:element name="accrual_flag" type="xs:string" nillable="true"/>
         <xs:element name="accrual_rule" type="xs:string" nillable="true"/>
         <xs:element name="base_payment_date" type="xs:string" nillable="true"/>
         <xs:element name="day_count" type="xs:string" nillable="true"/>
         <xs:element name="ex_interest_bond_code" type="xs:string" nillable="true"/>
         <xs:element name="ex_days" type="xs:int" nillable="true"/>
         <xs:element name="ex_div_date" type="xs:date" nillable="true"/>
         <xs:element name="last_coupon_date" type="xs:date" nillable="true"/>
         <xs:element name="for_bond_security_type" type="xs:string" nillable="true"/>
         <xs:element name="dated_date" type="xs:date" nillable="true"/>
         <xs:element name="issue_date" type="xs:date" nillable="true"/>
         <xs:element name="first_coupon_date" type="xs:date" nillable="true"/>
         <xs:element name="second_coupon_date" type="xs:date" nillable="true"/>
         <xs:element name="mat_date" type="xs:date" nillable="true"/>
         <xs:element name="interest_accrual_method" type="xs:string" nillable="true"/>
         <xs:element name="odd_first_coupon_date" type="xs:date" nillable="true"/>
         <xs:element name="odd_last_coupon_date" type="xs:date" nillable="true"/>
         <xs:element name="payment_eom_rule" type="xs:string" nillable="true"/>
         <xs:element name="pay_frequency" type="xs:string" nillable="true"/>
         <xs:element name="pay_business_day_rule" type="xs:string" nillable="true"/>
         <xs:element name="yield_day_count" type="xs:string" nillable="true"/>
         <xs:element name="zero_coupon_type" type="xs:string" nillable="true"/>
         <xs:element name="analyst" type="xs:string" nillable="true"/>
         <xs:element name="analyst_recomm" type="xs:string" nillable="true"/>
         <xs:element name="approval_flag" type="xs:string" nillable="true"/>
         <xs:element name="camra_sec_type" type="xs:string" nillable="true"/>
         <xs:element name="class" type="xs:string" nillable="true"/>
         <xs:element name="comments" type="xs:string" nillable="true"/>
         <xs:element name="holding_style" type="xs:string" nillable="true"/>
         <xs:element name="issued_capital" type="xs:double" nillable="true"/>
         <xs:element name="issued_capital_currency" type="xs:string" nillable="true"/>
         <xs:element name="min_denomination" type="xs:double" nillable="true"/>
         <xs:element name="price_multiplier" type="xs:double" nillable="true"/>
         <xs:element name="pricing_identifier" type="xs:string" nillable="true"/>
         <xs:element name="quantity_issued" type="xs:double" nillable="true"/>
         <xs:element name="shares_outstanding" type="xs:decimal" nillable="true"/>
         <xs:element name="quantity_type" type="xs:string" nillable="true"/>
         <xs:element name="redemption_value" type="xs:double" nillable="true"/>
         <xs:element name="scb_industry" type="xs:string" nillable="true"/>
         <xs:element name="issue_desc1" type="xs:string" nillable="true"/>
         <xs:element name="issue_desc2" type="xs:string" nillable="true"/>
         <xs:element name="issue_desc3" type="xs:string" nillable="true"/>
         <xs:element name="issue_short_name" type="xs:string" nillable="true"/>
         <xs:element name="trading_lot_size" type="xs:double" nillable="true"/>
         <xs:element name="unit_factor" type="xs:double" nillable="true"/>
         <xs:element name="camra_exercise_date" type="xs:date" nillable="true"/>
         <xs:element name="camra_expiration_date" type="xs:date" nillable="true"/>
         <xs:element name="alliance_sector" type="xs:string" nillable="true"/>
         <xs:element name="alliance_industry" type="xs:string" nillable="true"/>
         <xs:element name="apace_security_type" type="xs:string" nillable="true"/>
         <xs:element name="camra_gl_type" type="xs:string" nillable="true"/>
         <xs:element name="emerg_mkt_ind" type="xs:string" nillable="true"/>
         <xs:element name="form_13f_flag" type="xs:string" nillable="true"/>
         <xs:element name="instrument_class" type="xs:string"/>
         <xs:element name="issue_type" type="xs:string"/>
         <xs:element name="mortgage_sector" type="xs:string" nillable="true"/>
         <xs:element name="naic_code" type="xs:string" nillable="true"/>
         <xs:element name="performance_segment" type="xs:string" nillable="true"/>
         <xs:element name="program_type" type="xs:string" nillable="true"/>
         <xs:element name="camra_sic_code2" type="xs:string" nillable="true"/>
         <xs:element name="camra_sched_d_group" type="xs:string" nillable="true"/>
         <xs:element name="camra_sched_d_state" type="xs:string" nillable="true"/>
         <xs:element name="security_form" type="xs:string" nillable="true"/>
         <xs:element name="security_type_distrib" type="xs:string" nillable="true"/>
         <xs:element name="camra_sic_code" type="xs:string" nillable="true"/>
         <xs:element name="structured_note_flag" type="xs:string" nillable="true"/>
         <xs:element name="underlying_category" type="xs:string" nillable="true"/>
         <xs:element name="primary_asset_id_type" type="xs:string"/>
         <xs:element name="superticker" type="xs:string" nillable="true"/>
         <xs:element name="default_status" type="xs:string" nillable="true"/>
         <xs:element name="default_date" type="xs:date" nillable="true"/>
         <xs:element name="accrue_in_default_ind" type="xs:string" nillable="true"/>
         <xs:element name="ctd_bond" type="xs:string" nillable="true"/>
         <xs:element name="contract_size" type="xs:double" nillable="true"/>
         <xs:element name="derivative_type" type="xs:string" nillable="true"/>
         <xs:element name="delivery_method" type="xs:string" nillable="true"/>
         <xs:element name="conversion_factor" type="xs:double" nillable="true"/>
         <xs:element name="flex_option_ind" type="xs:string" nillable="true"/>
         <xs:element name="leap_option_ind" type="xs:string" nillable="true"/>
         <xs:element name="orig_strike_price" type="xs:double" nillable="true"/>
         <xs:element name="otc_flag" type="xs:string" nillable="true"/>
         <xs:element name="part_paid_percent" type="xs:double" nillable="true"/>
         <xs:element name="strike_price" type="xs:double" nillable="true"/>
         <xs:element name="put_call_flag" type="xs:string" nillable="true"/>
         <xs:element name="strike_price_type" type="xs:string" nillable="true"/>
         <xs:element name="pay_currency" type="xs:string" nillable="true"/>
         <xs:element name="rec_currency" type="xs:string" nillable="true"/>
         <xs:element name="premium_amount" type="xs:double" nillable="true"/>
         <xs:element name="warrant_style" type="xs:string" nillable="true"/>
         <xs:element name="pay_status" type="xs:string" nillable="true"/>
         <xs:element name="tick_amount" type="xs:double" nillable="true"/>
         <xs:element name="right_warrant_option_type" type="xs:string" nillable="true"/>
         <xs:element name="underlying_cusip" type="xs:string" nillable="true"/>
         <xs:element name="var_margin_rule" type="xs:int" nillable="true"/>
         <xs:element name="nominal_annual_income" type="xs:double" nillable="true"/>
         <xs:element name="dividend_frequency" type="xs:string" nillable="true"/>
         <xs:element name="dividend_reinvestment_ind" type="xs:string" nillable="true"/>
         <xs:element name="dr_sponsoring" type="xs:string" nillable="true"/>
         <xs:element name="dr_sponsor" type="xs:string" nillable="true"/>
         <xs:element name="claim_type" type="xs:string" nillable="true"/>
         <xs:element name="dated_date_cpi" type="xs:double" nillable="true"/>
         <xs:element name="when_issued_ind" type="xs:string" nillable="true"/>
         <xs:element name="series" type="xs:string" nillable="true"/>
         <xs:element name="tranche" type="xs:string" nillable="true"/>
         <xs:element name="guarantee_type" type="xs:string" nillable="true"/>
         <xs:element name="deep_discount_ind" type="xs:string" nillable="true"/>
         <xs:element name="perpetual_flag" type="xs:string" nillable="true"/>
         <xs:element name="maturity_override" type="xs:string" nillable="true"/>
         <xs:element name="camra_index_desc" type="xs:string" nillable="true"/>
         <xs:element name="camra_index_spread" type="xs:double" nillable="true"/>
         <xs:element name="coupon" type="xs:double" nillable="true"/>
         <xs:element name="rate_benchmark" type="xs:string" nillable="true"/>
         <xs:element name="rate_multiplier" type="xs:double" nillable="true"/>
         <xs:element name="spread_to_benchmark" type="xs:double" nillable="true"/>
         <xs:element name="rate_reset_frequency" type="xs:string" nillable="true"/>
         <xs:element name="rate_base_reset_date" type="xs:date" nillable="true"/>
         <xs:element name="reset_lag_days" type="xs:double" nillable="true"/>
         <xs:element name="reset_lockout_days" type="xs:double" nillable="true"/>
         <xs:element name="next_reset_date" type="xs:date" nillable="true"/>
         <xs:element name="rate_calculate_switch" type="xs:string" nillable="true"/>
         <xs:element name="rate_reset_bus_day_rule" type="xs:string" nillable="true"/>
         <xs:element name="rate_reset_eom_rule" type="xs:string" nillable="true"/>
         <xs:element name="rate_type" type="xs:string" nillable="true"/>
         <xs:element name="mutual_fund_sponsor" type="xs:string" nillable="true"/>
         <xs:element name="regulated_flag" type="xs:string" nillable="true"/>
         <xs:element name="tia_1961_flag" type="xs:string" nillable="true"/>
         <xs:element name="accumulation_income_flag" type="xs:string" nillable="true"/>
         <xs:element name="fsa_indicator" type="xs:string" nillable="true"/>
         <xs:element name="income_dist_policy" type="xs:string" nillable="true"/>
         <xs:element name="mutual_fund_charge_type" type="xs:string" nillable="true"/>
         <xs:element name="holdings_flag" type="xs:string" nillable="true"/>
         <xs:element name="issuer_type" type="xs:string" nillable="true"/>
         <xs:element name="issuer_id" type="xs:string" nillable="true"/>
         <xs:element name="parent_issuer_id" type="xs:string" nillable="true"/>
         <xs:element name="country" type="xs:string" nillable="true"/>
         <xs:element name="currency" type="xs:string" nillable="true"/>
         <xs:element name="country_of_origin" type="xs:string" nillable="true"/>
         <xs:element name="risk_country" type="xs:string" nillable="true"/>
         <xs:element name="currency_of_earnings" type="xs:string" nillable="true"/>
         <xs:element name="currency_of_income" type="xs:string" nillable="true"/>
         <xs:element name="currency_of_trade" type="xs:string" nillable="true"/>
         <xs:element name="principal_currency" type="xs:string" nillable="true"/>
         <xs:element name="exchange" type="xs:string" nillable="true"/>
         <xs:element name="state_code" type="xs:string" nillable="true"/>
         <xs:element name="muni_insurance" type="xs:string" nillable="true"/>
         <xs:element name="conduit" type="xs:string" nillable="true"/>
         <xs:element name="muni_note_type" type="xs:string" nillable="true"/>
         <xs:element name="muni_issuer" type="xs:string" nillable="true"/>
         <xs:element name="obligation_type" type="xs:string" nillable="true"/>
         <xs:element name="oes_next_call_date" type="xs:date" nillable="true"/>
         <xs:element name="offering_yield" type="xs:double" nillable="true"/>
         <xs:element name="remarketing_agent" type="xs:string" nillable="true"/>
         <xs:element name="tax_exempt_region" type="xs:string" nillable="true"/>
         <xs:element name="fed_wire" type="xs:string" nillable="true"/>
         <xs:element name="oid_flag" type="xs:string" nillable="true"/>
         <xs:element name="oid_number" type="xs:int" nillable="true"/>
         <xs:element name="oi_price" type="xs:double" nillable="true"/>
         <xs:element name="camra_moody_sector" type="xs:string" nillable="true"/>
         <xs:element name="restricted" type="xs:string" nillable="true"/>
         <xs:element name="camra_class_144" type="xs:string" nillable="true"/>
         <xs:element name="foreign_restriction_ind" type="xs:string" nillable="true"/>
         <xs:element name="foreign_restriction_req" type="xs:double" nillable="true"/>
         <xs:element name="sec_144a" type="xs:string" nillable="true"/>
         <xs:element name="reg_s" type="xs:string" nillable="true"/>
         <xs:element name="prvt_place_ind" type="xs:string" nillable="true"/>
         <xs:element name="liquid_flag" type="xs:string" nillable="true"/>
         <xs:element name="call_protection_period" type="xs:int" nillable="true"/>
         <xs:element name="call_protection_type" type="xs:string" nillable="true"/>
         <xs:element name="camra_make_whole_ind" type="xs:string" nillable="true"/>
         <xs:element name="camra_conversion_price" type="xs:double" nillable="true"/>
         <xs:element name="convertible_flag" type="xs:string" nillable="true"/>
         <xs:element name="nra_tax_code" type="xs:string" nillable="true"/>
         <xs:element name="tax_relief_at_source_ind" type="xs:string" nillable="true"/>
         <xs:element name="tax_withholding_code" type="xs:string" nillable="true"/>
         <xs:element name="tax_status" type="xs:string" nillable="true"/>
         <xs:element name="voting_rights" type="xs:string" nillable="true"/>
         <xs:element name="votes_per_share" type="xs:int" nillable="true"/>
         <xs:element name="cum_voting_flag" type="xs:string" nillable="true"/>
         <xs:element name="coupon_cap" type="xs:double" nillable="true"/>
         <xs:element name="coupon_floor" type="xs:double" nillable="true"/>
         <xs:element name="cross_currency_country" type="xs:string" nillable="true"/>
         <xs:element name="cross_currency_fwd_rate" type="xs:double" nillable="true"/>
         <xs:element name="cross_rate" type="xs:double" nillable="true"/>
         <xs:element name="fwd_base_rate" type="xs:double" nillable="true"/>
         <xs:element name="fwd_rate" type="xs:double" nillable="true"/>
         <xs:element name="fwd_reset_date" type="xs:date" nillable="true"/>
         <xs:element name="spot_base_rate" type="xs:double" nillable="true"/>
         <xs:element name="spot_cross_rate" type="xs:double" nillable="true"/>
         <xs:element name="fwd_point_difference" type="xs:double" nillable="true"/>
         <xs:element name="fwd_broker_code" type="xs:string" nillable="true"/>
         <xs:element name="fwd_side" type="xs:string" nillable="true"/>
         <xs:element name="redemption_currency" type="xs:string" nillable="true"/>
         <xs:element name="redenomination_date" type="xs:date" nillable="true"/>
         <xs:element name="redenomination_flag" type="xs:string" nillable="true"/>
         <xs:element name="amt_flag" type="xs:string" nillable="true"/>
         <xs:element name="orig_entrydate" type="xs:dateTime" nillable="true"/>
         <xs:element name="orig_enteredby" type="xs:string" nillable="true"/>
         <xs:element name="last_entrydate" type="xs:dateTime" nillable="true"/>
         <xs:element name="last_enteredby" type="xs:string" nillable="true"/>
         <xs:element name="credit_family_id" type="xs:string" nillable="true"/>
         <xs:element name="cusip" type="xs:string" nillable="true"/>
         <xs:element name="isin" type="xs:string" nillable="true"/>
         <xs:element name="sedol" type="xs:string" nillable="true"/>
         <xs:element name="ticker" type="xs:string" nillable="true"/>
         <xs:element name="apace_accrual_type" type="xs:string" nillable="true"/>
         <xs:element name="capital_income_flag" type="xs:string" nillable="true"/>
         <xs:element name="wal_date" type="xs:date" nillable="true"/>
         <xs:element name="cfb_level_pay" type="xs:double" nillable="true"/>
         <xs:element name="pending_corp_action" type="xs:string" nillable="true"/>
         <xs:element name="pending_proxy_vote" type="xs:string" nillable="true"/>
         <xs:element name="pms_live_indicator" type="xs:string" nillable="true"/>
         <xs:element name="pms_price_type" type="xs:string" nillable="true"/>
         <xs:element name="spark_flag" type="xs:string" nillable="true"/>
         <xs:element name="whittingdale_debt_cat" type="xs:int" nillable="true"/>
         <xs:element name="whittingdale_rating" type="xs:int" nillable="true"/>
         <xs:element name="whittingdale_code" type="xs:string" nillable="true"/>
         <xs:element name="expiration_date" type="xs:date" nillable="true"/>
         <xs:element name="maturity_price" type="xs:double" nillable="true"/>
         <xs:element name="commencement_date" type="xs:date" nillable="true"/>
         <xs:element name="declared_payment_date" type="xs:date" nillable="true"/>
         <xs:element name="drawer" type="xs:string" nillable="true"/>
         <xs:element name="fv_volatility" type="xs:double" nillable="true"/>
         <xs:element name="mv_volatility" type="xs:double" nillable="true"/>
         <xs:element name="settle_period" type="xs:double" nillable="true"/>
         <xs:element name="trading_margin" type="xs:double" nillable="true"/>
         <xs:element name="compound_frequency" type="xs:string" nillable="true"/>
         <xs:element name="coupon_rounding" type="xs:double" nillable="true"/>
         <xs:element name="duration_to_reset" type="xs:string" nillable="true"/>
         <xs:element name="float_rate_index_location" type="xs:string" nillable="true"/>
         <xs:element name="periodic_basis_point_cap" type="xs:decimal" nillable="true"/>
         <xs:element name="weighted_average_coupon" type="xs:double" nillable="true"/>
         <xs:element name="whittingdale_issuer" type="xs:int" nillable="true"/>
         <xs:element name="settlement_location" type="xs:string" nillable="true"/>
         <xs:element name="attachment_lower" type="xs:double" nillable="true"/>
         <xs:element name="attachment_upper" type="xs:double" nillable="true"/>
         <xs:element name="exposure_type" type="xs:string" nillable="true"/>
         <xs:element name="nth2default" type="xs:double" nillable="true"/>
         <xs:element name="restruct_doc_clause" type="xs:string" nillable="true"/>
         <xs:element name="swap_counterparty" type="xs:string" nillable="true"/>
         <xs:element name="swaption_issue_date" type="xs:date" nillable="true"/>
         <xs:element name="swaption_mat_date" type="xs:date" nillable="true"/>
         <xs:element name="apace_call_price" type="xs:double" nillable="true"/>
         <xs:element name="apace_call_date" type="xs:date" nillable="true"/>
         <xs:element name="apace_callable_flag" type="xs:string" nillable="true"/>
         <xs:element name="apace_put_price" type="xs:double" nillable="true"/>
         <xs:element name="apace_put_date" type="xs:date" nillable="true"/>
         <xs:element name="apace_putable_flag" type="xs:string" nillable="true"/>
         <xs:element name="apace_day_count" type="xs:string" nillable="true"/>
         <xs:element name="apace_io_ind" type="xs:string" nillable="true"/>
         <xs:element name="apace_pass_thru_flag" type="xs:string" nillable="true"/>
         <xs:element name="apace_price_method" type="xs:string" nillable="true"/>
         <xs:element name="apace_price_source" type="xs:string" nillable="true"/>
         <xs:element name="apace_depository_type" type="xs:string" nillable="true"/>
         <xs:element name="apace_conv_ratio" type="xs:double" nillable="true"/>
         <xs:element name="apace_floating_rate" type="xs:string" nillable="true"/>
         <xs:element name="apace_frn_reset_code" type="xs:string" nillable="true"/>
         <xs:element name="apace_frn_reset_date" type="xs:date" nillable="true"/>
         <xs:element name="apace_step_conversion_date" type="xs:date" nillable="true"/>
         <xs:element name="apace_step_conversion_rate" type="xs:double" nillable="true"/>
         <xs:element name="apace_accrual_date_code" type="xs:string" nillable="true"/>
         <xs:element name="apace_payment_date_code" type="xs:string" nillable="true"/>
         <xs:element name="apace_payment_cycle_code" type="xs:string" nillable="true"/>
         <xs:element name="apace_par_call_date" type="xs:date" nillable="true"/>
         <xs:element name="apace_prerefund_price" type="xs:double" nillable="true"/>
         <xs:element name="apace_prerefund_date" type="xs:date" nillable="true"/>
         <xs:element name="apace_sink_fund_flag" type="xs:string" nillable="true"/>
         <xs:element name="make_whole_call_flag" type="xs:string" nillable="true"/>
         <xs:element name="effective_date" type="xs:date"/>
         <xs:element name="delete_flag" type="xs:string" nillable="true"/>
         <xs:element name="update_flag" type="xs:string" nillable="true"/>
         <xs:element name="fido_security_type_jvst" type="xs:int" nillable="true"/>
         <xs:element name="fido_security_type_jstp" type="xs:string" nillable="true"/>
         <xs:element name="fido_issuer_id" type="xs:int" nillable="true"/>
         <xs:element name="fido_guarantor_id" type="xs:int" nillable="true"/>
         <xs:element name="fido_name" type="xs:string" nillable="true"/>
         <xs:element name="draft_id" type="xs:string" nillable="true"/>
         <xs:element name="bbsw_at_last_reset" type="xs:double" nillable="true"/>
         <xs:element name="delta" type="xs:double" nillable="true"/>
         <xs:element name="price" type="xs:double" nillable="true"/>
         <xs:element name="benchmark_index_sec" type="xs:string" nillable="true"/>
         <xs:element name="index_multiplier" type="xs:double" nillable="true"/>
         <xs:element name="index_spread" type="xs:double" nillable="true"/>
         <xs:element name="index_link_location" type="xs:string" nillable="true"/>
         <xs:element name="index_lag" type="xs:double" nillable="true"/>
         <xs:element name="benchmark_rounding" type="xs:int" nillable="true"/>
         <xs:element name="index_link_bus_day_rule" type="xs:string" nillable="true"/>
         <xs:element name="calculation_type" type="xs:int" nillable="true"/>
         <xs:element name="start_day_of_month" type="xs:int" nillable="true"/>
         <xs:element name="pms_issue" type="xs:string" nillable="true"/>
         <xs:element name="pms_name" type="xs:string" nillable="true"/>
         <xs:element name="camra_cusip" type="xs:string" nillable="true"/>
         <xs:element name="infoexpress_id" type="xs:string" nillable="true"/>
         <xs:element name="issuer_desc" type="xs:string" nillable="true"/>
         <xs:element name="parent_issuer_desc" type="xs:string" nillable="true"/>
         <xs:element name="lead_mgr" type="xs:string" nillable="true"/>
         <xs:element name="co_mgr" type="xs:string" nillable="true"/>
         <xs:element name="superticker_desc" type="xs:string" nillable="true"/>
         <xs:element name="fmc_id" type="xs:string" nillable="true"/>
         <xs:element name="spintl_id" type="xs:string" nillable="true"/>
         <xs:element name="tranche_type" type="xs:string" nillable="true"/>
         <xs:element name="collateral_type" type="xs:string" nillable="true"/>
         <xs:element name="ab_fund_desc" type="xs:string" nillable="true"/>
         <xs:element name="adp_number" type="xs:string" nillable="true"/>
         <xs:element name="underlying_account_id" type="xs:string" nillable="true"/>
    </xs:schema>
    sec.xml
    <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
    <security security_count="1" variable_rate_count="0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="security.xsd">
    <security_row><security_id>LZ002359750</security_id><primary_asset_id>B2479G9</primary_asset_id><delay_days xsi:nil="true"></delay_days><arm_indicator xsi:nil="true"></arm_indicator><camra_abs_und_coll xsi:nil="true"></camra_abs_und_coll><camra_abs_und_coll_cpn xsi:nil="true"></camra_abs_und_coll_cpn><initial_principal_pay_date xsi:nil="true"></initial_principal_pay_date><final_principal_pay_date xsi:nil="true"></final_principal_pay_date><mtg_term xsi:nil="true"></mtg_term><original_face xsi:nil="true"></original_face><pool_number xsi:nil="true"></pool_number><principal_pay_frequency xsi:nil="true"></principal_pay_frequency><pay_down_date xsi:nil="true"></pay_down_date><principal_pay_bus_day_rule xsi:nil="true"></principal_pay_bus_day_rule><seasoned_mbs xsi:nil="true"></seasoned_mbs><tba_stlmt_month xsi:nil="true"></tba_stlmt_month><accrual_flag>Y</accrual_flag><accrual_rule>1</accrual_rule><base_payment_date>0831</base_payment_date><day_count>ACT/ACT</day_count><ex_interest_bond_code xsi:nil="true"></ex_interest_bond_code><ex_days xsi:nil="true"></ex_days><ex_div_date xsi:nil="true"></ex_div_date><last_coupon_date>2017-08-31</last_coupon_date><for_bond_security_type>GER</for_bond_security_type><dated_date>2007-08-31</dated_date><issue_date>2007-08-31</issue_date><first_coupon_date>2008-08-31</first_coupon_date><second_coupon_date>2009-08-31</second_coupon_date><mat_date>2017-08-31</mat_date><interest_accrual_method>PER</interest_accrual_method><odd_first_coupon_date xsi:nil="true"></odd_first_coupon_date><odd_last_coupon_date xsi:nil="true"></odd_last_coupon_date><payment_eom_rule>Y</payment_eom_rule><pay_frequency>A</pay_frequency><pay_business_day_rule>BD</pay_business_day_rule><yield_day_count>ACT/ACT</yield_day_count><zero_coupon_type xsi:nil="true"></zero_coupon_type><analyst>SH</analyst><analyst_recomm xsi:nil="true"></analyst_recomm><approval_flag>Y</approval_flag><camra_sec_type xsi:nil="true"></camra_sec_type><class xsi:nil="true"></class><comments xsi:nil="true"></comments><holding_style>BE</holding_style><issued_capital xsi:nil="true"></issued_capital><issued_capital_currency>EUR</issued_capital_currency><min_denomination>50000</min_denomination><price_multiplier>0.01</price_multiplier><pricing_identifier xsi:nil="true"></pricing_identifier><quantity_issued>2250000</quantity_issued><shares_outstanding>2250000</shares_outstanding><quantity_type>PAR</quantity_type><redemption_value>100</redemption_value><scb_industry xsi:nil="true"></scb_industry><issue_desc1>DEUTSCHE BANK AG</issue_desc1><issue_desc2 xsi:nil="true"></issue_desc2><issue_desc3 xsi:nil="true"></issue_desc3><issue_short_name>DEUTSCHE BANK AG</issue_short_name><trading_lot_size>50000</trading_lot_size><unit_factor>1</unit_factor><camra_exercise_date xsi:nil="true"></camra_exercise_date><camra_expiration_date xsi:nil="true"></camra_expiration_date><alliance_sector>230</alliance_sector><alliance_industry>23030</alliance_industry><camra_gl_type xsi:nil="true"></camra_gl_type><emerg_mkt_ind xsi:nil="true"></emerg_mkt_ind><form_13f_flag xsi:nil="true"></form_13f_flag><instrument_class>FI</instrument_class><issue_type>BOND</issue_type><mortgage_sector>ZZ</mortgage_sector><naic_code xsi:nil="true"></naic_code><performance_segment>3</performance_segment><program_type xsi:nil="true"></program_type><camra_sic_code2 xsi:nil="true"></camra_sic_code2><camra_sched_d_group xsi:nil="true"></camra_sched_d_group><camra_sched_d_state xsi:nil="true"></camra_sched_d_state><security_form xsi:nil="true"></security_form><security_type_distrib xsi:nil="true"></security_type_distrib><camra_sic_code xsi:nil="true"></camra_sic_code><structured_note_flag>N</structured_note_flag><underlying_category xsi:nil="true"></underlying_category><primary_asset_id_type>aPACE</primary_asset_id_type><superticker>B2479G9</superticker><default_status>N</default_status><default_date xsi:nil="true"></default_date><accrue_in_default_ind>N</accrue_in_default_ind><ctd_bond xsi:nil="true"></ctd_bond><contract_size xsi:nil="true"></contract_size><derivative_type xsi:nil="true"></derivative_type><delivery_method xsi:nil="true"></delivery_method><conversion_factor xsi:nil="true"></conversion_factor><flex_option_ind xsi:nil="true"></flex_option_ind><leap_option_ind xsi:nil="true"></leap_option_ind><orig_strike_price xsi:nil="true"></orig_strike_price><otc_flag xsi:nil="true"></otc_flag><part_paid_percent xsi:nil="true"></part_paid_percent><strike_price xsi:nil="true"></strike_price><put_call_flag xsi:nil="true"></put_call_flag><strike_price_type xsi:nil="true"></strike_price_type><pay_currency

    Then you hit a bug in your version of Oracle. You may want to investigate and update to a newer version. I get the following error when trying to register your schema in 10.2.0.1
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00246: invalid QNAME "***_voting_flag"
    This error is consistent with Spy 2008 as well (I didn't try Xerces but I've got two that agree so it's good for me).

  • ORA-30937 when validating element referenced from included schema

    I've boiled my latest problem down to a simple test case. Basically it seems as though the included schema is the problem, but I can't figure out why:
    begin
    dbms_xmlschema.deleteSchema('http://www.forensic.gov.uk/eMessages/Pnclink/NDNA/testinclude.xsd', dbms_xmlschema.DELETE_CASCADE_FORCE);
    dbms_xmlschema.registerSchema('http://www.forensic.gov.uk/eMessages/Pnclink/NDNA/testinclude.xsd',
    '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" versionfiltered="1-00" id="NDNASimpleTypes">
    <xsd:complexType name="MessageHeaderType">
    <xsd:sequence>
    <xsd:element name="MESSAGE_NUMBER" type="xsd:long"/>
    <xsd:element name="MESSAGE_TYPE" type="MessageTypeType"/>
    <xsd:element name="MESSAGE_DATE" type="xsd:dateTime"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:simpleType name="MessageTypeType">
    <xsd:annotation>
    <xsd:documentation>The definition of the Sample Message Types</xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
    <xsd:maxLength value="2"/>
    <xsd:enumeration value="CT"/>
    <xsd:enumeration value="CA"/>
    <xsd:enumeration value="CD"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:schema>',TRUE,FALSE,FALSE,FALSE);
    dbms_xmlschema.deleteSchema('http://www.forensic.gov.uk/eMessages/Pnclink/NDNA/Test.xsd', dbms_xmlschema.DELETE_CASCADE);
    dbms_xmlschema.registerSchema('http://www.forensic.gov.uk/eMessages/Pnclink/NDNA/Test.xsd',
    '<xsd:schema xmlns="http://www.forensic.gov.uk/eMessages/Pnclink/NDNA" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.forensic.gov.uk/eMessages/Pnclink/NDNA" elementFormDefault="qualified" attributeFormDefault="unqualified" versionfiltered="1.0" id="Test">
    <xsd:include schemaLocation="http://www.forensic.gov.uk/eMessages/Pnclink/NDNA/testinclude.xsd"/>
    <xsd:element name="SAMPLE_MESSAGE">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="MESSAGE_HEADER" type="MessageHeaderType"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>',TRUE,TRUE,FALSE,FALSE);
    END;
    update xml_in
    set xml_data = xmltype ( '<?xml versionfiltered="1.0" encoding="UTF-8"?>
    <!--Sample XML file generated by XMLSpy v2005 rel. 3 U (http://www.altova.com)-->
    <SAMPLE_MESSAGE xmlns="http://www.forensic.gov.uk/eMessages/Pnclink/NDNA" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.forensic.gov.uk/eMessages/Pnclink/NDNA http://www.forensic.gov.uk/eMessages/Pnclink/NDNA/Test.xsd">
    <MESSAGE_HEADER>
    <MESSAGE_NUMBER>2147483647</MESSAGE_NUMBER>
    <MESSAGE_TYPE>CT</MESSAGE_TYPE>
    <MESSAGE_DATE>2001-12-17T09:30:47</MESSAGE_DATE>
    </MESSAGE_HEADER>
    </SAMPLE_MESSAGE>
    where msg_id = 8
    and I get the error:
    ORA-30937: No schema definition for 'MESSAGE_NUMBER' (namespace 'http://www.forensic.gov.uk/eMessages/Pnclink/NDNA') in parent 'MESSAGE_HEADER'
    ORA-06512: at "SYS.XMLTYPE", line 0
    ORA-06512: at line 27
    But if I remove the MESSAGE_NUMBER I get
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00213: only 0 occurrences of particle "MESSAGE_NUMBER", minimum is 1
    ORA-06512: at "SYS.XMLTYPE", line 0
    ORA-06512: at line 37
    So it knows there is supposed to be a particle called message_number if it's not there, but not what to do with it if it is.
    One other thing, which I think is significant: If I amend my test.xsd schema so I define MESSAGE_HEADER there, so the only thing being referenced from testinclude.xsd is the SIMPLE type "MessageTypeType", I don't have a problem. It seems to be only when I include COMPLEX types.
    Any suggestions?

    Dave
    I can't register the XML Schemas with XML DB, since we do think versionfiltered is a valid attribute for a schema element...
    SQL> declare
      2    res boolean;
      3    xmlSchema xmlType := xmlType(
      4  '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" versionfilt
    ered="1-00" id="NDNASimpleTypes">
      5
      6          <xsd:complexType name="MessageHeaderType">
      7                  <xsd:sequence>
      8                          <xsd:element name="MESSAGE_NUMBER" type="xsd:long"/>
      9                          <xsd:element name="MESSAGE_TYPE" type="MessageTypeType"/>
    10                          <xsd:element name="MESSAGE_DATE" type="xsd:dateTime"/>
    11                  </xsd:sequence>
    12          </xsd:complexType>
    13          <xsd:simpleType name="MessageTypeType">
    14                  <xsd:annotation>
    15                          <xsd:documentation>The definition of the Sample Message Types</xsd:documentation>
    16                  </xsd:annotation>
    17                  <xsd:restriction base="xsd:string">
    18                          <xsd:maxLength value="2"/>
    19                          <xsd:enumeration value="CT"/>
    20                          <xsd:enumeration value="CA"/>
    21                          <xsd:enumeration value="CD"/>
    22                  </xsd:restriction>
    23          </xsd:simpleType>
    24  </xsd:schema>');
    25  begin
    26    if (dbms_xdb.existsResource(:schemaPath)) then
    27      dbms_xdb.deleteResource(:schemaPath);
    28    end if;
    29    res := dbms_xdb.createResource(:schemaPath,xmlSchema);
    30  end;
    31  /
    Queuing DELETE Event
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.04
    SQL> begin
      2    dbms_xmlschema.registerSchema
      3    (
      4      :schemaURL,
      5      xdbURIType(:schemaPath).getClob(),
      6      TRUE,TRUE,FALSE,TRUE
      7    );
      8  end;
      9  /
    begin
    ERROR at line 1:
    ORA-30937: No schema definition for 'versionfiltered' (namespace '##local') in parent '/schema'
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 20
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 31
    ORA-06512: at line 2XMLSPY agrees with us on this...
    If I change version filtered to version I get
    SQL> var schemaURL varchar2(256)
    SQL> var schemaPath varchar2(256)
    SQL> --
    SQL> begin
      2    :schemaURL := 'http://www.forensic.gov.uk/eMessages/Pnclink/NDNA/testinclude.xsd';
      3    :schemaPath := '/public/testinclude.xsd';
      4  end;
      5  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    SQL> call dbms_xmlSchema.deleteSchema(:schemaURL,4)
      2  /
    Queuing DELETE Event
    Call completed.
    Elapsed: 00:00:00.07
    SQL> declare
      2    res boolean;
      3    xmlSchema xmlType := xmlType(
      4  '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1-
    00" id="NDNASimpleTypes">
      5
      6          <xsd:complexType name="MessageHeaderType">
      7                  <xsd:sequence>
      8                          <xsd:element name="MESSAGE_NUMBER" type="xsd:long"/>
      9                          <xsd:element name="MESSAGE_TYPE" type="MessageTypeType"/>
    10                          <xsd:element name="MESSAGE_DATE" type="xsd:dateTime"/>
    11                  </xsd:sequence>
    12          </xsd:complexType>
    13          <xsd:simpleType name="MessageTypeType">
    14                  <xsd:annotation>
    15                          <xsd:documentation>The definition of the Sample Message Types</xsd:documentation>
    16                  </xsd:annotation>
    17                  <xsd:restriction base="xsd:string">
    18                          <xsd:maxLength value="2"/>
    19                          <xsd:enumeration value="CT"/>
    20                          <xsd:enumeration value="CA"/>
    21                          <xsd:enumeration value="CD"/>
    22                  </xsd:restriction>
    23          </xsd:simpleType>
    24  </xsd:schema>');
    25  begin
    26    if (dbms_xdb.existsResource(:schemaPath)) then
    27      dbms_xdb.deleteResource(:schemaPath);
    28    end if;
    29    res := dbms_xdb.createResource(:schemaPath,xmlSchema);
    30  end;
    31  /
    Queuing DELETE Event
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.04
    SQL> begin
      2    dbms_xmlschema.registerSchema
      3    (
      4      :schemaURL,
      5      xdbURIType(:schemaPath).getClob(),
      6      TRUE,TRUE,FALSE,TRUE
      7    );
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.20
    SQL> begin
      2    :schemaURL := 'http://www.forensic.gov.uk/eMessages/Pnclink/NDNA/Test.xsd';
      3    :schemaPath := '/public/Test.xsd';
      4  end;
      5  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.01
    SQL> call dbms_xmlSchema.deleteSchema(:schemaURL,4)
      2  /
    Queuing DELETE Event
    Call completed.
    Elapsed: 00:00:00.06
    SQL> declare
      2    res boolean;
      3    xmlSchema xmlType := xmlType(
      4  '<xsd:schema xmlns="http://www.forensic.gov.uk/eMessages/Pnclink/NDNA" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="ht
    tp://www.forensic.gov.uk/eMessages/Pnclink/NDNA" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0" id="Test">
      5
      6          <xsd:include schemaLocation="http://www.forensic.gov.uk/eMessages/Pnclink/NDNA/testinclude.xsd"/>
      7        <xsd:element name="SAMPLE_MESSAGE">
      8                  <xsd:complexType>
      9                          <xsd:sequence>
    10                                  <xsd:element name="MESSAGE_HEADER" type="MessageHeaderType"/>
    11                          </xsd:sequence>
    12                  </xsd:complexType>
    13          </xsd:element>
    14    </xsd:schema>');
    15  begin
    16    if (dbms_xdb.existsResource(:schemaPath)) then
    17      dbms_xdb.deleteResource(:schemaPath);
    18    end if;
    19    res := dbms_xdb.createResource(:schemaPath,xmlSchema);
    20  end;
    21  /
    Queuing DELETE Event
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.04
    SQL> begin
      2    dbms_xmlschema.registerSchema
      3    (
      4      :schemaURL,
      5      xdbURIType(:schemaPath).getClob(),
      6      TRUE,TRUE,FALSE,FALSE
      7    );
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.14
    SQL> var xmltext varchar2(4000)
    SQL> --
    SQL> begin
      2    :xmltext :=
      3  '<SAMPLE_MESSAGE xmlns="http://www.forensic.gov.uk/eMessages/Pnclink/NDNA" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:sc
    hemaLocation="http://www.forensic.gov.uk/eMessages/Pnclink/NDNA http://www.forensic.gov.uk/eMessages/Pnclink/NDNA/Test.xsd">
      4     <MESSAGE_HEADER>
      5        <MESSAGE_NUMBER>2147483647</MESSAGE_NUMBER>
      6        <MESSAGE_TYPE>CT</MESSAGE_TYPE>
      7        <MESSAGE_DATE>2001-12-17T09:30:47</MESSAGE_DATE>
      8     </MESSAGE_HEADER>
      9  </SAMPLE_MESSAGE>';
    10  end;
    11  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.01
    SQL> drop table xml_in
      2  /
    Table dropped.
    Elapsed: 00:00:00.04
    SQL> create table xml_in
      2  (
      3    msg_id   number(4),
      4    xml_data xmltype
      5  )
      6  /
    Table created.
    Elapsed: 00:00:00.03
    SQL> insert into xml_in values ( 8, xmltype ('<FOO/>'))
      2  /
    1 row created.
    Elapsed: 00:00:00.01
    SQL> declare
      2    xmldata xmltype;
      3  begin
      4    xmldata := xmltype(:xmltext);
      5    xmldata.schemaValidate();
      6  end;
      7  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.09
    SQL> update xml_in
      2     set xml_data = xmltype ( :xmltext )
      3   where msg_id = 8
      4  /
    1 row updated.
    Elapsed: 00:00:00.01
    SQL> select * from xml_in
      2  /
        MSG_ID
    XML_DATA
             8
    <SAMPLE_MESSAGE xmlns="http://www.forensic.gov.uk/eMessages/Pnclink/NDNA" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLo
    cation="ht
    tp://www.forensic.gov.uk/eMessages/Pnclink/NDNA http://www.forensic.gov.uk/eMessages/Pnclink/NDNA/Test.xsd">
      <MESSAGE_HEADER>
        <MESSAGE_NUMBER>2147483647</MESSAGE_NUMBER>
        <MESSAGE_TYPE>CT</MESSAGE_TYPE>
        <MESSAGE_DATE>2001-12-17T09:30:47</MESSAGE_DATE>
      </MESSAGE_HEADER>
    </SAMPLE_MESSAGE>
    Elapsed: 00:00:00.06
    SQL>

  • XML validation gives ORA-30937

    Hi,
    Could some one look at this as I am getting ORA-30937 while validating XML with a registered schema.
    Thanks in advance.
    Parappa
    SQL> DECLARE
    2 doc varchar2(3800) :=
    3 '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    4 <xs:schema targetNamespace="http://ibtco.com/common/exception/stack" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:stack="http://ibtco.com/common/exception/stack" elementFormDefault="qualified" attributeFormDefault="unqualified">
    5 <xs:complexType name="StackTextType">
    6 <xs:annotation>
    7 <xs:documentation>
    8 for holding the string information in exception
    9 </xs:documentation>
    10 </xs:annotation>
    11 <xs:simpleContent>
    12 <xs:extension base="xs:string"/>
    13 </xs:simpleContent>
    14 </xs:complexType>
    15 <xs:complexType name="StackElementType">
    16 <xs:annotation>
    17 <xs:documentation>
    18 for holding detail information in each stack element
    19 </xs:documentation>
    20 </xs:annotation>
    21 <xs:attribute name="Class" type="xs:Name" use="required"/>
    22 <xs:attribute name="Method" type="xs:Name" use="required"/>
    23 <xs:attribute name="LineNumber" type="xs:unsignedInt" use="required"/>
    24 <xs:attribute name="File" type="xs:Name" use="optional"/>
    25 <xs:attribute name="Native" type="xs:boolean" use="optional" default="false"/>
    26 </xs:complexType>
    27 <xs:complexType name="StackDetailType">
    28 <xs:annotation>
    29 <xs:documentation>
    30 for holding information in the stack trace
    31 </xs:documentation>
    32 </xs:annotation>
    33 <xs:sequence>
    34 <xs:element name="Element" type="stack:StackElementType" maxOccurs="unbounded"/>
    35 </xs:sequence>
    36 <xs:attribute name="Truncate" type="xs:boolean" use="optional" default="false"/>
    37 </xs:complexType>
    38 <xs:complexType name="RootExceptionType">
    39 <xs:annotation>
    40 <xs:documentation>
    41 for holding the stack trace information for each exception
    42 </xs:documentation>
    43 </xs:annotation>
    44 <xs:sequence>
    45 <xs:element name="Message" type="xs:string"/>
    46 <xs:choice>
    47 <xs:element name="StackDetail" type="stack:StackDetailType"/>
    48 <xs:element name="StackText" type="stack:StackTextType"/>
    49 </xs:choice>
    50 </xs:sequence>
    51 <xs:attribute name="Type" type="xs:NCName" use="required"/>
    52 </xs:complexType>
    53 <xs:complexType name="WrapperExceptionType">
    54 <xs:annotation>
    55 <xs:documentation>
    56 for defining top level element for exception stack
    57 </xs:documentation>
    58 </xs:annotation>
    59 <xs:sequence>
    60 <xs:element name="Message" type="xs:string"/>
    61 </xs:sequence>
    62 <xs:attribute name="Type" type="xs:NCName" use="required"/>
    63 </xs:complexType>
    64 <xs:element name="ExceptionStack">
    65 <xs:annotation>
    66 <xs:documentation>
    67 top level element exception stack
    68 </xs:documentation>
    69 </xs:annotation>
    70 <xs:complexType>
    71 <xs:sequence>
    72 <xs:element name="RootException" type="stack:RootExceptionType"/>
    73 <xs:element name="WrapperException" type="stack:WrapperExceptionType" minOccurs="0" maxOccurs="unbounded"/>
    74 </xs:sequence>
    75 </xs:complexType>
    76 </xs:element>
    77 </xs:schema>';
    78 BEGIN
    79 dbms_xmlschema.registerSchema('http://ibtco.com/common/exception/stack', doc);
    80 END;
    81 /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.07
    SQL> DECLARE
    2
    3 l_errormsgid VARCHAR2(30);
    4 l_errorinfo VARCHAR2(100);
    5 l_error_context CLOB; -- Error Stack
    6 l_error_context_data CLOB; -- XML Context
    7 l_var_xml_context VARCHAR2(4000);
    8 l_var_error_stack VARCHAR2(4000);
    9 l_sqlCode UTL_ERROR_LOGS.ERROR_CODE%TYPE;
    10 p_ErrorMsgId NUMBER := '0';
    11 p_ErrorInfo VARCHAR2(2000):= 'SUCCESS';
    12 l_xml_context SYS.XMLTYPE;
    13 l_count number :=0;
    14 l_ret NUMBER;
    15 BEGIN
    16
    17
    18
    19 -- Store XML in a clob
    20
    21 l_var_error_stack :=
    22 '<?xml version="1.0" encoding="UTF-8"?>
    23 <!--Sample XML file generated by XMLSpy v2005 sp1 U (http://www.xmlspy.com)-->
    24 <ExceptionStack
    25 xmlns="http://ibtco.com/common/exception/stack"
    26 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    27 xsi:schemaLocation="http://ibtco.com/common/exception/stack
    28 http://ibtco.com/common/exception/stack"
    29 >
    30 <Exception Type="RootCauseException">
    31 <Message>Exception Message</Message>
    32 <StackDetail Truncate="false">
    33 <Element LineNumber="0" File="Exception.java" Class="com.ibtco.common.exception.ExceptionManager" Method="manage" Native="false"/>
    34 <Element LineNumber="0" File="Exception.java" Class="com.ibtco.common.exception.ExceptionHandler" Method="handle" Native="false"/>
    35 <Element LineNumber="0" File="Exception.java" Class="com.ibtco.common.exception.Exception" Method="throw" Native="false"/>
    36 </StackDetail>
    37 </Exception>
    38 <Cause Type="WrappedException">
    39 <Message>String</Message>
    40 <StackDetail/>
    41 </Cause>
    42 <Cause Type="AnotherWrappedException">
    43 <Message>String</Message>
    44 <StackDetail/>
    45 </Cause>
    46 </ExceptionStack>';
    47
    48 DBMS_LOB.CREATETEMPORARY
    49 (
    50 lob_loc => l_error_context,
    51 cache => TRUE
    52 );
    53
    54 DBMS_LOB.WRITE
    55 (
    56 lob_loc =>l_error_context,
    57 amount => length(l_var_error_stack),
    58 offset => 1,
    59 buffer => l_var_error_stack
    60 );
    61
    62 l_xml_context := XMLTYPE(l_error_context);
    63
    64
    65 -- validate against XML schema
    66 --l_xml_context.schemavalidate();
    67 l_ret := l_xml_context.isschemavalid('http://ibtco.com/common/exception/stack');
    68 IF l_ret = 1 then
    69 dbms_output.put_line('Data is valid:' || l_ret );
    70 ELSE
    71 dbms_output.put_line('Data is invalid:' || l_ret);
    72 END IF;
    73 END;
    74 /
    DECLARE
    ERROR at line 1:
    ORA-30937: No schema definition for 'Exception' (namespace 'http://ibtco.com/common/exception/stack') in parent 'ExceptionStack'
    ORA-06512: at "SYS.XMLTYPE", line 348
    ORA-06512: at line 67
    Elapsed: 00:00:00.00
    SQL>
    Here are the actual scripts:
    DECLARE
    doc varchar2(3800) :=
    '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <xs:schema targetNamespace="http://ibtco.com/common/exception/stack" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:stack="http://ibtco.com/common/exception/stack" elementFormDefault="qualified" attributeFormDefault="unqualified">
         <xs:complexType name="StackTextType">
              <xs:annotation>
                   <xs:documentation>
                        for holding the string information in exception
                   </xs:documentation>
              </xs:annotation>
              <xs:simpleContent>
                   <xs:extension base="xs:string"/>
              </xs:simpleContent>
         </xs:complexType>
         <xs:complexType name="StackElementType">
              <xs:annotation>
                   <xs:documentation>
                        for holding detail information in each stack element
                   </xs:documentation>
              </xs:annotation>
              <xs:attribute name="Class" type="xs:Name" use="required"/>
              <xs:attribute name="Method" type="xs:Name" use="required"/>
              <xs:attribute name="LineNumber" type="xs:unsignedInt" use="required"/>
              <xs:attribute name="File" type="xs:Name" use="optional"/>
              <xs:attribute name="Native" type="xs:boolean" use="optional" default="false"/>
         </xs:complexType>
         <xs:complexType name="StackDetailType">
              <xs:annotation>
                   <xs:documentation>
                        for holding information in the stack trace
                   </xs:documentation>
              </xs:annotation>
              <xs:sequence>
                   <xs:element name="Element" type="stack:StackElementType" maxOccurs="unbounded"/>
              </xs:sequence>
              <xs:attribute name="Truncate" type="xs:boolean" use="optional" default="false"/>
         </xs:complexType>
         <xs:complexType name="RootExceptionType">
              <xs:annotation>
                   <xs:documentation>
                        for holding the stack trace information for each exception
                   </xs:documentation>
              </xs:annotation>
              <xs:sequence>
                   <xs:element name="Message" type="xs:string"/>
                   <xs:choice>
                        <xs:element name="StackDetail" type="stack:StackDetailType"/>
                        <xs:element name="StackText" type="stack:StackTextType"/>
                   </xs:choice>
              </xs:sequence>
              <xs:attribute name="Type" type="xs:NCName" use="required"/>
         </xs:complexType>
         <xs:complexType name="WrapperExceptionType">
              <xs:annotation>
                   <xs:documentation>
                        for defining top level element for exception stack
                   </xs:documentation>
              </xs:annotation>
              <xs:sequence>
                   <xs:element name="Message" type="xs:string"/>
              </xs:sequence>
              <xs:attribute name="Type" type="xs:NCName" use="required"/>
         </xs:complexType>
         <xs:element name="ExceptionStack">
              <xs:annotation>
                   <xs:documentation>
                        top level element exception stack
                   </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="RootException" type="stack:RootExceptionType"/>
                        <xs:element name="WrapperException" type="stack:WrapperExceptionType" minOccurs="0" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
    </xs:schema>';
    BEGIN
    dbms_xmlschema.registerSchema('http://ibtco.com/common/exception/stack', doc);
    END;
    -- Validate Error Stack XML
    DECLARE
         l_errormsgid VARCHAR2(30);
         l_errorinfo VARCHAR2(100);
         l_error_context          CLOB; -- Error Stack
         l_error_context_data     CLOB;     -- XML Context
         l_var_xml_context     VARCHAR2(4000);
         l_var_error_stack     VARCHAR2(4000);
         l_sqlCode          UTL_ERROR_LOGS.ERROR_CODE%TYPE;
         p_ErrorMsgId NUMBER := '0';
         p_ErrorInfo VARCHAR2(2000):= 'SUCCESS';
         l_xml_context SYS.XMLTYPE;
         l_count number :=0;
    l_ret     NUMBER;
    BEGIN
         -- Store XML in a clob
         l_var_error_stack :=
    '<?xml version="1.0" encoding="UTF-8"?>
    <!--Sample XML file generated by XMLSpy v2005 sp1 U (http://www.xmlspy.com)-->
    <ExceptionStack
    xmlns="http://ibtco.com/common/exception/stack"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://ibtco.com/common/exception/stack
    http://ibtco.com/common/exception/stack"
    >
    <Exception Type="RootCauseException">
    <Message>Exception Message</Message>
    <StackDetail Truncate="false">
    <Element LineNumber="0" File="Exception.java" Class="com.ibtco.common.exception.ExceptionManager" Method="manage" Native="false"/>
    <Element LineNumber="0" File="Exception.java" Class="com.ibtco.common.exception.ExceptionHandler" Method="handle" Native="false"/>
    <Element LineNumber="0" File="Exception.java" Class="com.ibtco.common.exception.Exception" Method="throw" Native="false"/>
    </StackDetail>
    </Exception>
    <Cause Type="WrappedException">
    <Message>String</Message>
    <StackDetail/>
    </Cause>
    <Cause Type="AnotherWrappedException">
    <Message>String</Message>
    <StackDetail/>
    </Cause>
    </ExceptionStack>';
         DBMS_LOB.CREATETEMPORARY
    lob_loc => l_error_context,
    cache => TRUE
         DBMS_LOB.WRITE
         lob_loc =>l_error_context,
         amount => length(l_var_error_stack),
         offset => 1,
         buffer => l_var_error_stack
         l_xml_context := XMLTYPE(l_error_context);
         -- validate against XML schema
         --l_xml_context.schemavalidate();
         l_ret := l_xml_context.isschemavalid('http://ibtco.com/common/exception/stack');
         IF l_ret = 1 then
              dbms_output.put_line('Data is valid:' || l_ret );
         ELSE
              dbms_output.put_line('Data is invalid:' || l_ret);
         END IF;
    END;
    /

    You schema definition goes like this:
    <xs:element name="ExceptionStack">
    <xs:annotation>
    <xs:documentation>
    top level element exception stack
    </xs:documentation>
    </xs:annotation>
    <xs:complexType>
    <xs:sequence>
    <xs:element name="RootException" type="stack:RootExceptionType"/>
    <xs:element name="WrapperException" type="stack:WrapperExceptionType" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>and your document goes like this:
    <ExceptionStack
    xmlns="http://ibtco.com/common/exception/stack"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://ibtco.com/common/exception/stack
    http://ibtco.com/common/exception/stack"
    >
    <Exception Type="RootCauseException">
    <Message>Exception Message</Message>
    <StackDetail Truncate="false">
    .In your schema definition, you have not defined the element named "Exception" or element named "Cause", but are using it in your document. You need to fix either the schema definition or the document to make them consistent.
    Message was edited by:
    Kamal Kishore

  • How to define namespace with one XSD using in two different DB-Locations ?

    I'm not clear,How to define namespace, targetnamespace, schemaLocation or NoNamespaceSchemaLocation
    when using one common schema.xsd-definition
    in two different database-locations for exchange xml-documents?
    when insert xml-document I've got an error ORA-30937
    do you have an good exsample ?
    thanks
    Norbert
    schema :
    <xs:schema
    xmlns="http://sourcehost.com/namespace"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:oraxdb="http://xmlns.oracle.com/xdb"
    targetNamespace="http://sourcehost.com/namespace"
    xml-document :
    xmlns="http://Sourcehost.com/namespace"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:SchemaLocation="http://sourcehost.com/namespace http://desthost:8080/sys/schemas/PUBLIC/ADRESSEN.XSD">
    SQL> insert into ADRESSEN values
    (XMLType
    (bfilename ( 'XMLIMPORT_DIR', 'adressen.xml')
    , 0 )
    --> error :
    ORA-30937: No Schemadefinition for "SchemaLocation" (Namespace "http://www.w3.org/2001/XMLSchema-instance") in übergeordnetem Knoten "/ADRESSEN"

    Norbert
    The schema location used to register the XML schema with XML DB does not need to be a valid URL for accessing the XML Schema
    I can use the same URL , for instance
    http://xmlns.example.scom/xsd/myXMLSchema.xsd
    on machines dbserver1, and dbserver2. The only reason some people choose to use the hostname / portnumber convention is that this makes it possible to validate the XML Instance documents against the copy of the XML schema stored in the XML DB repository using an external tool like XMLSpy without have to add entries to XMLSpy's OASIS catalog files.
    I am concerned about the message you are getting. That's not correct AFAICT but I'd need to see the complete XML Schema and Instance to be sure.

  • Error while registering xsd and inserting xml

    1) while inserting it is mentioning , no schema definition available for citeinfo
    2) while registering it is mentioning, with changes that i have made that it is not valid xdb schema
    how to register the xsd schema correctly.?
    SQL> desc register2;
    Name Null? Type
    TABLE of SYS.XMLTYPE(XMLSchema "fgdc-std-001-19981.xsd" Element "metadata") STORAGE Object-relationa
    SQL> alter session set events ='31156 trace name context forever, level 2'
    2 /
    Session altered.
    SQL> INSERT INTO register2
    2 VALUES (XMLType(bfilename('XMLDIR','metadata.xml'),
    3 nls_charset_id('AL32UTF8')));
    INSERT INTO register2
    ERROR at line 1:
    ORA-30937: No schema definition for 'citeinfo' (namespace '##local') in parent
    '/metadata/idinfo'
    SQL> BEGIN
    2 DBMS_XMLSCHEMA.registerSchema(
    3 SCHEMAURL => 'fgdc-std-001-199812.xsd',
    4 SCHEMADOC => bfilename('XMLDIR','fgdc-std-001-199812.xsd'),
    5 CSID => nls_charset_id('AL32UTF8'));
    6 END;
    7 /
    BEGIN
    ERROR at line 1:
    ORA-31000: Resource 'fgdc-std-001-1998-sect012.xsd' is not an XDB schema
    document
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 37
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 61
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 126
    ORA-06512: at line 2
    this is the xsd document
    <?xml version="1.0" encoding="utf-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" blockDefault="#all">
    <xsd:element name="idinfo" type="idinfoType"/>
    <xsd:complexType name="idinfoType">
         <xsd:sequence>
              <xsd:element ref="citeinfo"/>
              <xsd:element ref="descript"/>
              <xsd:element ref="timeperd"/>
              <xsd:element ref="status"/>
              <xsd:element ref="spdom"/>
              <xsd:element ref="keywords"/>
              <xsd:element ref="accconst"/>
              <xsd:element ref="useconst"/>
              <xsd:element ref="ptcontac" minOccurs="0"/>
              <xsd:element ref="browse" minOccurs="0" maxOccurs="unbounded"/>
              <xsd:element ref="datacred" minOccurs="0"/>
              <xsd:element ref="secinfo" minOccurs="0"/>
              <xsd:element ref="native" minOccurs="0"/>
         </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="citeinfo" type="citeinfoType">
    <xsd:complexType name="citeinfoType">
    <xsd:sequence>
    <xsd:element ref="origin">
         <xsd:element ref="pubdate">
         <xsd:element ref="pubtime">
         <xsd:element ref="title">
    <xsd:element ref="edition">
         <xsd:element ref="geoform">
    </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="origin" type="originType"/>
    <xsd:simpleType name="originType">
         <xsd:restriction base="xsd:string"/>
    </xsd:simpleType>
    <xsd:element name="pubdate" type="pubdateType"/>
    <xsd:simpleType name="pubdateType">
         <xsd:restriction base="xsd:date"/>
    </xsd:simpleType>
    <xsd:element name="pubtime" type="pubtimeType"/>
    <xsd:simpleType name="pubtimeType">
         <xsd:restriction base="xsd:time"/>
    </xsd:simpleType>
    <xsd:element name="title" type="titleType"/>
    <xsd:simpleType name="titleType">
         <xsd:restriction base="xsd:string"/>
    </xsd:simpleType>
    <xsd:element name="edition" type="editionType"/>
    <xsd:simpleType name="editionType">
         <xsd:restriction base="xsd:double"/>
    </xsd:simpleType>
    <xsd:element name="geoform" type="geoformType"/>
    <xsd:simpleType name="geoformType">
         <xsd:restriction base="xsd:string"/>
    </xsd:simpleType>
    <xsd:element name="descript" type="descriptType"/>
    <xsd:complexType name="descriptType">
         <xsd:sequence>
              <xsd:element ref="abstract"/>
              <xsd:element ref="purpose"/>
              <xsd:element ref="supplinf" minOccurs="0"/>
         </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="abstract" type="abstractType"/>
    <xsd:simpleType name="abstractType">
         <xsd:restriction base="xsd:string"/>
    </xsd:simpleType>
    this is the xml document
    <?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE metadata SYSTEM "http://www.fgdc.gov/metadata/fgdc-std-001-1998.dtd"><metadata>
    <idinfo>
    <citation>
    <citeinfo>
    <origin>Jiohn</origin>
    <pubdate>Unknown</pubdate>
    <pubtime>Unknown</pubtime>
    <title>isolation_valve</title>
    <edition>we</edition>
    <geoform>vector digital data</geoform>
    <serinfo>
    <sername>trial</sername>
    <issue>akls</issue>
    </serinfo>
    <pubinfo>
    <pubplace>india</pubplace>
    <publish>rolta</publish>
    </pubinfo>
    <othercit>afdf</othercit>
    <onlink>\\gedora09\prfd\3.Input\O&amp;M\15Feb10\Rolta O&amp;M Data\103 shape files updated on 12.01.2009\Points\isolation_valve.shp</onlink>
    <lworkcit>
    <citeinfo>
    <origin>aedf</origin>
    <pubdate>20041203</pubdate>
    <pubtime>00290055</pubtime>
    <title>test xml</title>
    <edition>ert</edition>
    <geoform>audio</geoform>
    <onlink>ad</onlink>
    </citeinfo>
    </lworkcit>
    </citeinfo>
    </citation>
    <descript>
    <abstract>asdf</abstract>
    <purpose>asdf</purpose>
    <supplinf>werty</supplinf>
    </descript>
    <timeperd>
    <timeinfo>

    "Events" are not there just for fun - they have a purpose. Most of the time they should only be used when asked by Oracle support or when you know what you are doing...
    I assume you aren't using 11gR2 as suggested by Mark in an earlier thread...?

  • Registering a schema

    Help Please
    I am currently in the process of building a xml schema in a 10g release 2 DB and I am having trouble registering a schema
    here is a summary of what I have done
    SQL> BEGIN
    2
    3 DBMS_XMLSCHEMA.registerSchema('http://schemas.xmlsoap.org/wsdl/',
    4 XDBURIType('/sys/schemas/PUBLIC/SOAP.wsdl').getClob(),
    5 TRUE,
    6 TRUE,
    7 FALSE,
    8 TRUE);
    9 END;
    10 /
    SQL> BEGIN
    2
    3 DBMS_XMLSCHEMA.registerSchema('http://schemas.xmlsoap.org/wsdl/',
    4 XDBURIType('/sys/schemas/PUBLIC/SOAP.wsdl').getClob(),
    5 TRUE,
    6 TRUE,
    7 FALSE,
    8 TRUE);
    9 END;
    10 /
    SQL> BEGIN
    2
    3 DBMS_XMLSCHEMA.registerSchema('http://com/link/xml/XmlLink.wsdl',
    4 XDBURIType('/sys/schemas/PUBLIC/xml-link.wsdl').getClob(),
    5 TRUE,
    6 TRUE,
    7 FALSE,
    8 TRUE);
    9 END;
    10 /
    BEGIN
    ERROR at line 1:
    ORA-30937: No schema definition for 'definitions' (namespace
    'http://schemas.xmlsoap.org/wsdl/') in parent '/'
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 20
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 31
    ORA-06512: at line 3
    The header fragment of the XML I am registering is
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <!--Generated by the Oracle JDeveloper 10g Web Services WSDL Generator-->
    <!--Date Created: Wed Aug 30 12:02:11 BST 2006-->
    <definitions
    name="XmlLinkWS"
    targetNamespace="http://com/link/xml/XmlLink.wsdl"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:tns="http://com/link/xml/XmlLink.wsdl"
    xmlns:ns1="http://com.link.xml/IXmlLinkWS.xsd">
    <types>
    <schema
    targetNamespace="http://com.link.xml/IXmlLinkWS.xsd"
    xmlns="http://www.w3.org/2001/XMLSchema"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
    Am I missing a Vital step?
    Thanks in advance for any help
    A

    Validate your xml schema for instance with XMLSpy or for instance an XML Schema validator as shown here: http://www.w3.org/2001/03/webdata/xsv
    Example annotations regarding WSDL can be found here (regarding "definitions name"): http://www.w3.org/2001/03/14-annotated-WSDL-examples.html. Looking at the examples, shouldn't it therefore be:
    <wsdl:definitions name="XmlLinkWS"Message was edited by:
    mgralike

  • Sqlldr errors loading XML file

    I am getting two errors on two different data elements trying to load an XML file. DB version is 11.2.0.2.0 - 64bit.
    This is part of the instance file:
    <?xml version="1.0" encoding="utf-8"?>
    <SamseAMSS xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://SAMSE-AMSS.org/namespace">
    <FileInfo>
    <AviationUIC>
    <OrigUnit>
    <UIC>WV7PB0</UIC>
    <UnitName>B TRP 1-230TH ACS</UnitName>
    <OrgLocCde>A</OrgLocCde>
    <DPICode>Need LOGSA DPICode</DPICode>
    <IsReporter>true</IsReporter>
    <UnitPOC />
    <POCNbr>(865)985-4634</POCNbr>
    <POCEmail />
    </OrigUnit>
    <AMSSUtilCde>
    <UtilCde>0</UtilCde>
    <Summary>
    <EIC>ROC</EIC>
    *<MDS xsi:type="xsd:string">OH-58D</MDS>*
    *<Model>OH-58D</Model>*
    <QtyAuth>6</QtyAuth>
    <QtyOH>6</QtyOH>
    <RptTimeCde>H</RptTimeCde>
    </Summary>
    </AMSSUtilCde>
    </AviationUIC>
    The problem is with the MDS and Model elements.
    This is part of the schema:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns="http://SAMSE-AMSS.org/namespace" xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb"
    targetNamespace="http://SAMSE-AMSS.org/namespace"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:smse="http://samsecommon.xsd/namespace"
    elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xsd:import namespace="http://samsecommon.xsd/namespace" schemaLocation="samsecommon.xsd"/>
    <xs:element name="SamseAMSS" xdb:defaultTable="SAMSEAMSS">
    <xs:sequence>
    <xs:element name="FileInfo" smse:type="SamseFileInfoType"/>
    <xs:element name="AviationUIC" maxOccurs="unbounded">
    <xs:annotation>
    <xs:documentation>1 element for each UIC being reported</xs:documentation>
    </xs:annotation>
    <xs:complexType xdb:SQLType="AMSSUIC_T">
    <xs:sequence>
    <xs:element name="AMSSUtilCde" minOccurs="0" maxOccurs="unbounded">
    <xs:annotation>
    <xs:documentation>1 element for each UtilCde being reported for this UIC</xs:documentation>
    </xs:annotation>
    <xs:complexType xdb:SQLType="AMSSUTILCDE_T">
    <xs:sequence>
    <xs:element name="UtilCde">
    <xs:annotation>
    <xs:documentation>Key Field</xs:documentation>
    </xs:annotation>
    <xs:simpleType>
    <xs:restriction base="xs:token">
    <xs:length value="1"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="Summary" maxOccurs="unbounded">
    <xs:annotation>
    <xs:documentation>1 element per type of equipment (by EIC / PrimeEIC) authorized for this UIC -- always sent every time.</xs:documentation>
    </xs:annotation>
    <xs:complexType xdb:SQLType="SUMMARY_T">
    <xs:sequence>
    <xs:element name="EIC" minOccurs="0" smse:type="EICType">
    <xs:annotation>
    <xs:documentation>Key Field</xs:documentation>
    </xs:annotation>
    </xs:element>
    *<MDS xsi:type="xsd:string">OH-58D</MDS>*
    *<Model>OH-58D</Model>*
                   <xs:element name="PrimeEIC" minOccurs="0" smse:type="EICType" nillable="true">
    <xs:annotation>
    <xs:documentation>Key Field</xs:documentation>
    </xs:annotation>
    </xs:element>
    <xs:element name="QtyAuth" type="xs:unsignedShort"/>
    First, it doesn't recognize the "Model" data element that is defined in the schema:
    Record 3: Rejected - Error on table SAMSEAMSS.
    ORA-30937: No schema definition for 'Model' (namespace 'http://SAMSE-AMSS.org/namespace') in parent '/SamseAMSS/AviationUIC[1]/AMSSUtilCde[1]/Summary[1]'
    If I remove the Model from the instance file and try to load, it does not recognize the xsi:type in the MDS element. I also tried using xsi:type in the schema definition.
    Record 1: Rejected - Error on table SAMSEAMSS.
    ORA-31079: unable to resolve reference to type "string"
    If I change xsi:type to xsd:type it loads with no errors. However we don't control the incoming XML files so it needs to load with xsi:type.
    Thanks for your help.

    Whoops no I didn't put that in the schema definition! This is the part with those elements:
    <xs:complexType xdb:SQLType="AMSSUTILCDE_T">
    <xs:sequence>
    <xs:element name="UtilCde">
    <xs:annotation>
    <xs:documentation>Key Field</xs:documentation>
    </xs:annotation>
    <xs:simpleType>
    <xs:restriction base="xs:token">
    <xs:length value="1"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="Summary" maxOccurs="unbounded">
    <xs:annotation>
    <xs:documentation>1 element per type of equipment (by EIC / PrimeEIC) authorized for this UIC -- always sent every time.</xs:documentation>
    </xs:annotation>
    <xs:complexType xdb:SQLType="SUMMARY_T">
    <xs:sequence>
    <xs:element name="EIC" smse:type="EICType">
    <xs:annotation>
    <xs:documentation>Key Field</xs:documentation>
    </xs:annotation>
    </xs:element>
                   *<xs:element name="MDS" minOccurs="0" type="xsd:string"/>*
                   *<xs:element name="Model" minOccurs="0" type="xsd:string"/>*
                   <xs:element name="PrimeEIC" smse:type="EICType" nillable="true">
    <xs:annotation>
    <xs:documentation>Key Field</xs:documentation>
    </xs:annotation>
    </xs:element>
    Thanks.
    Edited by: user4109719 on Jun 12, 2012 6:32 AM Put correct Model definition
    Edited by: user4109719 on Jun 12, 2012 6:37 AM

  • Converting to a new version of a complextype

    Hello
    I have two versions of the contentOrganizationType complex type which are declared in separate locations.
    And I have one record in a xmltype-table which includes an instance of the first version (v1.0) of the contentOrganizationType which is defined in the "oebs_content_organization_element.xsd".
    And I try to convert this instance to the second version (v2.0) by the next transformation:
    DECLARE buf xmltype;
    BEGIN
    select
    xmltype(
    replace(
    replace(
    REPLACE(
    (xmltransform(
    extract(OBJECT_VALUE, '/oebs:root/c:content[@xsi:schemaLocation="http://www.rosbank.ru/oebs/content/organization [b]oebs_content_organization_element.xsd"]', 'xmlns:oebs="http://www.rosbank.ru/oebs" xmlns:c="http://www.rosbank.ru/oebs/content/organization" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'),
    XMLType(bfilename('XMLDIRECTORY', 'organization_to_v2.0.xsl'), nls_charset_id('AL32UTF8'))
    ).getStringVal()),
    chr(38) || 'lt;',
    '<'
    chr(38) || 'gt;',
    '>'),
    chr(38) || 'quot;',
    into buf
    from oebs
    UPDATE oebs
    SET OBJECT_VALUE =
    deleteXML(OBJECT_VALUE,'/oebs:root/c:content[@xsi:schemaLocation="http://www.rosbank.ru/oebs/content/organization oebs_content_organization_element.xsd"]', 'xmlns:oebs="http://www.rosbank.ru/oebs" xmlns:c="http://www.rosbank.ru/oebs/content/organization" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"')
    UPDATE oebs
    SET OBJECT_VALUE =
    appendChildXML(OBJECT_VALUE,'/oebs:root',buf,'xmlns:oebs="http://www.rosbank.ru/oebs"');
    end;
    In other words I try to remove an instance of the first version, convert it to the second version by the xmltransform operation and insert it into the table.
    Here is the fragment of a xsl from the "'organization_to_v2.0.xsl":
    <xsl:text disable-output-escaping="yes"><![CDATA[<organization:]]></xsl:text>
    <xsl:value-of select="local-name()"/>
    <xsl:text disable-output-escaping="yes"><![CDATA[ xmlns:organization="]]></xsl:text>
    <xsl:value-of select="namespace-uri()"/>
    <xsl:text disable-output-escaping="yes"><![CDATA[" xsi:schemaLocation="]]></xsl:text>
    <xsl:value-of select="namespace-uri()"/>
    <xsl:text disable-output-escaping="yes"><![CDATA[ oebs_content_organization_element_V2.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">]]></xsl:text>
    <xsl:text disable-output-escaping="yes"><![CDATA[</organization:]]></xsl:text>
    <xsl:value-of select="local-name()"/>
    <xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>
    And here is the result of xsl (xmltransform):
    <organization:content xmlns:organization="http://www.rosbank.ru/oebs/content/organization" xsi:schemaLocation="http://www.rosbank.ru/oebs/content/organization oebs_content_organization_element_V2.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><organization><org_structure_version_id>1</org_structure_version_id><organization_id>2283</organization_id><organization_id_hrom></organization_id_hrom><organization_id_parent_hrom>3108894</organization_id_parent_hrom><event_name>CREATE</event_name><org_name>????????? ?????? ??? ??? ???????</org_name><date_from>01.12.2004</date_from><date_to></date_to><organization_id_parent>2209</organization_id_parent><organization_code>01.00.066.0.000.000.00.000.00</organization_code><organization_type>??????</organization_type><max_last_update_date>29.10.2007 12:36:35</max_last_update_date><p_union_par>2283|ORGANIZATION|CREATE|01.12.2004|29.10.2007 12:36:35|13.02.2007 15:56:28|27.11.2006 11:21:29|14.06.2006 00:00:00|01.12.2004|</p_union_par><element1>0</element1></organization></organization:content>
    And I get the next error:
    ORA-30937: No schema definition for 'element1' (namespace '##local') in parent '/root/content/organization'
    ORA-06512: on line 30
    The "element1" is a new element which was added in the second version (v2.0) of the contentOrganizationType. The version v2.0 is located in the "oebs_content_organization_element_V2.0.xsd".
    As you can see the result of a xmltransform is the element which has the "oebs_content_organization_element_V2.0.xsd" schema location too.
    I think that unfortunately in this case a checking against the first version is happening but the first version doesn't have a definition of the "element1".
    Can someone give me any suggestions about how to change this testcase to make it possible to insert a new part inside a whole record instead a old part in case when both parts have the same type but different versions?
    Regards
    Dmitry

    Hello, Marko.
    Thank you for your answer.
    The copyevolve is the one way which can be used in my case but I need to process particular range of records which include an instance of a special complextype.
    I don't need to convert a whole table because only about one percent of records must be processed. I think converting of a whole table will reduce a processing speed.
    Is it possible to use the copyevolve in this case?
    How to use the copyevolve to convert a data for a sub-tree of a xml-schema if I need to transform it by a xsl?
    Regards
    Dmitry

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

  • Creating XML using DBMS_XMLGEN with a namespace

    Is it possible to create an XMLTYPE using the DBMS_XMLGEN function set that contains a namespace. As far as I can see only the 'setrowsettag' function allows any control over what goes into the root element - should I be including, for example, an attribute called 'xmlns' with a value?
    The reason I ask all this is I'm trying to validate xml created from a select statement against a registered xsd.
    The xsd I've registered:
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    <xs:schema targetNamespace="http://www.sepa.org/2007/XMLSchemas/Site" xmlns:sit="http://www.sepa.org/2007/XMLSchemas/Site" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sepa.org/2007/XMLSchemas/Site Site.xsd" xmlns:oraxdb="http://xmlns.oracle.com/xdb" oraxdb:flags="311" oraxdb:schemaURL="http://www.sepa.org/2007/XMLSchemas/Site.xsd" oraxdb:schemaOwner="XMLDBMASTER" oraxdb:numProps="14">
    <xs:element name="site" oraxdb:propNumber="5953" oraxdb:global="true" oraxdb:SQLName="site" oraxdb:SQLType="site1681_T" oraxdb:SQLSchema="XMLDBMASTER" oraxdb:memType="258" oraxdb:defaultTable="site1683_TAB" oraxdb:defaultTableSchema="XMLDBMASTER">
    <xs:annotation>
    <xs:documentation>Comment describing your root element</xs:documentation>
    </xs:annotation>
    <xs:complexType oraxdb:SQLType="site1681_T" oraxdb:SQLSchema="XMLDBMASTER">
    <xs:sequence>
    <xs:element name="SiteIDType" type="xs:ID" oraxdb:propNumber="5940" oraxdb:global="false" oraxdb:SQLName="SiteIDType" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
    <xs:element name="SiteNameType" type="xs:string" minOccurs="1" oraxdb:propNumber="5941" oraxdb:global="false" oraxdb:SQLName="SiteNameType" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
    <xs:element name="SiteAddressStructure" oraxdb:propNumber="5947" oraxdb:global="false" oraxdb:SQLName="SiteAddressStructure" oraxdb:SQLType="SiteAddressStructure1682_T" oraxdb:SQLSchema="XMLDBMASTER" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false">
    <xs:complexType oraxdb:SQLType="SiteAddressStructure1682_T" oraxdb:SQLSchema="XMLDBMASTER">
    <xs:sequence>
    <xs:element name="AddressLine1" type="xs:string" minOccurs="1" oraxdb:propNumber="5942" oraxdb:global="false" oraxdb:SQLName="AddressLine1" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
    <xs:element name="AddressLine2" type="xs:string" minOccurs="0" oraxdb:propNumber="5943" oraxdb:global="false" oraxdb:SQLName="AddressLine2" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
    <xs:element name="AddressLine3" type="xs:string" minOccurs="0" oraxdb:propNumber="5944" oraxdb:global="false" oraxdb:SQLName="AddressLine3" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
    <xs:element name="AddressLine4" type="xs:string" minOccurs="1" oraxdb:propNumber="5945" oraxdb:global="false" oraxdb:SQLName="AddressLine4" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
    <xs:element name="PostCode" type="xs:string" minOccurs="0" oraxdb:propNumber="5946" oraxdb:global="false" oraxdb:SQLName="PostCode" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name="SiteTelephoneNoType" type="xs:string" minOccurs="0" oraxdb:propNumber="5948" oraxdb:global="false" oraxdb:SQLName="SiteTelephoneNoType" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
    <xs:element name="SiteMobilePlantType" type="xs:string" minOccurs="0" oraxdb:propNumber="5949" oraxdb:global="false" oraxdb:SQLName="SiteMobilePlantType" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
    <xs:element name="SiteFaxNoType" type="xs:string" minOccurs="0" oraxdb:propNumber="5950" oraxdb:global="false" oraxdb:SQLName="SiteFaxNoType" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
    <!--***Location code must reference the code in the Location Dataset***-->
    <xs:element name="SiteLocationCode" type="xs:string" minOccurs="1" oraxdb:propNumber="5951" oraxdb:global="false" oraxdb:SQLName="SiteLocationCode" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
    <xs:element name="SitePopulationEquivType" type="xs:positiveInteger" minOccurs="0" oraxdb:propNumber="5952" oraxdb:global="false" oraxdb:SQLName="SitePopulationEquivType" oraxdb:SQLType="NUMBER" oraxdb:memType="2" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    The method for generating the XML:
    DECLARE
    v_ctx DBMS_XMLGEN.ctxhandle;
    v_xml XMLTYPE;
    BEGIN
    v_ctx:=DBMS_XMLGEN.newcontext
    SELECT e.site_id "SiteIDType", e.site_name "SiteNameType", sit_address(e.addr_line1, e.addr_line2,
    e.addr_line3, e.addr_line4, e.post_code) AS "SiteAddressStructure", e.tel_no "SiteTelephoneNoType"
    , e.mobile_plant "SiteMobilePlantType",
    e.fax_no "SiteFaxNoType", e.ge1_location_code "SiteLocationCodeType" ,e.population_equivalent "SitePopulationEquivType"
    FROM EL03_SITES e
    WHERE e.site_id = 15'
    DBMS_XMLGEN.setrowsettag (v_ctx, 'site');
    DBMS_XMLGEN.setrowtag (v_ctx, NULL);
    v_xml := DBMS_XMLGEN.getxmltype (v_ctx);
    INSERT INTO js_xml_test
    (ID, xml_data
    VALUES ('site test', v_xml
    COMMIT;
    DBMS_XMLGEN.closecontext (v_ctx);
    END;
    The resulting XML:
    <site>
    <SiteIDType>15</SiteIDType>
    <SiteNameType>Finlas Water Treatment Works</SiteNameType>
    <SiteAddressStructure>
    <AddressLine1>Finlas Water Treatment Works</AddressLine1>
    <AddressLine2>Shermor Farm</AddressLine2>
    <AddressLine3>Luss</AddressLine3>
    <AddressLine4>Alexandria</AddressLine4>
    <PostCode>G83 8RH</PostCode>
    </SiteAddressStructure>
    <SiteTelephoneNoType>01389 850224</SiteTelephoneNoType>
    <SiteMobilePlantType>N</SiteMobilePlantType>
    <SiteLocationCodeType>123428</SiteLocationCodeType>
    </site>
    When I try to validate it, I get:
    ORA-30937: No schema definition for 'site' (namespace '') in parent '/'
    ORA-06512: at "SYS.XMLTYPE", line 345
    ORA-06512: at line 30
    How do I get a namespace declaration in the XML? Any suggestions gratefully received.

    Did you change any of the text in the lob write statements ?
    I believe you get this error if you increase the number of characters without increasing the 1st argument which looks as though it represents the number of characters

  • Validating XML stored in CLOB without exceptions for malformed XML

    Hello,
    I have a CLOB column that should contain an XML which conforms to a registered XSD schema. However, there might also be cases, in which the CLOB content violates the XSD or is not even wellformed XML at all.  Now I am trying to find a way to either
    identify all records, for which the CLOB contains well-formed XML that validates against my schema (find all "good" records) , or
    find all the other records (those with either no XML at all, malformed XML, or XML that does not validate against the XSD) (find all "exceptions")
    The problem is that all XML-validation methods I know of (e.g. isXmlValid or XmlType.isSchemaValid)  require an XmlType instance, and that records, for which no proper XmlType can be constructed from the CLOB, because the CLOB does not contain well-formed XML, will cause an exception, rather than just returning false or NULL or something else I could filter out.
    Is there a way to do something like
    SELECT * FROM MYTABLE where <MY_XML_COL is wellformed XML> and <MY_XML_COL validates against 'blabla.xsd'>
    without getting an ORA-31011 or whatever other kind of exception as soon as there is a row that does not contain proper XML?
    Thank you...

    So here is my example - this will be quiet a long post now...
    First, I create the table with the CLOBs
    CREATE TABLE ZZZ_MINITEST_CLOB (
      ID NUMBER(10,0) NOT NULL ENABLE,
      XML_DOC CLOB,
      REMARKS VARCHAR2(1000),
      CONSTRAINT PK_ZZZ_MINITEST_CLOB PRIMARY KEY (ID)
    ) NOLOGGING;
    Then I insert some examples
    INSERT INTO ZZZ_MINITEST_CLOB VALUES (
    10,
    '<minitest_root>
      <l2Node>
      <l2Num>1</l2Num>
      <l2Name>one.one</l2Name>
      </l2Node>
      <minitestId>1</minitestId>
      <minitestName>One</minitestName>
    </minitest_root>',
    'Basic valid example');
    INSERT INTO ZZZ_MINITEST_CLOB VALUES (
    20,
    '<minitest_root>
      <l2Node>
      <l2Num>1</l2Num>
      <l2Name>two.one</l2Name>
      </l2Node>
      <minitestId>2</minitestId>
      <!-- minitestName element is missing -->
    </minitest_root>',
    'Invalid - minitestName element is missing');
    INSERT INTO ZZZ_MINITEST_CLOB VALUES (
    30,
    '<minitest_root>
      <l2Node>
      <l2Num>1</l2Num>
      <l2Name>three.one</l2Name>
      </l2Node>
      <!-- minitestName and minitestId are switched -->
      <minitestName>Three</minitestName>
      <minitestId>3</minitestId>
    </minitest_root>',
    'Invalid - minitestName and minitestId are switched');
    INSERT INTO ZZZ_MINITEST_CLOB VALUES (
    40,
    '<minitest_root>
      <l2Node>
      <l2Num>1</l2Num>
      <l2Name>four.one</l2Name>
      </l2Node>
      <l2Node>
      <l2Num>2</l2Num>
      <l2Name>four.two</l2Name>
      </l2Node>
      <l2Node>
      <l2Num>3</l2Num>
      <l2Name>four.three</l2Name>
      </l2Node>
      <minitestId>4</minitestId>
      <minitestName>Four</minitestName>
    </minitest_root>',
    'Valid - multiple l2Node elements');
    INSERT INTO ZZZ_MINITEST_CLOB VALUES (
    50,
    '<minitest_root>
      <l2Node>
      <l2Num>1</l2Num>
      <l2Name>five.one</l2Name>
      </l2Node>
      <l2Node>
      <l2Num>2</l2Num>
      <l2Name>five.two</l2Name>
      </l2Node>
      <minitestId>4</minitestId>
      <minitestName>Five</minitestName>
      <!-- another l2Node node, but too far down -->
      <l2Node>
      <l2Num>3</l2Num>
      <l2Name>five.three</l2Name>
      </l2Node>
    </minitest_root>',
    'Invalid - another l2Node node, but too far down');
    INSERT INTO ZZZ_MINITEST_CLOB VALUES (
    60,
    'something that is not even xml',
    'Invalid - something that is not even xml');
    INSERT INTO ZZZ_MINITEST_CLOB VALUES (
    70,
    NULL,
    'Invalid - good old NULL');
    INSERT INTO ZZZ_MINITEST_CLOB VALUES (
    80,
    '<minitest_root>
      <l2Node>
      <l2Num>1</l2Num>
      <l2Name>
      <unexpected_node>
      this one should not be here!
      </unexpected_node>
      </l2Name>
      </l2Node>
      <minitestId>8</minitestId>
      <minitestName>Eight</minitestName>
    </minitest_root>',
    'Invalid - unexpected addl node');
    INSERT INTO ZZZ_MINITEST_CLOB VALUES (
    90,
    '<something> that has tags but is no xml </either>',
    'Invalid - something that has tags but is no xml either');
    COMMIT;
    Next I register the XSD...
    BEGIN
    DBMS_XMLSCHEMA.REGISTERSCHEMA(
      'http://localhost/minitest.xsd',
      '<?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:oraxdb="http://xmlns.oracle.com/xdb" oraxdb:storeVarrayAsTable="true" oraxdb:schemaURL="http://localhost/minitest.xsd">
      <xs:element name="minitest_root" oraxdb:SQLName="MINITEST_ROOT" oraxdb:SQLType="MINITEST_TYPE" oraxdb:defaultTable="" oraxdb:tableProps="NOLOGGING" oraxdb:maintainDOM="false">
        <xs:complexType oraxdb:SQLType="MINITEST_TYPE" oraxdb:maintainDOM="false">
          <xs:sequence>
            <xs:element maxOccurs="unbounded" ref="l2Node" oraxdb:SQLName="L2_NODE" oraxdb:SQLType="L2_NODE_TYPE" oraxdb:SQLCollType="L2_NODE_COLL" oraxdb:maintainDOM="false"/>
            <xs:element ref="minitestId" oraxdb:SQLName="MINITEST_ID" oraxdb:SQLType="NUMBER" oraxdb:maintainDOM="false"/>
            <xs:element ref="minitestName" oraxdb:SQLName="MINITEST_NAME" oraxdb:SQLType="VARCHAR2" oraxdb:maintainDOM="false"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="l2Node" oraxdb:SQLName="L2_NODE" oraxdb:SQLType="L2_NODE_TYPE" oraxdb:defaultTable="" oraxdb:tableProps="TABLESPACE CATALOG NOLOGGING" oraxdb:maintainDOM="false">
        <xs:complexType oraxdb:SQLType="L2_NODE_TYPE" oraxdb:maintainDOM="false">
          <xs:sequence>
            <xs:element ref="l2Num" oraxdb:SQLName="L2_NUM" oraxdb:SQLType="NUMBER" oraxdb:maintainDOM="false"/>
            <xs:element ref="l2Name" oraxdb:SQLName="L2_NAME" oraxdb:SQLType="VARCHAR2" oraxdb:maintainDOM="false"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="l2Num" type="number10_0Type" oraxdb:SQLName="L2_NUM" oraxdb:SQLType="NUMBER" oraxdb:maintainDOM="false" />
      <xs:element name="l2Name" type="varchar100Type" oraxdb:SQLName="L2_NAME" oraxdb:SQLType="VARCHAR2" oraxdb:maintainDOM="false" />
      <xs:element name="minitestId" type="number10_0Type" oraxdb:SQLName="MINITEST_ID" oraxdb:SQLType="NUMBER" oraxdb:maintainDOM="false" />
      <xs:element name="minitestName" type="varchar100Type" oraxdb:SQLName="MINITEST_NAME" oraxdb:SQLType="VARCHAR2" oraxdb:maintainDOM="false" />
      <xs:simpleType name="varchar100Type">
        <xs:restriction base="xs:string">
          <xs:maxLength value="100"/>
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType name="number10_0Type">
        <xs:restriction base="xs:integer">
          <xs:totalDigits value="10"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:schema>',
      GENTABLES=>FALSE
    END;
    And then I create my XML tables - four different ones for four different test cases. I am trying unstructured binary XML and strucured OR-based XML, each with and without a trigger.
    One with structured OR storage and no trigger
    CREATE TABLE ZZZ_MINITEST_ORXML (
      ID NUMBER(10,0) NOT NULL ENABLE,
      XML_CONTENT XMLTYPE,
      CONSTRAINT PK_ZZZ_MINITEST_ORXML PRIMARY KEY (ID)
    ) NOLOGGING
    VARRAY "XML_CONTENT"."XMLDATA"."L2_NODE" STORE AS TABLE "ZZZ_OR_L2_NODE" (NOLOGGING) RETURN AS LOCATOR
    XMLTYPE XML_CONTENT STORE AS OBJECT RELATIONAL XMLSCHEMA "http://localhost/minitest.xsd" ELEMENT "minitest_root";
    One with structured OR storage which will also have a trigger added further down
    CREATE TABLE ZZZ_MINITEST_ORXML_TRGR (
      ID NUMBER(10,0) NOT NULL ENABLE,
      XML_CONTENT XMLTYPE,
      CONSTRAINT PK_ZZZ_MINITEST_ORXML_TRGR PRIMARY KEY (ID)
    ) NOLOGGING
    VARRAY "XML_CONTENT"."XMLDATA"."L2_NODE" STORE AS TABLE "ZZZ_OR_L2_NODE_TRGR" (NOLOGGING) RETURN AS LOCATOR
    XMLTYPE XML_CONTENT STORE AS OBJECT RELATIONAL XMLSCHEMA "http://localhost/minitest.xsd" ELEMENT "minitest_root";
    One with unstructured binary XML in a SECUREFILE, no trigger
    CREATE TABLE ZZZ_MINITEST_BINXML_TRGR (
      ID NUMBER(10,0) NOT NULL ENABLE,
      XML_CONTENT XMLTYPE,
      CONSTRAINT PK_ZZZ_MINITEST_BINXML_TRGR PRIMARY KEY (ID)
    ) NOLOGGING
    XMLTYPE COLUMN XML_CONTENT STORE AS SECUREFILE BINARY XML
      (NOCOMPRESS NOCACHE NOLOGGING KEEP_DUPLICATES);
    One with unstructured binary XML in a SECUREFILE, which will also have a trigger
    CREATE TABLE ZZZ_MINITEST_BINXML (
      ID NUMBER(10,0) NOT NULL ENABLE,
      XML_CONTENT XMLTYPE,
      CONSTRAINT PK_ZZZ_MINITEST_BINXML PRIMARY KEY (ID)
    ) NOLOGGING
    XMLTYPE COLUMN XML_CONTENT STORE AS SECUREFILE BINARY XML
      (NOCOMPRESS NOCACHE NOLOGGING KEEP_DUPLICATES);
    Then I create the error logging tables
    begin
    DBMS_ERRLOG.CREATE_ERROR_LOG ('ZZZ_MINITEST_BINXML', 'ZZZ_MINITEST_BINXML_E', NULL, NULL, TRUE);
    DBMS_ERRLOG.CREATE_ERROR_LOG ('ZZZ_MINITEST_BINXML_TRGR', 'ZZZ_MINITEST_BINXML_TRGR_E', NULL, NULL, TRUE);
    DBMS_ERRLOG.CREATE_ERROR_LOG ('ZZZ_MINITEST_ORXML', 'ZZZ_MINITEST_ORXML_E', NULL, NULL, TRUE);
    DBMS_ERRLOG.CREATE_ERROR_LOG ('ZZZ_MINITEST_ORXML_TRGR', 'ZZZ_MINITEST_ORXML_TRGR_E', NULL, NULL, TRUE);
    END;
    Now the two triggers
    create or replace trigger TRG_ZZZ_MINITEST_BINXML
    BEFORE UPDATE OR INSERT ON ZZZ_MINITEST_BINXML_TRGR
    REFERENCING NEW AS NEW
    for each row
    BEGIN
      :NEW.XML_CONTENT := :NEW.XML_CONTENT.createSchemaBasedXML('http://localhost/minitest.xsd');
      :NEW.XML_CONTENT.SCHEMAVALIDATE();
    END TRG_ZZZ_MINITEST_BINXML;
    CREATE OR REPLACE TRIGGER TRG_ZZZ_MINITEST_ORXML
    BEFORE UPDATE OR INSERT ON ZZZ_MINITEST_ORXML_TRGR
    REFERENCING NEW AS NEW
    for each row
    BEGIN
      :NEW.XML_CONTENT := :NEW.XML_CONTENT.createSchemaBasedXML('http://localhost/minitest.xsd');
      :NEW.XML_CONTENT.SCHEMAVALIDATE();
    END TRG_ZZZ_MINITEST_ORXML;
    I also tried to just validate the XML using queries such as the below, since validating all without the WHERE also caused exception and abortion:
    SELECT ID, DECODE(XMLISVALID(XMLTYPE(XML_DOC), 'http://localhost/minitest.xsd'), 1, 'Y', 0, 'N', '?') VALID
    FROM ZZZ_MINITEST_CLOB WHERE ID=90;
    The results are in column "VALID" in the below tables
    I tried inserting all records from ZZZ_MINITEST_CLOB into the four test tables at once using a query such as
    INSERT INTO ZZZ_MINITEST_ORXML_TRGR
    SELECT ID, XMLPARSE(DOCUMENT XML_DOC WELLFORMED) FROM ZZZ_MINITEST_CLOB
    LOG ERRORS INTO ZZZ_MINITEST_ORXML_TRGR_E REJECT LIMIT UNLIMITED;
    I also tried different versions of creating the XML in the SELECT portion:
    XMLPARSE(DOCUMENT XML_DOC WELLFORMED)
    XMLPARSE(DOCUMENT XML_DOC WELLFORMED)
    XMLTYPE(XML_DOC)
    XMLTYPE(XMLDOC, 'http://localhost/minitest.xsd', 0, 1)
    Almost all combinations of the four test tables with the four ways to instantiate the XML caused exceptions and query abortion despite the LOG ERRORS INTO clause.
    In order to find the exact problems, I started inserting records one by one using queries like
    INSERT INTO ZZZ_MINITEST_ORXML
    SELECT ID, XMLPARSE(DOCUMENT XML_DOC) FROM ZZZ_MINITEST_CLOB WHERE ID=10
    LOG ERRORS INTO ZZZ_MINITEST_ORXML_E REJECT LIMIT UNLIMITED;
    or
    INSERT INTO ZZZ_MINITEST_BINXML_TRGR
    SELECT ID, XMLTYPE(XMLDOC, 'http://localhost/minitest.xsd', 0, 1) FROM ZZZ_MINITEST_CLOB WHERE ID=20
    LOG ERRORS INTO ZZZ_MINITEST_BINXML_TRGR_E REJECT LIMIT UNLIMITED;
    I captured the results of each in the below four tables. "1" and "0" are number of rows inserted. 0 means there was no record inserted and instead, there was an error logged in the ERROR LOGGING table.
    The ORA-????? exception numbers mean that this error actually caused the INSERT to fail and abort rather than just being logged in the LOGGING TABLE.These are the most critical cases for me. Why do these exceptions "bubble up" forcing the query to be aborted rather than being logged in the error log as well???
    This table is for INSERT of XMLs using XMLTYPE(XML_DOC)
    Test case
    VALID
    Binary XML,
    no trigger
    Binary XML,
    trigger
    OR XML,
    no trigger
    OR XML,
    trigger
    10
    Good
    Y
    1
    1
    1
    1
    20
    no name
    N
    1
    0
    1
    0
    30
    switched tags
    N
    1
    1
    1
    1
    40
    Good
    Y
    1
    1
    1
    1
    50
    L2 down
    N
    1
    1
    1
    1
    60
    no xml
    EX
    ORA-31011
    ORA-31011
    ORA-31011
    ORA-31011
    70
    NULL
    EX
    ORA-06502
    ORA-06502
    ORA-06502
    ORA-06502
    80
    addl. Node
    N
    1
    0
    ORA-31187
    ORA-31187
    90
    crappy xml
    EX
    ORA-31011
    ORA-31011
    ORA-31011
    ORA-31011
    This table is for INSERT of XMLs using XMLTYPE(XML_DOC, 'http://localhost/minitest.xsd', 0, 1)
    Test case
    VALID
    Binary XML,
    no trigger
    Binary XML,
    trigger
    OR XML,
    no trigger
    OR XML,
    trigger
    10
    Good
    Y
    1
    1
    1
    1
    20
    no name
    N
    1
    0
    1
    0
    30
    switched tags
    N
    1
    1
    1
    1
    40
    Good
    Y
    1
    1
    1
    1
    50
    L2 down
    N
    1
    1
    1
    1
    60
    no xml
    EX
    ORA-31043
    ORA-31043
    ORA-31043
    ORA-31043
    70
    NULL
    EX
    ORA-06502
    ORA-06502
    ORA-06502
    ORA-06502
    80
    addl. Node
    N
    1
    0
    ORA-31187
    ORA-31187
    90
    crappy xml
    EX
    ORA-31043
    ORA-31043
    ORA-31043
    ORA-31043
    This table is for INSERT of XMLs using XMLPARSE(DOCUMENT XML_DOC WELLFORMED)
    Test case
    VALID
    Binary XML,
    no trigger
    Binary XML,
    trigger
    OR XML,
    no trigger
    OR XML,
    trigger
    10
    Good
    Y
    1
    1
    1
    1
    20
    no name
    N
    1
    0
    1
    0
    30
    switched tags
    N
    1
    1
    1
    1
    40
    Good
    Y
    1
    1
    1
    1
    50
    L2 down
    N
    1
    1
    1
    1
    60
    no xml
    ORA-31061
    0
    ORA-31011
    ORA-31011
    70
    NULL
    1
    0
    1
    0
    80
    addl. Node
    N
    0
    0
    ORA-31187
    ORA-31187
    90
    crappy xml
    ORA-31061
    0
    ORA-30937
    ORA-30937
    This table is for INSERT of XMLs using XMLPARSE(DOCUMENT XML_DOC) (same as above, but without "WELLFORMED")
    Test case
    VALID
    Binary XML,
    no trigger
    Binary XML,
    trigger
    OR XML,
    no trigger
    OR XML,
    trigger
    10
    Good
    Y
    1
    1
    1
    1
    20
    no name
    N
    1
    0
    1
    0
    30
    switched tags
    N
    1
    1
    1
    1
    40
    Good
    Y
    1
    1
    1
    1
    50
    L2 down
    N
    1
    1
    1
    1
    60
    no xml
    ORA-31011
    ORA-31011
    ORA-31011
    ORA-31011
    70
    NULL
    1
    0
    1
    0
    80
    addl. Node
    N
    1
    0
    ORA-31187
    ORA-31187
    90
    crappy xml
    ORA-31011
    ORA-31011
    ORA-31011
    ORA-31011
    As you can see, different ways to instantiate the XML which is being inserted will cause different results for the most critical cases (60, 80 and 90). One will go through with an error logged in the logging table and no record inserted, others cause exceptions. Also, using XMLPARSE with or without WELLFORMED causes different ORA numbers for record 90...
    It seems like the only way to not get any exceptions for my test records is inserting XMLs that were created using XMLPARSE (DOCUMENT ... WELLFORMED) into the trigger-protected binary XML table. However, that causes me to miss record number 80, which is one that I really need, because it is well formed and I could use XSLTs to fix the XML by removing the extra tags, as long as I know which ones those are.

  • How does XML DB handle XML Schema Validation ?

    In order to validate an XML document against an XML Schema using Oracle XML DB the XML Schema must first be registered with XML DB using the method registerSchema provided by the package DBMS_XMLSCHEMA.
    XDB provides two types of schema validation, 'Lax' Validation and 'Strict' Validation.
    'Lax' validation takes place whenever a schema based document is converted from it's textual representation into the XML DB internal object model. Errors caught by this validation will be prefixed with 'ORA'.
    'Stict' validation takes place when the XMLType methods schemaValidate() or isSchemaValid() are invoked.
    The schemaValidate() method throws an exception with an error message indicating what is wrong it encounteres an invalid document. The error message associated with the exception will be prefixed with LSX.
    The isSchemaValid() method returns true or false, depending on whether or not the document is valid. It cannot return any information about why the document is invalid.
    The reason for having both the Lax and Strict validation models is that Strict validation is much more expensive in terms of CPU and memory usage than Lax validation.

    Here are some examples of what is caught by Lax validation (ORA errors) and what is only caught by Strict validation (LSX errors).
    SQL> begin
      2     dbms_xmlschema.registerSchema('test',xmltype(
      3  '<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.co
    eFormDefault="unqualified">
      4     <xs:complexType name="RootType">
      5             <xs:sequence>
      6                     <xs:element name="Mandatory"/>
      7                     <xs:element name="Enumeration">
      8                             <xs:simpleType>
      9                                     <xs:restriction base="xs:string">
    10                                             <xs:enumeration value="A"/>
    11                                             <xs:enumeration value="B"/>
    12                                             <xs:enumeration value="C"/>
    13                                     </xs:restriction>
    14                             </xs:simpleType>
    15                     </xs:element>
    16                     <xs:element name="MinLength">
    17                             <xs:simpleType>
    18                                     <xs:restriction base="xs:string">
    19                                             <xs:minLength value="4"/>
    20                                             <xs:maxLength value="20"/>
    21                                     </xs:restriction>
    22                             </xs:simpleType>
    23                     </xs:element>
    24                     <xs:element name="MaxLength">
    25                             <xs:simpleType>
    26                                     <xs:restriction base="xs:string">
    27                                             <xs:minLength value="1"/>
    28                                             <xs:maxLength value="4"/>
    29                                     </xs:restriction>
    30                             </xs:simpleType>
    31                     </xs:element>
    32                     <xs:element name="MaxOccurs" type="xs:string" maxOccurs="2"/>
    33                     <xs:element name="MinOccurs" minOccurs="2" maxOccurs="2"/>
    34                     <xs:element name="Optional" type="xs:string" minOccurs="0"/>
    35             </xs:sequence>
    36     </xs:complexType>
    37     <xs:element name="Root" type="RootType" xdb:defaultTable="ROOT_TABLE"/>
    38  </xs:schema>'));
    39  end;
    40  /
    PL/SQL procedure successfully completed.
    SQL> --
    SQL> -- Valid Document
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11     <Optional>Goodbye</Optional>
    12  </Root>'
    13  ))
    14  /
    1 row created.
    SQL> --
    SQL> -- Undefined element 'Illegal'
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Illegal>Hello World</Illegal>
      5     <Enumeration>A</Enumeration>
      6     <MinLength>ABCD</MinLength>
      7     <MaxLength>WXYZ</MaxLength>
      8     <MaxOccurs>1</MaxOccurs>
      9     <MaxOccurs>2</MaxOccurs>
    10     <MinOccurs>1</MinOccurs>
    11     <MinOccurs>2</MinOccurs>
    12     <Optional>Goodbye</Optional>
    13  </Root>'
    14  ))
    15  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-30937: No schema definition for 'Illegal' (namespace '##local') in parent
    '/Root'
    SQL> --
    SQL> -- Multiple occurences of 'Optional'
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11     <Optional>Goodbye</Optional>
    12     <Optional>Goodbye</Optional>
    13  </Root>'
    14  ))
    15  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-30936: Maximum number (1) of 'Optional' XML node elements exceeded
    SQL> --
    SQL> -- Missing element 'Manadatory'
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Enumeration>A</Enumeration>
      4     <MinLength>ABCD</MinLength>
      5     <MaxLength>WXYZ</MaxLength>
      6     <MaxOccurs>1</MaxOccurs>
      7     <MaxOccurs>2</MaxOccurs>
      8     <MinOccurs>1</MinOccurs>
      9     <MinOccurs>2</MinOccurs>
    10     <Optional>Goodbye</Optional>
    11  </Root>'
    12  ))
    13  /
    1 row created.
    SQL> --
    SQL> -- Invalid Enumeration Value
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>Z</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11     <Optional>Goodbye</Optional>
    12  </Root>'
    13  ))
    14  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-31038: Invalid enumeration value: "Z"
    SQL> --
    SQL> -- MinLength Violation
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABC</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11     <Optional>Goodbye</Optional>
    12  </Root>'
    13  ))
    14  --
    15  -- MaxLength Violation
    16  --
    17  /
    1 row created.
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>VWXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11     <Optional>Goodbye</Optional>
    12  </Root>'
    13  ))
    14  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-30951: Element or attribute at Xpath /Root/MaxLength exceeds maximum length
    SQL> --
    SQL> -- Missing element Optional - Valid Document
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11  </Root>'
    12  ))
    13  /
    1 row created.
    SQL> --
    SQL> -- Too many instances of 'MaxOccurs'
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MaxOccurs>3</MaxOccurs>
    10     <MinOccurs>1</MinOccurs>
    11     <MinOccurs>2</MinOccurs>
    12     <Optional>Goodbye</Optional>
    13  </Root>'
    14  ))
    15  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-30936: Maximum number (2) of 'MaxOccurs' XML node elements exceeded
    SQL> --
    SQL> -- Too few instances of 'MinOccurs'
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <Optional>Goodbye</Optional>
    11  </Root>'
    12  ))
    13  /
    1 row created.
    SQL> create trigger validateSchema
      2  before insert on ROOT_TABLE
      3  for each row
      4  begin
      5     :new.object_value.schemaValidate();
      6  end;
      7  /
    Trigger created.
    SQL> --
    SQL> -- Valid Document
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11     <Optional>Goodbye</Optional>
    12  </Root>'
    13  ))
    14  /
    1 row created.
    SQL> --
    SQL> -- Undefined element 'Illegal'
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Illegal>Hello World</Illegal>
      5     <Enumeration>A</Enumeration>
      6     <MinLength>ABCD</MinLength>
      7     <MaxLength>WXYZ</MaxLength>
      8     <MaxOccurs>1</MaxOccurs>
      9     <MaxOccurs>2</MaxOccurs>
    10     <MinOccurs>1</MinOccurs>
    11     <MinOccurs>2</MinOccurs>
    12     <Optional>Goodbye</Optional>
    13  </Root>'
    14  ))
    15  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-30937: No schema definition for 'Illegal' (namespace '##local') in parent
    '/Root'
    SQL> --
    SQL> -- Multiple occurences of 'Optional'
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11     <Optional>Goodbye</Optional>
    12     <Optional>Goodbye</Optional>
    13  </Root>'
    14  ))
    15  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-30936: Maximum number (1) of 'Optional' XML node elements exceeded
    SQL> --
    SQL> -- Missing element 'Manadatory'
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Enumeration>A</Enumeration>
      4     <MinLength>ABCD</MinLength>
      5     <MaxLength>WXYZ</MaxLength>
      6     <MaxOccurs>1</MaxOccurs>
      7     <MaxOccurs>2</MaxOccurs>
      8     <MinOccurs>1</MinOccurs>
      9     <MinOccurs>2</MinOccurs>
    10     <Optional>Goodbye</Optional>
    11  </Root>'
    12  ))
    13  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00213: only 0 occurrences of particle "Mandatory", minimum is 1
    ORA-06512: at "SYS.XMLTYPE", line 345
    ORA-06512: at "XDBTEST.VALIDATESCHEMA", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.VALIDATESCHEMA'
    SQL> --
    SQL> -- Invalid Enumeration Value
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>Z</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11     <Optional>Goodbye</Optional>
    12  </Root>'
    13  ))
    14  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-31038: Invalid enumeration value: "Z"
    SQL> --
    SQL> -- MinLength Violation
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABC</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11     <Optional>Goodbye</Optional>
    12  </Root>'
    13  ))
    14  --
    15  -- MaxLength Violation
    16  --
    17  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00221: "ABC" is too short (minimum length is 4)
    ORA-06512: at "SYS.XMLTYPE", line 345
    ORA-06512: at "XDBTEST.VALIDATESCHEMA", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.VALIDATESCHEMA'
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>VWXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11     <Optional>Goodbye</Optional>
    12  </Root>'
    13  ))
    14  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-30951: Element or attribute at Xpath /Root/MaxLength exceeds maximum length
    SQL> --
    SQL> -- Missing element Optional - Valid Document
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <MinOccurs>2</MinOccurs>
    11  </Root>'
    12  ))
    13  /
    1 row created.
    SQL> --
    SQL> -- Too many instances of 'MaxOccurs'
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MaxOccurs>3</MaxOccurs>
    10     <MinOccurs>1</MinOccurs>
    11     <MinOccurs>2</MinOccurs>
    12     <Optional>Goodbye</Optional>
    13  </Root>'
    14  ))
    15  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-30936: Maximum number (2) of 'MaxOccurs' XML node elements exceeded
    SQL> --
    SQL> -- Too few instances of 'MinOccurs'
    SQL> --
    SQL> insert into ROOT_TABLE values (xmltype(
      2  '<Root>
      3     <Mandatory>Hello World</Mandatory>
      4     <Enumeration>A</Enumeration>
      5     <MinLength>ABCD</MinLength>
      6     <MaxLength>WXYZ</MaxLength>
      7     <MaxOccurs>1</MaxOccurs>
      8     <MaxOccurs>2</MaxOccurs>
      9     <MinOccurs>1</MinOccurs>
    10     <Optional>Goodbye</Optional>
    11  </Root>'
    12  ))
    13  /
    insert into ROOT_TABLE values (xmltype(
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00213: only 1 occurrences of particle "MinOccurs", minimum is 2
    ORA-06512: at "SYS.XMLTYPE", line 345
    ORA-06512: at "XDBTEST.VALIDATESCHEMA", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.VALIDATESCHEMA'
    SQL>

  • 11g http2-port http2-protocol xdbconfig.xml

    Hi,
    I'm using 11g, I tried to configure HTTPS for my xdb.
    I followed "Oracle® XML DB Developer's Guide" -> "28 Using Protocols to Access the Repository"
    to setup "http2-port" and "http2-protocol" parameters, but it didn't work.
    Here's what I did:
    SQL>DECLARE
    *2 v_cfg XMLType;*
    *3 BEGIN*
    *4 SELECT updateXML(DBMS_XDB.cfg_get(),*
    *5 '/xdbconfig/sysconfig/protocolconfig/httpconfig/http2-port/text()',*
    *6 '433',*
    *7 '/xdbconfig/sysconfig/protocolconfig/httpconfig/http2-protocol/text()',*
    *8 'TCPS')*
    *9 INTO v_cfg*
    *10 FROM DUAL;*
    *11 DBMS_XDB.cfg_update(v_cfg);*
    *12 COMMIT;*
    *13 exception*
    *14 when others then*
    *15 dbms_output.put_line(sqlerrm);*
    *16 END;*
    *17 /*
    PL/SQL procedure successfully completed.
    SQL> SELECT DBMS_XDB.cfg_get() FROM DUAL;
    DBMS_XDB.CFG_GET()
    *<xdbconfig xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/xdbconfig.xsd http://xmlns.oracle.com/xdb/xdbconfig.xsd">*
    *<sysconfig>*
    *<acl-max-age>15</acl-max-age>*
    *<acl-cache-size>32</acl-cache-size>*
    *<invalid-pathname-chars/>*
    *<case-sensitive>true</case-sensitive>*
    *<call-timeout>6000</call-timeout>*
    *<max-link-queue>65536</max-link-queue>*
    *<max-session-use>100</max-session-use>*
    *<persistent-sessions>false</persistent-sessions>*
    *<default-lock-timeout>3600</default-lock-timeout>*
    *<xdbcore-logfile-path>/sys/log/xdblog.xml</xdbcore-logfile-path>*
    *<xdbcore-log-level>0</xdbcore-log-level>*
    *<resource-view-cache-size>1048576</resource-view-cache-size>*
    *<protocolconfig>*
    *<common>*
    *<extension-mappings>*
    *<mime-mappings>*
    *<mime-mapping>*
    *<extension>au</extension>*
    *<mime-type>audio/basic</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>avi</extension>*
    *<mime-type>video/x-msvideo</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>bin</extension>*
    *<mime-type>application/octet-stream</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>bmp</extension>*
    *<mime-type>image/bmp</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>css</extension>*
    *<mime-type>text/css</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>doc</extension>*
    *<mime-type>application/msword</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>eml</extension>*
    *<mime-type>message/rfc822</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>gif</extension>*
    *<mime-type>image/gif</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>htm</extension>*
    *<mime-type>text/html</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>html</extension>*
    *<mime-type>text/html</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>jpe</extension>*
    *<mime-type>image/jpeg</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>jpeg</extension>*
    *<mime-type>image/jpeg</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>jpg</extension>*
    *<mime-type>image/jpeg</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>js</extension>*
    *<mime-type>application/x-javascript</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>jsp</extension>*
    *<mime-type>text/html</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>mid</extension>*
    *<mime-type>audio/mid</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>mov</extension>*
    *<mime-type>video/quicktime</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>movie</extension>*
    *<mime-type>video/x-sgi-movie</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>mp3</extension>*
    *<mime-type>audio/mpeg</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>mpe</extension>*
    *<mime-type>video/mpg</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>mpeg</extension>*
    *<mime-type>video/mpg</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>mpg</extension>*
    *<mime-type>video/mpg</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>msa</extension>*
    *<mime-type>application/x-msaccess</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>msw</extension>*
    *<mime-type>application/x-msworks-wp</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>pcx</extension>*
    *<mime-type>application/x-pc-paintbrush</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>pdf</extension>*
    *<mime-type>application/pdf</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>png</extension>*
    *<mime-type>image/png</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>ppt</extension>*
    *<mime-type>application/vnd.ms-powerpoint</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>ps</extension>*
    *<mime-type>application/postscript</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>qt</extension>*
    *<mime-type>video/quicktime</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>ra</extension>*
    *<mime-type>audio/x-realaudio</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>ram</extension>*
    *<mime-type>audio/x-realaudio</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>rm</extension>*
    *<mime-type>audio/x-realaudio</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>rtf</extension>*
    *<mime-type>application/rtf</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>rv</extension>*
    *<mime-type>video/x-realvideo</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>sgml</extension>*
    *<mime-type>text/sgml</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>svg</extension>*
    *<mime-type>image/svg+xml</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>tif</extension>*
    *<mime-type>image/tiff</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>tiff</extension>*
    *<mime-type>image/tiff</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>txt</extension>*
    *<mime-type>text/plain</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>url</extension>*
    *<mime-type>text/plain</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>vrml</extension>*
    *<mime-type>x-world/x-vrml</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>wav</extension>*
    *<mime-type>audio/wav</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>wpd</extension>*
    *<mime-type>application/wordperfect5.1</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>xls</extension>*
    *<mime-type>application/vnd.ms-excel</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>xml</extension>*
    *<mime-type>text/xml</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>xsd</extension>*
    *<mime-type>text/xml</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>xsl</extension>*
    *<mime-type>text/xml</mime-type>*
    *</mime-mapping>*
    *<mime-mapping>*
    *<extension>zip</extension>*
    *<mime-type>application/x-zip-compressed</mime-type>*
    *</mime-mapping>*
    *<mime-mapping xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">*
    *<extension>htc</extension>*
    *<mime-type>text/x-component</mime-type>*
    *</mime-mapping>*
    *<mime-mapping xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">*
    *<extension>xbl</extension>*
    *<mime-type>text/xml</mime-type>*
    *</mime-mapping>*
    *</mime-mappings>*
    *<lang-mappings>*
    *<lang-mapping>*
    *<extension>en</extension>*
    *<lang>english</lang>*
    *</lang-mapping>*
    *</lang-mappings>*
    *<charset-mappings/>*
    *<encoding-mappings>*
    *<encoding-mapping>*
    *<extension>gzip</extension>*
    *<encoding>zip file</encoding>*
    *</encoding-mapping>*
    *<encoding-mapping>*
    *<extension>tar</extension>*
    *<encoding>tar file</encoding>*
    *</encoding-mapping>*
    *</encoding-mappings>*
    *</extension-mappings>*
    *<session-pool-size>50</session-pool-size>*
    *<session-timeout>6000</session-timeout>*
    *</common>*
    *<ftpconfig>*
    *<ftp-port>0</ftp-port>*
    *<ftp-listener>local_listener</ftp-listener>*
    *<ftp-protocol>tcp</ftp-protocol>*
    *<logfile-path>/sys/log/ftplog.xml</logfile-path>*
    *<log-level>0</log-level>*
    *<session-timeout>6000</session-timeout>*
    *<buffer-size>8192</buffer-size>*
    *</ftpconfig>*
    *<httpconfig>*
    *<http-port>80</http-port>*
    *<http-listener>local_listener</http-listener>*
    *<http-protocol>tcp</http-protocol>*
    *<max-http-headers>64</max-http-headers>*
    *<max-header-size>16384</max-header-size>*
    *<max-request-body>2000000000</max-request-body>*
    *<session-timeout>6000</session-timeout>*
    *<server-name>XDB HTTP Server</server-name>*
    *<logfile-path>/sys/log/httplog.xml</logfile-path>*
    *<log-level>0</log-level>*
    *<servlet-realm>Basic realm=&quot;XDB&quot;</servlet-realm>*
    *<webappconfig>*
    *<welcome-file-list>*
    *<welcome-file>index.html</welcome-file>*
    *<welcome-file>index.htm</welcome-file>*
    *</welcome-file-list>*
    *<error-pages/>*
    *<servletconfig>*
    *<servlet-mappings>*
    *<servlet-mapping>*
    *<servlet-pattern>/Test</servlet-pattern>*
    *<servlet-name>TestServlet</servlet-name>*
    *</servlet-mapping>*
    *<servlet-mapping>*
    *<servlet-pattern>/oradb/*</servlet-pattern>*
    *<servlet-name>DBURIServlet</servlet-name>*
    *</servlet-mapping>*
    *<servlet-mapping>*
    *<servlet-pattern>/orarep/*</servlet-pattern>*
    *<servlet-name>ReportFmwkServlet</servlet-name>*
    *</servlet-mapping>*
    *<servlet-mapping xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">*
    *<servlet-pattern>/i/*</servlet-pattern>*
    *<servlet-name>PublishedContentServlet</servlet-name>*
    *</servlet-mapping>*
    *<servlet-mapping xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">*
    *<servlet-pattern>/*</servlet-pattern>*
    *<servlet-name>APEX</servlet-name>*
    *</servlet-mapping>*
    *<servlet-mapping xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">*
    *<servlet-pattern>/apex/*</servlet-pattern>*
    *<servlet-name>APEX</servlet-name>*
    *</servlet-mapping>*
    *</servlet-mappings>*
    *<servlet-list>*
    *<servlet>*
    *<servlet-name>TestServlet</servlet-name>*
    *<servlet-language>Java</servlet-language>*
    *<display-name>XDB Test Servlet</display-name>*
    *<description>A servlet to test the internals of the XDB Servlet API</description>*
    *<servlet-class>xdbtserv</servlet-class>*
    *<servlet-schema>xdb</servlet-schema>*
    *</servlet>*
    *<servlet>*
    *<servlet-name>DBURIServlet</servlet-name>*
    *<servlet-language>C</servlet-language>*
    *<display-name>DBURI</display-name>*
    *<description>Servlet for accessing DBURIs</description>*
    *<security-role-ref>*
    *<role-name>authenticatedUser</role-name>*
    *<role-link>authenticatedUser</role-link>*
    *</security-role-ref>*
    *</servlet>*
    *<servlet>*
    *<servlet-name>ReportFmwkServlet</servlet-name>*
    *<servlet-language>C</servlet-language>*
    *<display-name>REPT</display-name>*
    *<description>Servlet for accessing reports</description>*
    *<security-role-ref>*
    *<role-name>authenticatedUser</role-name>*
    *<role-link>authenticatedUser</role-link>*
    *</security-role-ref>*
    *</servlet>*
    *<servlet xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">*
    *<servlet-name>PublishedContentServlet</servlet-name>*
    *<servlet-language>C</servlet-language>*
    *<display-name>Unauthenticated File Access Servlet</display-name>*
    *<description>Servlet for files for unauthenticated users</description>*
    *<init-param>*
    *<param-name>RootFolder</param-name>*
    *<param-value>/images</param-value>*
    *<description>RootFolder</description>*
    *</init-param>*
    *<security-role-ref>*
    *<role-name>anonymousServletRole</role-name>*
    *<role-link>anonymousServletRole</role-link>*
    *</security-role-ref>*
    *</servlet>*
    *<servlet xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">*
    *<servlet-name>APEX</servlet-name>*
    *<servlet-language>PL/SQL</servlet-language>*
    *<display-name>APEX</display-name>*
    *<plsql xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">*
    *<database-username xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">ANONYMOUS</database-username>*
    *<default-page xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">apex</default-page>*
    *<document-table-name xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">wwv_flow_file_objects$</document-table-name>*
    *<document-path xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">docs</document-path>*
    *<document-procedure xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">wwv_flow_file_mgr.process_download</document-procedure>*
    *<nls-language xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">american_america.al32utf8</nls-language>*
    *<request-validation-function xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">wwv_flow_epg_include_modules.authorize</request-validation-function>*
    *</plsql>*
    *<security-role-ref xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">*
    *<role-name>anonymousServletRole</role-name>*
    *<role-link>anonymousServletRole</role-link>*
    *</security-role-ref>*
    *</servlet>*
    *</servlet-list>*
    *</servletconfig>*
    *</webappconfig>*
    *<authentication>*
    *<allow-mechanism>basic</allow-mechanism>*
    *<digest-auth>*
    *<nonce-timeout>300</nonce-timeout>*
    *</digest-auth>*
    *</authentication>*
    *</httpconfig>*
    *</protocolconfig>*
    *<xdbcore-xobmem-bound>1024</xdbcore-xobmem-bound>*
    *<xdbcore-loadableunit-size>16</xdbcore-loadableunit-size>*
    *<acl-evaluation-method>ace-order</acl-evaluation-method>*
    *</sysconfig>*
    *</xdbconfig>*
    you can see that there's no "http2-port" or "http2-protocol" in xdbconfig.xml.
    then, I tried this:
    SQL> DECLARE
    *2 v_cfg XMLType;*
    *3 BEGIN*
    *4 SELECT insertXMLbefore(DBMS_XDB.cfg_get(),*
    *5 '/xdbconfig/sysconfig/protocolconfig/httpconfig/authentication',*
    *6 XMLType('<http2-port>433</http2-port>'))*
    *7 INTO v_cfg*
    *8 FROM DUAL;*
    *9 DBMS_XDB.cfg_update(v_cfg);*
    *10 COMMIT;*
    *11 exception*
    *12 when others then*
    *13 dbms_output.put_line(sqlerrm);*
    *14 END;*
    *15 /*
    ORA-30937: No schema definition for 'http2-port' (namespace '##local') in parent '/xdbconfig/sysconfig/protocolconfig/httpconfig'
    it seems I can't insert "http2-port" into xdbconfig.xml either.
    I don't know why...
    Please help, thanks in advance!

    Namespaces :)
    SQL>   SELECT insertXMLBefore
      2           (
      3             DBMS_XDB.cfg_get(),
      4             '/xdbconfig/sysconfig/protocolconfig/httpconfig/authentication',
      5             XMLType('<http2-port xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">433</http2-port>'),
      6             'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd'
      7           )
      8    from dual;
    <xdbconfig xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd" xmlns:xsi="http://w
    ww.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/x
    db/xdbconfig.xsd http://xmlns.oracle.com/xdb/xdbconfig.xsd">
      <sysconfig>
        <acl-max-age>15</acl-max-age>
        <acl-cache-size>32</acl-cache-size>
        <invalid-pathname-chars/>
        <case-sensitive>true</case-sensitive>
        <call-timeout>6000</call-timeout>
        <max-link-queue>65536</max-link-queue>
        <max-session-use>100</max-session-use>
        <persistent-sessions>false</persistent-sessions>
        <default-lock-timeout>3600</default-lock-timeout>
        <xdbcore-logfile-path>/sys/log/xdblog.xml</xdbcore-logfile-path>
        <xdbcore-log-level>0</xdbcore-log-level>
        <resource-view-cache-size>1048576</resource-view-cache-size>
        <protocolconfig>
          <common>
            <extension-mappings>
              <mime-mappings>
              </mime-mappings>
              <lang-mappings>
                <lang-mapping>
                  <extension>en</extension>
                  <lang>english</lang>
                </lang-mapping>
              </lang-mappings>
              <charset-mappings/>
              <encoding-mappings>
                <encoding-mapping>
                  <extension>gzip</extension>
                  <encoding>zip file</encoding>
                </encoding-mapping>
                <encoding-mapping>
                  <extension>tar</extension>
                  <encoding>tar file</encoding>
                </encoding-mapping>
              </encoding-mappings>
            </extension-mappings>
            <session-pool-size>50</session-pool-size>
            <session-timeout>6000</session-timeout>
          </common>
          <ftpconfig>
            <ftp-port>21</ftp-port>
            <ftp-listener>local_listener</ftp-listener>
            <ftp-protocol>tcp</ftp-protocol>
            <logfile-path>/sys/log/ftplog.xml</logfile-path>
            <log-level>0</log-level>
            <session-timeout>6000</session-timeout>
            <buffer-size>8192</buffer-size>
          </ftpconfig>
          <httpconfig>
            <http-port>80</http-port>
            <http-listener>local_listener</http-listener>
            <http-protocol>tcp</http-protocol>
            <max-http-headers>64</max-http-headers>
            <max-header-size>16384</max-header-size>
            <max-request-body>2000000000</max-request-body>
            <session-timeout>6000</session-timeout>
            <server-name>XDB HTTP Server</server-name>
            <logfile-path>/sys/log/httplog.xml</logfile-path>
            <log-level>0</log-level>
            <servlet-realm>Basic realm=&quot;XDB&quot;</servlet-realm>
            <webappconfig>
            </webappconfig>
            <allow-repository-anonymous-access xmlns="http://xmlns.oracle.com/xdb/xd
    bconfig.xsd">true</allow-repository-anonymous-access>
            <http2-port xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">433</http2
    -port>
            <authentication>
              <allow-mechanism>basic</allow-mechanism>
              <digest-auth>
                <nonce-timeout>300</nonce-timeout>
              </digest-auth>
            </authentication>
          </httpconfig>
        </protocolconfig>
        <schemaLocation-mappings xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">
          <schemaLocation-mapping xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">
            <namespace>http://earth.google.com/kml/2.1</namespace>
            <element>kml</element>
            <schemaURL>http://code.google.com/apis/kml/schema/kml21.xsd</schemaURL>
          </schemaLocation-mapping>
          <schemaLocation-mapping xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">
            <namespace>http://earth.google.com/kml/2.2</namespace>
            <element>kml</element>
            <schemaURL>http://code.google.com/apis/kml/schema/kml21.xsd</schemaURL>
          </schemaLocation-mapping>
        </schemaLocation-mappings>
        <xdbcore-xobmem-bound>1024</xdbcore-xobmem-bound>
        <xdbcore-loadableunit-size>16</xdbcore-loadableunit-size>
        <acl-evaluation-method>ace-order</acl-evaluation-method>
      </sysconfig>
    </xdbconfig>
    Elapsed: 00:00:01.03
    SQL>

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

Maybe you are looking for