How to read specific value in XML using AppleScript?

I have a XML file which I get from Mediainfo, and I want to get the value of Format of the Audio Track from it (In this case, ALAC) using AppleScript. Could anybody help me with this? Thanks.
<?xml version="1.0" encoding="UTF-8"?>
<Mediainfo version="0.7.69">
<File>
<track type="General">
<Complete_name>/Volumes/Macintosh HDD/Movies/Strike the Blood 12.mov</Complete_name>
<Format>MPEG-4</Format>
<Format_profile>QuickTime</Format_profile>
<Codec_ID>qt  </Codec_ID>
<File_size>1.64 GiB</File_size>
<Duration>23mn 41s</Duration>
<Overall_bit_rate_mode>Variable</Overall_bit_rate_mode>
<Overall_bit_rate>9 887 Kbps</Overall_bit_rate>
<Movie_name>[ReinForce] Strike the Blood - 12 (BDRip 1920x1080 x264 FLAC)</Movie_name>
<Encoded_date>UTC 1904-01-01 00:00:00</Encoded_date>
<Tagged_date>UTC 1904-01-01 00:00:00</Tagged_date>
<Writing_application>Lavf55.33.100</Writing_application>
</track>
<track type="Video">
<ID>1</ID>
<Format>AVC</Format>
<Format_Info>Advanced Video Codec</Format_Info>
<Format_profile>[email protected]</Format_profile>
<Format_settings__CABAC>Yes</Format_settings__CABAC>
<Format_settings__ReFrames>4 frames</Format_settings__ReFrames>
<Codec_ID>avc1</Codec_ID>
<Codec_ID_Info>Advanced Video Coding</Codec_ID_Info>
<Duration>23mn 41s</Duration>
<Bit_rate>9 084 Kbps</Bit_rate>
<Width>1 920 pixels</Width>
<Height>1 080 pixels</Height>
<Display_aspect_ratio>16:9</Display_aspect_ratio>
<Frame_rate_mode>Variable</Frame_rate_mode>
<Frame_rate>23.976 fps</Frame_rate>
<Color_space>YUV</Color_space>
<Chroma_subsampling>4:2:0</Chroma_subsampling>
<Bit_depth>8 bits</Bit_depth>
<Scan_type>Progressive</Scan_type>
<Bits__Pixel_Frame_>0.183</Bits__Pixel_Frame_>
<Stream_size>1.50 GiB (92%)</Stream_size>
<Writing_library>x264 core 142</Writing_library>
<Encoding_settings>cabac=1 / ref=4 / deblock=1:-2:-2 / analyse=0x3:0x113 / me=umh / subme=9 / psy=1 / psy_rd=0.70:0.00 / mixed_ref=0 / me_range=32 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=32 / lookahead_threads=5 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=9 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=16.0 / qcomp=0.70 / qpmin=10 / qpmax=20 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00</Encoding_settings>
<Language>English</Language>
<Encoded_date>UTC 1904-01-01 00:00:00</Encoded_date>
<Tagged_date>UTC 1904-01-01 00:00:00</Tagged_date>
</track>
<track type="Audio">
<ID>2</ID>
<Format>ALAC</Format>
<Codec_ID>alac</Codec_ID>
<Codec_ID_Info>Apple Lossless Audio Codec</Codec_ID_Info>
<Duration>23mn 41s</Duration>
<Duration_LastFrame>-51ms</Duration_LastFrame>
<Bit_rate_mode>Variable</Bit_rate_mode>
<Bit_rate>799 Kbps</Bit_rate>
<Channel_s_>2 channels</Channel_s_>
<Channel_positions>Front: L R</Channel_positions>
<Sampling_rate>48.0 KHz</Sampling_rate>
<Bit_depth>16 bits</Bit_depth>
<Stream_size>135 MiB (8%)</Stream_size>
<Language>11</Language>
<Encoded_date>UTC 1904-01-01 00:00:00</Encoded_date>
<Tagged_date>UTC 1904-01-01 00:00:00</Tagged_date>
</track>
</File>
</Mediainfo>

Hello
You may try something like the following script. It is indeed a Perl script wrapped in AppleScript, though.
set f to (choose file with prompt "Choose the XML file")'s POSIX path
get_audio_format(f)
on get_audio_format(f)
        string f : POSIX path of source XML file
    do shell script "/usr/bin/perl -CSDA -w <<'EOF' - " & f's quoted form & "
use strict;
use XML::LibXML;
my $parser = XML::LibXML->new();
my $doc = $parser->parse_file($ARGV[0]);
print $doc->find('/Mediainfo/File/track[@type=\"Audio\"]/Format');
EOF"
end get_audio_format
And a littel more general-purpose script is -
set f to (choose file with prompt "Choose the XML file")'s POSIX path
get_value_at_xpath(f, "/Mediainfo/File/track[@type=\"Audio\"]/Format")
on get_value_at_xpath(f, xpath)
        string f : POSIX path of source XML file
        string xpath : XPath of target node
    do shell script "/usr/bin/perl -CSDA -w <<'EOF' - " & f's quoted form & " " & xpath's quoted form & "
# $ARGV[0] : xml file
# $ARGV[1] : xpath
use strict;
use XML::LibXML;
my $parser = XML::LibXML->new();
my $doc = $parser->parse_file($ARGV[0]);
print $doc->find($ARGV[1]);
EOF"
end get_value_at_xpath
Hope this may help,
H
PS. If copied code has extra spaces in front of every line, which appears to be the case with some browsers including Firefox, please remove them before running the script.

Similar Messages

  • How to Read Variable Values in WAD 7.0 Using JavaScript

    I found a how to: How to Read Variable Values in WAD 7.0 Using JavaScript on SDN.
    I get a Javascript error:
    bics.getElementsByTagName is not a function
    vars = bics.getElementsByTagName("VARIABLES")[0]; // <VARIABLES>
    Thats my script:
    function currency()
    var varnm = "SFS_CP_CURR"; // Name of the variable to be read
    root = document.childNodes[0]; // <HTML>
    body = root.getElementsByTagName("BODY")[0]; // <BODY>
    xml = body.getElementsByTagName("XML")[0]; // <XML>
    bics = xml.childNodes[0]; // <BICS_VIEW>
    vars = bics.getElementsByTagName("VARIABLES")[0]; // <VARIABLES>
    varl = vars.getElementsByTagName("VARIABLE"); // gives no. of variable in DP
    for ( i = 0; i <= varl.length; i++ ) // Loop one by one
    vari = vars.getElementsByTagName("VARIABLE")<i>;
    varnam = vari.attributes[0].text; // get variable name
    mem = vari.getElementsByTagName("MEMBER")[0];
    varval = mem.attributes.getNamedItem("name").value; // read variable value
    if (varnam == varnm) //check varname in loop needs to be read
    if (varval == "ZMON") // check for value1 and fire command1
    SFS_CP_M();
    if (varval == "ZKON") // check for value2 and fire command2
    SFS_CP_K();
    break;
    Where's the mistake?

    I'm afraid I haven't made my question understood clearly.
    What I am looking for is a method to get the value of variable inside excel (e.g. put it into a cell / range of a worksheet, so that we can reference it and use it as an input for planning function execution).
    Please advice.
    Thanks in advance,
    Shady

  • How to get string value from xml in JSF??

    In JSF How to get string value from xml, .ini and properties file. I want to get string value from xml or text to JSF

    Just use the appropriate API's for that. There are enough API's out which can read/parse/write XML, ini and properties files. E.g. JAXP or DOM4J for xml files, INI4J for ini files and Sun's own java.util.Properties for propertiesfiles.
    JSF supports properties files as message bundle and resource bundle so that you can use them for error messages and/or localization.

  • How to Pass Click Value to DB using Java

    How to Pass Click Value to DB using Java and display tat
    clicked value row data in flex
    i have created connection with Sql Server using java and drew
    pie chart from values fetched from XML file created by Java
    wat i need is when i click pie chart region (widget) i should
    display a alert by giving value of particular widget name and Value
    from Database and display in Flex Alert

    Use AddResource to add Javascript in your BackingBean Code and pass the value to your javascript code.
    JSCookMenu and other dynamic adding of javascript to a JSF-JSP page is done using AddResource....

  • How to read all values of a queue

    Hi All,
    In Message mapping I am checking condition for field value based on incoming value.
    In test cases i can see the second or third  occurence is getting supressed and first value fails the condition and mapping node not created.
    I would like to know how to read multiple values from queue and check condition for each value and if correct value present condition should pass.
    I tried all possible context changes but no luck.
    Any ideas how to read all values coming .
    Thanks.

    <?xml version="1.0" encoding="UTF-8"?>
    <msg version="" dbName="">
       <rowOp isLast="" cmitLSN="" cmitTime="" authID="" correlationID="" planName="">
          <updateRow subName="" srcOwner="" srcName="" intentSEQ="" rowNum="" hasLOBCols="">
             <col name="END_RSN_CDE" isKey="852369" invalidData="" rawData="">
                <smallint>
                   <beforeVal invalidData="" rawData=""/>
                   <afterVal invalidData="" rawData=""/>
                </smallint>
                <date>
                   <beforeVal invalidData="" rawData=""/>
                   <afterVal invalidData="" rawData=""/>
                </date>
                <char>
                   <beforeVal invalidData="" rawData=""/>
                   <afterVal invalidData="" rawData=""/>
                </char>
             </col>
             <col name="SVC_USER_SDT" isKey="789654" invalidData="" rawData="">
                <smallint>
                   <beforeVal invalidData="" rawData=""/>
                   <afterVal invalidData="" rawData=""/>
                </smallint>
                <date>
                   <beforeVal invalidData="" rawData=""/>
                   <afterVal invalidData="" rawData=""/>
                </date>
                <char>
                   <beforeVal invalidData="" rawData=""/>
                   <afterVal invalidData="" rawData=""/>
                </char>
             </col>
          </updateRow>
       </rowOp>
    </msg>

  • How to read the value of Non-Linear Transforme​r ?

    Hi there !
    I know that we could make "modified" transformer for special purpose (with Vsec=5V for example). But, instead of make a new transformer, it might be more easier if we could know how to read the value of those transformer. For example, NLT_PQ_4_120 or NLT_PQ_4_10. To be narrowed, what is the meaning of 4_120 and 4_10 ?
    Anyone ?
    Ghost Recon Team Leader

    To understand the models you mentioned you need to understand XSPICE.  I suggest you use the virtual transformer instead because it is easy to change the turn ratio, you can double clicking on the component and enter what ever ratio you want.  This component is found  by selecting the menu PlaceàComponent
    Group: Basic
    Family: Basic Virtual
    Component: TS Virtual
    Tien
    Tien P.
    National Instruments

  • BOL: How to read the value of an attribut

    Hiii experts,
    I'm new in ABAP programming.
    My intention is to read the value of a context attribut.
    This attribut ist not in form of a struct attribut. To read an struct attribut, I know to get the value, for example:
    value ?= me->typed_context->BP_ADDR->collection_wrapper->get_current( ).
      CHECK value IS BOUND.
      value->get_property_as_value(
        EXPORTING
          iv_attr_name = 'CITY'
        IMPORTING
          ev_result    = value_city).
    But my problem is, that I have an attribut, which you can not find in the BOL browser, because it is not in form of a struct.
    Can anybody help me, how to read the value of this kind of attributs.
    Thank you very much in advance fpr your help,
    John

    Hii Clemens,
    first of all, my concern deals with WebUI.
    I expect to read the value of an attribut. I know how to read the value of an attribut, which can be found with the same description in the bol browser, as you know you can read it with:
    value ?= me->typed_context->BP_ADDR->collection_wrapper->get_current( ).
      CHECK value IS BOUND.
      value->get_property_as_value(
        EXPORTING
          iv_attr_name = 'CITY'
        IMPORTING
          ev_result    = value_city).
    Now, I have an attribut of an context node which has a different name as in bol browser. If I want to read the value with the code above I get an error message. Thatswhy I referenced a collection of the context node to read this attribut.
    Can anybody say me how the value of the attribut, can I use the methode get_property ?
    greetings,
    J

  • Read Specific value/Search Into file

    Hi i need a java code which read specific value from a file.
    Example:
    I have a text file named data.txt
    it contain :
    Customer Name :Sarwar
    Customer Id : 001
    Product Price :2000
    now how can i take values 001 and 2000 from the file data.txt and save them in a another text file named new_data.txt ?
    Can any one help me?

    Search Google for 'java file read'. Wanna write to a file? Search for 'java file write'. Ain't Google awesome?
    If you haven't already done so, I suggest you search www.amazon.com for a beginner book on Java that has good reviews. Its much more efficient to read a book on Java than spend countless hours trying to learn it through code examples found on the internet.

  • Read bool value from xml

    Hi all :
    I try to read Boolean value from xml file , please see attach file , all the time this error rise
    I know that The XML tag describing the type of data does not match, how can I get Boolean value " 1" or "0 "
    Thanks
    wisam
    Attachments:
    untitled1.JPG ‏115 KB

    You are not trying to read boolean.. you are trying to read a DBL.
    To read a DBL you must first write a DBL to XML.
    To read a boolean replace the DBL with a boolean

  • Help!!! Can Anybody tell me how to read bookmarks of MS word using ABAP?

    It took me around 3 days , but there is still no solutions...
    Can Anybody tell me how to read bookmarks of MS word using ABAP ?
    Many thanks.

    Dear Nick  ,
    Thanks for your attention!
    I have MS word installed in the R3 server , and I uploaded my word doc with some self-defined bookmarks into SAP R3 system.
    Now I want to read these bookmarks using ABAP in this R3 system...
    Is it clear enough?
    Looking forward to your solution ...
    Thanks again..
    Best Regards,
    Leon.

  • How to read specific line in a file through UNIX shell script..

    Dear Friends,
    I have generated .ldt file under admin/import/US folder through FND_LOAD script for Download the responsibility.
    I registred Shell script (Host concurrent program) in Oracle apps. Now i want to read the file in speciific line which i was generated in admin/import/US folder through unix shell script. Please help me how to read specific line and the i want to replace that which i am going to read the specific line.
    Thanks in advance..
    Regards,
    Velu.

    Hi,
    Thanks for reply,
    My requirement i have to find the specific line in a file and find and replace needed word over there it's should happen programatically. i want to read specific line in a file Once complete find and replace the condition should exists. The loop will go to next file and read the same line in next file also do the same process upto how many files over there.i am doing through UNIX shell script. Please help me out to find the
    Your suggestion is highly appriciated.
    Thanks,
    Velu.

  • How to save form data as XML using Reader XI

    Dear all,
    I have designed a form using live cycle designer 9 and activated the form extensions using Acrobat X Pro.
    The form includes an email send button.
    Our clients uses the Reader X and XI.
    Using Reader X the pressing of the button will open a dialog box asking the user to send the form/form data using the default email client
    OR
    one can save the form data as xml file on the local machine and attach it later.
    However, using Reader XI there is no such possibility of saving the data as XML. One can just chose between the default email client or another email account.
    I tried even a button using javascript xfa.host.exportData("",0); but nothing. In fact the button shows no function at all.
    What do I wrong?
    Does anybody has a hint please?
    Thanks in advance.
    gersti

    I'm pretty impressed of Adobe and their stuff (I do NOT refer to the community), how helpful they are.
    Perhaps I didn't understand  the meaning on the offical customer support website, stating:
    The best way to contact us...  
    Ask our experts 
    Our community and staff are at your service 24/7
    Even worst, their is a similar question from 25/09/2013 (http://forums.adobe.com/message/5711946#5711946) and no feedback form Adobe stuff at all.
    Great service guys!
    Thanks a lot!

  • How to update the value in xml file using transformer after setNodeValue

    Hi,
    This is my code
    I want to set update the values in xml file using transformer..
    Any one can help me
    This is my Xml file
    <?xml version="1.0" encoding="UTF-8"?>
    <place>
    <name>chennai</name>
    </place>
    Jsp Page
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ page import="javax.xml.parsers.DocumentBuilderFactory,
    javax.xml.parsers.DocumentBuilder,org.w3c.dom.*,org.w3c.dom.Element"
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <% String str="";
    String str1="";
    try
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.parse("http://localhost:8084/XmlApplication1/sss.xml");
    out.println("Before change");
    NodeList n11 = doc.getElementsByTagName("name");
    Node n22= n11.item(0).getFirstChild();
    str1 = n22.getNodeValue();
    out.println(str1);
    out.println("After change");
    String name = "Banglore";
    NodeList nlst = doc.getElementsByTagName("name");
    Node node= nlst.item(0).getFirstChild();
    node.setNodeValue(name);
    NodeList n1 = doc.getElementsByTagName("name");
    Node n2= n1.item(0).getFirstChild();
    str = n2.getNodeValue();
    out.println(str);
    catch(Exception e)
    out.println(e) ;
    %>
    <h1><%=str%></h1>
    <%--
    This example uses JSTL, uncomment the taglib directive above.
    To test, display the page like this: index.jsp?sayHello=true&name=Murphy
    --%>
    <%--
    <c:if test="${param.sayHello}">
    <!-- Let's welcome the user ${param.name} -->
    Hello ${param.name}!
    </c:if>
    --%>
    </body>
    </html>

    hi check this exit...
    IWO10012

  • How to read specific entry in standard table view :

    Hi Friends,
    Can anybody please give me code on how to read a record in table view having 5 records.
    I have a requirement on how to read the specific address out of 5.
    I tried doing in ON_NEW_FOCUS method.
    Thanks,
    Chitrakant

    Hello,
    Try to do it in the DO_PREPARE_OUTPUT mathod before calling super->do_prepare_output( ). What we need to do is,
    1. get the collection from context node ( get_collection_wrapper )..
    2. filter the entity based on the value ( using iterator !!! )
    3. set back to context node
    4. call super->do_prepare_output.
    Hope it helps.
    Regards,
    Sandeep Kumar B

  • How to apply condition when parsing XML using XMLTable

    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE 11.1.0.7.0 Production
    TNS for Linux: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
    XML Response to be processed by stored proc:
    <TFSResponse>
    <TFS>
              <referenceNumber>39760</referenceNumber>
              <reqId>39760</reqId>
              <fromAccount>
                   <id>1550796</id>
                   <number>0003210011</number>
              </fromAccount>
              <toAccount>
                   <id>1550769</id>
                   <number>3199109643</number>
              </toAccount>
              <createdBy>
                   <userId>627892</userId>
                   <userLoginId>AAAAAA</userLoginId>
                   <userTypeId>1</userTypeId>
              </createdBy>
              </TFS>
    </TFSResponse>
    Register schema script:
    DECLARE
    l_schema CLOB;
    BEGIN
    l_schema := '<?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb">
    <xs:element name="TFSResponse" type="TFSResponseWSResponseType" xdb:defaultTable="TEMP_RESULT" />
         <xs:complexType name="TFSResponseWSResponseType">
              <xs:sequence>
              <xs:element maxOccurs="unbounded" name="TFS" type="TFSSummaryWSTO"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="TFSSummaryWSTO">
              <xs:sequence>
                   <xs:element name="referenceNumber" type="xs:string"/>
                   <xs:element name="reqId" type="xs:long"/>
                   <xs:element name="fromAccount" type="tns:AccountSummaryWSTO" />
    <xs:element name="toAccount" type="tns:AccountSummaryWSTO"/>
                   <xs:element name="createdBy" type="tns:userWSTO"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="AccountSummaryWSTO">
              <xs:sequence>
                   <xs:element minOccurs="1" name="accountId" type="xs:long" />
                   <xs:element minOccurs="1" name="accountNumber" type="xs:string" />
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="userWSTO">
              <xs:sequence>
                   <xs:element name="userId" type="xs:long" />
                   <xs:element name="userLoginId" type="xs:string" />
                   <xs:element name="userTypeId" type="xs:short" />
              </xs:sequence>
         </xs:complexType>
    </xs:schema>';
    dbms_xmlSchema.registerSchema(schemaurl => 'TFSWebService_schema.xsd',
    schemadoc => l_schema,
    enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_NONE);
    END;/
    Object Type:
    CREATE OR REPLACE TYPE DOC_ROWTYPE AS OBJECT
    REFERENCENUMBER VARCHAR2(255),
    REQID NUMBER(12),
    FROMACCOUNTID NUMBER(12),
    FROMACCOUNTNUMBER VARCHAR2(35),
    TOACCOUNTID NUMBER(12),
    TOACCOUNTNUMBER VARCHAR2(35),
    CREATEDBYUSERID NUMBER(12),
    CREATEDBYUSERLOGINID VARCHAR2(12)
    Collection Type:
    CREATE OR REPLACE TYPE DOC_TABLETYPE IS TABLE OF DOC_ROWTYPE;
    CREATE OR REPLACE PROCEDURE SP_TFS_REPORT (LoginId IN STRING,
    requestedByUser IN STRING,
    result_cursor OUT SYS_REFCURSOR)
    IS
    SYSTEM_USER VARCHAR2(12) := 'SYSTEM';
    l_http_request UTL_HTTP.req;
    l_http_response UTL_HTTP.resp;
    l_string_request VARCHAR2(1024);
    l_result_xml XMLTYPE;
    docExtTable_XML DOC_TABLETYPE := DOC_TABLETYPE();
    docExtRecord DOC_ROWTYPE;
    BEGIN
    l_string_request := .....(prepare web service request here)
    l_http_response := UTL_HTTP.get_response(l_http_request);
    resp_in_xml := XMLTYPE(l_clob_response);
    INSERT INTO TEMP_RESULT VALUES l_result_xml;
    SELECT DOC_ROWTYPE (t1.referenceNumber, t1.reqId, t2.accountId, t2.accountNumber, t3.accountId, t3.accountNumber,
                                                 t4.userLoginId, t4.userId)
    BULK COLLECT INTO docExtTable_XML
    FROM TEMP_RESULT ltr,
    XMLTABLE('/TFSResponse/TFS'
    PASSING ltr.object_value
    COLUMNS
    referenceNumber VARCHAR2(255 BYTE) PATH 'referenceNumber',
    reqId NUMBER(12)                PATH 'reqId',
    fromAccountXML XMLTYPE PATH 'fromAccount',
    toAccountXML XMLTYPE      PATH 'toAccount',
    createdByXML XMLTYPE      PATH 'createdBy'
    ) t1,
    XMLTABLE('/fromAccount'
    PASSING t1.fromAccountXML
    COLUMNS
    accountId NUMBER(12) PATH 'accountId',
    accountNumber VARCHAR2(35 BYTE) PATH 'accountNumber'
    ) t2,
    XMLTABLE('/toAccount'
    PASSING t1.toAccountXML
    COLUMNS
    accountId NUMBER(12) PATH 'accountId',
    accountNumber VARCHAR2(35 BYTE) PATH 'accountNumber'
    ) t3,
    XMLTABLE('/createdBy'
    PASSING t1.createdByXML
    COLUMNS
    userId NUMBER(12) PATH 'userId',
    userLoginId VARCHAR2(12 BYTE) PATH 'userLoginId' ----- This value should be set based on a condition*
    ) t4
    OPEN result_cursor FOR SELECT * FROM TABLE (DOC_TABLETYPE);
    COMMIT;
    END SP_TFS_REPORT
    The condition is like this
    IF (requestedByUser = true and createdByUserType = '2') then
    CREATEDBYUSERLOGINID := SYSTEM_USER;
    ELSE
         Take CREATEDBYUSERLOGINID from XML value 'userLoginId'
    where 'requestedByUser' is the input parameter to the stored procedure and 'createdByUserType' is the value from XML.
    'userTypeId' is not required to be set in collection.
    Now my question is how to put that condition when doing the XML parsing.
    Edited by: 991900 on Mar 19, 2013 9:54 AM

    Add a projection for "userTypeId" in T4, then use a CASE statement in the SELECT clause :
    SELECT  DOC_ROWTYPE (
            t1.referenceNumber, t1.reqId, t2.accountId, t2.accountNumber, t3.accountId, t3.accountNumber,
                                            t4.userId,
            CASE WHEN requestedByUser = 'true' AND t4.userTypeId = 2
                      THEN system_user
                 ELSE t4.userLoginId
            END
    BULK COLLECT INTO docExtTable_XML
        FROM TEMP_RESULT ltr,
        XMLTABLE('/TFSResponse/TFS'
                   PASSING ltr.object_value
                   COLUMNS
                       referenceNumber    VARCHAR2(255 BYTE)        PATH 'referenceNumber',
                       reqId              NUMBER(12)                   PATH 'reqId',                                       
                       fromAccountXML      XMLTYPE                  PATH 'fromAccount',                 
                       toAccountXML        XMLTYPE                     PATH 'toAccount',
                       createdByXML       XMLTYPE                     PATH 'createdBy'                                       
                    ) t1,
        XMLTABLE('/fromAccount'
                   PASSING t1.fromAccountXML
                   COLUMNS
                       accountId              NUMBER(12)    PATH 'accountId', 
                       accountNumber     VARCHAR2(35 BYTE)  PATH 'accountNumber'                                       
                   ) t2,
        XMLTABLE('/toAccount'
                   PASSING t1.toAccountXML
                   COLUMNS
                       accountId            NUMBER(12)    PATH 'accountId', 
                       accountNumber   VARCHAR2(35 BYTE)  PATH 'accountNumber'
                   ) t3,
        XMLTABLE('/createdBy'
                   PASSING t1.createdByXML
                   COLUMNS
                       userId           NUMBER(12)        PATH 'userId',
                       userLoginId      VARCHAR2(12 BYTE) PATH 'userLoginId',
                       userTypeId       NUMBER            PATH 'userTypeId'
                   ) t4
        ;

Maybe you are looking for

  • Custom RTF templates in Oracle Core Contracts ..

    Hello: We want to create custom RTF templates in Oracle Core Contracts along with custom data templates. We do not want to use XSL-FO templates since we are finding this too complex to work with ... also the fact that the XML data is being generated

  • How to Enable Pushbutton at runtime in MPP

    Hi Expert, I have problem in the following scenario.. I design screen say '0230' and set property of one push button(Show) is invisible. I am calling screen '0230' multiple time based on run time. When I calling screen '0230' in third time I want to

  • Apple Mobile Device Support Error in iTunes 8.2.0.23 FIX

    Okay, after I installed the 8.2.0.23 version of iTunes and tried to plug in my iPhone, I got a message stating essentially that the version of Apple Mobile Device Support is wrong, and to uninstall AMDS and iTunes and reinstall them. Of course, after

  • Unable to connect to Page Server when viewing Crystal Report

    Have just moved from Crystal Enterprise 10 to Crystal Reports Server XI R2 and encounter the following error when attempting to view an instance of a report in Crystal Reports format: CrystalReportViewer The Page Server you are trying to connect to i

  • [SOLVED] Upgrades broke glibc

    At least I think that's what happened. I usually upgrade with a 'yaourt -Syu --aur --devel', select no to edit PKGBUILDs, and if it's been a while opt not to use existing sources and instead downloading everything again. I've now got a whole schwack