4 Replies Latest reply: Jul 8, 2013 9:48 AM by mustafa_yilmaz RSS

    Xml namespaces problem

    mustafa_yilmaz

      When i called my function,my value returning null.Why and how to solve it? Thanks..

       

      DECLARE
      
          l_namespace varchar2(1000):='xmlns:sh="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader" 
                                       xmlns:ef="http://www.efatura.gov.tr/package-namespace"
                                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                       xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
                                       xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"';
           x   XMLTYPE
            := XMLTYPE('
                   <sh:StandardBusinessDocument xsi:schemaLocation="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader PackageProxy.xsd" xmlns:sh="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader" xmlns:ef="http://www.efatura.gov.tr/package-namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                   <sh:StandardBusinessDocumentHeader>
                   <sh:HeaderVersion>1.0</sh:HeaderVersion>
                   </sh:StandardBusinessDocumentHeader>
                   <ef:Package>
                   <Elements>
                   <ElementType>APPLICATIONRESPONSE</ElementType>
                   <ElementCount>1</ElementCount>
                   <ElementList>
                   <ApplicationResponse xmlns="urn:oasis:names:specification:ubl:schema:xsd:ApplicationResponse-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:oasis:names:specification:ubl:schema:xsd:ApplicationResponse-2 ../xsd/maindoc/UBLTR-ApplicationResponse-2.0.xsd">
                   <cbc:UBLVersionID>2.0</cbc:UBLVersionID>          
                    </ApplicationResponse>
                    </ElementList>
                    </Elements>
                    </ef:Package>
                    </sh:StandardBusinessDocument>');          
            CURSOR elements IS
               SELECT
               EXTRACTVALUE(VALUE(p2),'/ApplicationResponse/cbc:UBLVersionID',l_namespace) AS xact 
               FROM TABLE (XMLSEQUENCE (EXTRACT (x,'/sh:StandardBusinessDocument/ef:Package/Elements/ElementList/ApplicationResponse',l_namespace))) p2;    
           BEGIN
           dbms_output.put_line('XX');
           FOR r IN elements
           loop
           dbms_output.put_line(r.xact);
           end loop;
           EXCEPTION WHEN OTHERS THEN
           dbms_output.put_line(sqlerrm);
           END;