Extract the value of the node only using XQuery

Hello

I have a xml as XMLType stored in the table. XML is,

< ocaStatus xmlns = "http://xmlbeans.apache.org/ocastatus" >
< status >
< > 990 statusCode < / statusCode >
< statusDate > 2010 - 01 - 19 < / statusDate >
< user name > OcaNimsAcf < / userId >
< comment > DocumentnotinNIMS < / comment >
< / status >
< status >
< > 990 statusCode < / statusCode >
< statusDate > 2010 - 01 - 19 < / statusDate >
< user name > OcaNimsAcf < / userId >
< comment > DocumentnotinNIMS < / comment >
< / status >
< / ocaStatus >

I use a combination of normal SQL and XQuery queries to extract data from table.
I have a requirement where I have to shoot only value of XML node as only * 990 * without tags < statusCode >.
I wonder if it's possible ass I've tried with two or three combinations of function extract().

Thank you.

Hello

Different ways to do it, assuming you want the results in a relational table.

XMLTable using:

WITH t as (
 select xmltype('

990
2010-01-19
OcaNimsAcf
DocumentnotinNIMS


990
2010-01-19
OcaNimsAcf
DocumentnotinNIMS

') doc
 from dual
)
SELECT x.*
FROM t, xmltable(
 xmlnamespaces(default 'http://xmlbeans.apache.org/ocastatus'),
 'ocaStatus/status'
 passing t.doc
 columns
  status_code number path 'statusCode'
) x;

Using the 'old' (and obsolete) XMLSequence:

WITH t as (
 SELECT xmltype('

990
2010-01-19
OcaNimsAcf
DocumentnotinNIMS


990
2010-01-19
OcaNimsAcf
DocumentnotinNIMS

') doc
 FROM dual
)
SELECT extractvalue( x.column_value,
                     'status/statusCode',
                     'xmlns="http://xmlbeans.apache.org/ocastatus"' ) as status_code
FROM t, table(
 xmlsequence(
  extract(t.doc, 'ocaStatus/status', 'xmlns="http://xmlbeans.apache.org/ocastatus"')
 )
) x;

Otherwise, targeting a specific node:

WITH t as (
 select xmltype('

990
2010-01-19
OcaNimsAcf
DocumentnotinNIMS


990
2010-01-19
OcaNimsAcf
DocumentnotinNIMS

') doc
 from dual
)
SELECT extractvalue( t.doc,
                     'ocaStatus/status[1]/statusCode',
                     'xmlns="http://xmlbeans.apache.org/ocastatus"' ) as status_code_1
FROM t;

Tags: Oracle Development

Similar Questions

  • How to extract the node where the value of the node is the max in all of the XML document?

    Hello

    I have a transaction that refers to an xmltype in iRecruitment, containing multiple versions of the same node as follows:

    (only for the example data)



    {noformat} & lt; Transaction & gt;


    & lt; data & gt;


    & lt; ObjectVersionNumber & gt; 1 & lt; / object_version_number & gt;


    & lt; EO & gt;


    & lt; Attribute1 & gt; A & lt; / Attribute1 & gt;


    & lt; Attribut2 & gt; B & lt; / attribut2 & gt;


    & lt; /EO & gt;


    & lt; / data & gt;


    & lt; data & gt;


    & lt; ObjectVersionNumber & gt; 2 & lt; / object_version_number & gt;


    & lt; EO & gt;


    & lt; Attribute1 & gt; A & lt; / Attribute1 & gt;


    & lt; Attribut2 & gt; C & lt; / attribut2 & gt;


    & lt; /EO & gt;


    & lt; / data & gt;


    & lt; data & gt;


    & lt; ObjectVersionNumber & gt; X & lt; / object_version_number & gt;


    & lt; EO & gt;


    & lt; Attribute1 & gt;? & lt; / Attribute1 & gt;


    & lt; Attribut2 & gt;? & lt; / attribut2 & gt;


    & lt; /EO & gt;


    & lt; / data & gt;


    & lt; / Transaction & gt; {noformat}

    I can extract a value for FULL-TIME 1 or 2, is not a problem.
    However, how can I go on the selection of a value of an attribute below FULL-TIME X, where X is the maximum value of FULL-TIME in any node in the XML document?

    I tried to the last node corresponding to my way, but it is not always the case that the FULL-TIME max will correspond to this scenario.

    Any help would be greatly appreciated!

    Thank you very much, Pete

    Published by: Pete Mahon on February 24, 2009 12:11

    Here's a way

    SQL> set long 100000
    SQL> with XML as (
      2  select XMLTYPE(
      3  '
      4  
      5     
      6             1
      7             
      8                     A
      9                     B
     10             
     11     
     12     
     13             2
     14             
     15                     A
     16                     C
     17             
     18     
     19     
     20             3
     21             
     22                     ?
     23                     ?
     24             
     25     
     26  ') OBJECT_VALUE
     27    from dual
     28  )
     29  select DATA, OVN
     30    from XML,
     31         XMLTable
     32         (
     33           '/Transaction/data'
     34           passing OBJECT_VALUE
     35           columns
     36           DATA XMLType path '.',
     37           OVN  number  path 'ObjectVersionNumber'
     38         )
     39   where OVN = ( select MAX(OVN)
     40                   from XML,
     41                        XMLTable
     42                        (
     43                          '/Transaction/data'
     44                          passing OBJECT_VALUE
     45                          columns
     46                          OVN  number  path 'ObjectVersionNumber'
     47                        )
     48               )
     49
    SQL> /
    
    DATA
    --------------------------------------------------------------------------------
           OVN
    ----------
    3?
    ?
             3
    
    SQL>
    
  • Is there an external link to use to restore Windows XP Home to original values? I can only use safe mode at the moment that my computer shuts down automatically (with blue screen)

    Running Windows XP home SP3. eMachines T6528 AMD Athlon 64 3500 + processor, nvidia GeForce 6100 GPU
    I downloaded and executed a double file Finder and SEVERAL files deleted by mistake.

    According to these instructions, you are not supposed to do that! Look at them again. They are on p. 137 (or p. 145). (P. 137, printed on the bottom or the p. 145 of the .pdf file!)

    Remove all the drives and physically disconnect all USB and network connections first!

    Then either start as you normally would (if you can) and select:

    Start | All programs | System recovery | System recovery

    and then click Yes.

    Or if you are unable to start up as usual, you will need to press F11 at the beginning - almost immediately after the ignition of the PC.

    THEN, when you are prompted to, you can insert the disc. :-)

  • Access the DataSocket only using nids.dll

    Hello
    I have the task to communicate to a program, written in LabView, while communicating data hit, using only the INIDSCtl and ICWData of nids.dll interfaces. Communication in the sense that I send data to the program LabView works, but I have problems receiving data. The data that are sent are a set of 4 floating values (32 bit floatingpoint). I can see in the diagnoses of Server Socket given that there really are packets sent, but I can't receive these data.
    I'm this programming in C++ using MS Visual Studio 6.0. I don't have any other tools (such as Measurement Studio).

    The labour code to send only an integer value is simple 16 bit (I removed all control error for shorter code)

    #import "C:\windows\system32\nids.dll" raw_interfaces_only, no_namespace, named_guids
    ...
    HRESULT hr = g_pNIDSCtl.CreateInstance("CWDSLib.CWDataSocket");
    ...
    ComBSTR bstrURL (_T ("dstp://localhost/emmenu_to_ts"));

    HR = g_pNIDSCtl-> put_URL (bstrURL (bstr_t));
    HR = g_pNIDSCtl-> put_AccessMode (cwdsWrite);

    b short;
    HR = g_pNIDSCtl-> SyncConnect (30000, & b);

    ICWData * pData = NULL;
    HR = g_pNIDSCtl-> get_Data (& pData);

    CComVariant varStart (short) 1;
    HR = pData-> put_Value (varStart);
    pData = NULL;

    HR = g_pNIDSCtl-> Update();

    HR = g_pNIDSCtl-> Disconnect();

    However, the code to retrieve the data that does not work is as follows

    CComBSTR BstrURL (_T ("dstp://localhost/ts_to_emmenu"));

    HR = g_pNIDSCtl-> put_URL (bstrURL (bstr_t));
    HR = g_pNIDSCtl-> put_AccessMode (cwdsRead);

    b short;
    HR = g_pNIDSCtl-> SyncConnect (30000, & b);

    ICWData * pData = NULL;
    HR = g_pNIDSCtl-> get_Data (& pData);

    CComVariant varVal;
    HR = g_pNIDSCtl-> Update();

    HR = pData-> get_Value (& varVal);
    //
    VarVal HERE is always 0, regardless of the values in the data?
    //
    pData = NULL;

    HR = g_pNIDSCtl-> Disconnect();

    My question: is it still possible to recover a table of 4 floats using only nids.dll interfaces and if yes, can someone push me in the right direction or give me some advice.

    Thanks in advance
    Peter

    Hello Peter,.

    Sorry I mixed things up... I really need a window because I wanted to be able to use INIDSCtl.SelectURL ().

    But there is no need to use DataSocket. The important things are:

    1. call CoInitializeEx() with COINIT_MULTITHREADED parameter.

    2. when 2 une fois connecte connected to the server, call INIDSCtl.GetStatus () repeatedly until it returns cwdsConnectionActive.

    3. call INIDSCtl.Update () and read your data.

    Here is a quick and dirty example you can try in conjunction with "DS Writer.vi' example:

    #define _WIN32_WINNT 0 x 0501

    #include
    #include
    #include

    #include

    #import 'nids.dll"no_namespace don't

    int main()
    {
    HRESULT hr = CoInitializeEx (NULL, COINIT_MULTITHREADED);
    {
    Instantiate DataSocket.
    DS INIDSCtlPtr;
    HR = ds. CreateInstance (__uuidof (CWDataSocket));

    To connect to the server.
    HR = ds-> ConnectTo (_bstr_t (L "dstp://localhost/wave"), cwdsRead);

    Wait until the connection is established.
    Status of CWDSStatus;
    While ((statut = ds->GetStatus()) == cwdsConnecting)
    {
    Sleep (100);
    }

    Get data.
    While ((hr = ds->Update()) == S_OK)
    {
    if(DS->GetDataUpdated() == valeur VARIANT_TRUE)
    {
    _variant_t retVal = ds->-> GetValue GetData();
    check the type of the VARIANT. It must be an array of double.
    If (V_VT(&retVal)! = (VT_ARRAY |)) VT_R8))
    throw _com_error (E_FAIL);

    Unpack the table.
    SAFEARRAY * psa = V_ARRAY (& retVal);
    If (psa is NOTHING)
    Throw _com_error (E_POINTER);

    He must have a dimension.
    If (psa-> SICGD! = 1).
    throw _com_error (E_FAIL);

    Double HUGEP * vals;
    HRESULT hr = S_OK;
    If (FAILED (hr = SafeArrayAccessData (psa, (Sub HUGEP *) & vals)))
    Throw _com_error (hr);

    for (long unsigned I = 0; i < psa-=""> rgsabound [0] .cElements; i ++)
    {
    std::cout< vals[i]=""><>
    }

    Table is no longer needed.
    If (FAILED (hr = SafeArrayUnaccessData (psa)))
    Throw _com_error (hr);
    }
    }
    }

    CoUninitialize();

    return 0;
    }

  • How to create the SQL filter using XQuery FLWOR

    It is possible to create such a FLWOR expression that will be pushed down to SQL uses 'IN SQL"filtering?

    Assuming that the following function declaration:

    declare function tns:filterOnLevels($levels_as_xs:double+) {...

    I would like to create FLWOR expression that will be pushed down to this SQL:
    Select * from LEVELS where level IN ($levels)

    And tns:filterOnLevels (1,2,3) should run statement with ' where level IN (1,2,3). Type SQL filtering owe be lowered to SQL, because the execution of the query without constraint could train with too many records.

    This expression is possible to do in XQuery/XQSE or perhaps other extensions of fn - bea?

    I'm working on ODSI/Workshop 10.3 and Oracle 10 g.

    ODSI uses multiple GOLD instead of IN because optimizers (1) rewrite 'IN' as several GOLD anyway. and (2) OR is more general than 'IN,' since 'IN' can handle that (a) equal; and (b) a single multiple-column, while GOLD can also manipulate inequalities and several columns.

    In your example...

    declare function tns:filterOnLevels($levels_as_xs:double*) {(: use ' *' instead of '+' here, the optimizer will appreciate :))}

    for $l in $levels
    for $LEVELS in LEVELS()
    where $LEVELS/LEVEL = $l
    return
    $LEVEL

    If you look at the generated query plan, it should contain...

    SELECT = from LEVELS including LEVEL? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =? LEVEL or =?

    http://download.Oracle.com/docs/CD/E13162_01/ODSI/docs10gr3/XQuery/sql_pushdown.html#wp1134043

    Integrator of data services (the announcement of best practices).

  • Problems while extracting the hours of the Date field

    Hi guys,.

    We hope that you do well.

    I am facing some problems during extraction of the hours of the date field. Here is an example of my orders table:-

    Select * from orders;

    Arrival time of Order_NO product name
    1 computer Office November 20, 10 10:10
    2 November 21, 10 17:26:34 portable
    3 22 January 11 printer 08:10

    Earlier, it is stated that the daily number of orders take place in the roll of the order, I used to write a query

    arrival_time > = trunc ((sysdate-1), 'DD')
    and arrival_time < trunc ((sysdate), 'DD')

    The above query gives me yesterday how many orders have been been held.

    Now I have the new requirement to report on every 4 hours the number of orders will be held. For example if the current time is 08:00 IST then the query must extraction from 04:00 until 08:00 how many orders took place. The report will take place at 12:00 IST which will give me an order took place from 08:00 until 12:00.

    The report will be run every 4 hours per day and generate report of orders taken place for the past 4 hours. I have a programmer who will run this query every hour, but how to understand to get the order at the request of details who arrived for the past 4 hours. I'm not able to do this using trunc.

    Can you please help me how to make this happen. I checked "Extract" also, but I am not convinced.

    Help, please.

    Thanks in advance
    Aalami

    try something like

    with testdata as (
      select sysdate - level/24 t from dual
      connect by level <11
    )
    
    select
      to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS') s
    , to_char(t, 'DD-MM-YYYY HH24:MI:SS') t from testdata
    where
    t >= trunc(sysdate, 'HH') - numtodsinterval(4, 'HOUR')
    
    S     T
    19-06-2012 16:08:21     19-06-2012 15:08:21
    19-06-2012 16:08:21     19-06-2012 14:08:21
    19-06-2012 16:08:21     19-06-2012 13:08:21
    19-06-2012 16:08:21     19-06-2012 12:08:21
    

    trunc (, 'HH') truncates the minutes and the seconds of the date.
    Extract the hour only works on timestamps
    concerning

    Published by: chris227 on 19.06.2012 14:13

  • Extracts the Date of Date part /Timestamp part

    Hello

    How to extract the party only date without the timestamp value in SQL. For example, from 2008-05-13 01:34:20, I need to extract only the 2008-05-13...


    Thank you...

    Hello

    Try

    Select to_char(SYSTIMESTAMP,'YYYY-MM-DD') DATE_EXT FROM DUAL;
    

    * 009 *.

    Published by: 009 March 14, 2010 23:30

  • Name of the node XML TreeControl

    Hello
    I have a tree control that is built using XML from an HTTP service call. Based on the node selected in the tree, I would like to add a conditional in my click function that performs an action that is different, based on the name of the XML node. I can retrieve the attributes of the node by using "mytree.selectedItem.@attribute" but I do not know how to retrieve the name of the node itself real?

    Can anyone provide me with the proper syntax?

    Thank you!

    There are two methods:
    XML. Name();
    and xml.localName ();
    I think that they the same æ unless you use namespaces.

    Tracy

  • Extract the value of the node with multiple namespace xml

    Hello

    I have to extract values in xml that includes several namepspaces. a single namespace has value of xmlns. I managed to get the value of the node for tag event where as info tag returns null.

    experrts need help.

    <? XML version = "1.0" encoding = "utf-8"? >

    < event xmlns = " " http://www.w3.org/2001/XMLSchema-instance ' >

    < data xmlns = ">

    < object >

    < eventtype > 110 < / eventtype >

    < result > < / result >

    < / object > < / data >

    < xmlns = info "> < jref > JREF < / jref >

    < / info >

    < / event >

    SELECT

    TMX.eventtype,

    TMX.result,

    TMX.jref

    of EXAMPLE_MESSAGES1.

    XMLTABLE (XMLNAMESPACES (DEFAULT 'http://www.w3.org/2001/XMLSchema-instance'), )

    ' for $i in/event/data/object

    Returns the local item: r {$i / eventtype,}

    $i / result.

    {$i / jref}'

    EXAMPLE_MESSAGES1 OF PASSAGE. XML_MESSAGE

    COLUMNS

    EVENTTYPE VARCHAR2 (30) PATH "eventtype"

    RESULT VARCHAR2 (30) PATH 'result ',.

    TMX JREF PATH VARCHAR2 (30) 'jref');

    Version of the database is 11.2.0.3.0

    Hello

    I have to extract values in xml that includes several namepspaces.

    There is only one workspace names in fact (the default value).

    Normally, an empty xmlns UN-declare a default namespace declaration is inherited from the parent node.

    So, in your example, only node belongs to the default namespace.

    In this case, when you have to walk through the nodes belonging to some namespaces and others in any namespace, do not use the DEFAULT option in the WITH XMLNAMESPACES.

    Instead, declare a prefix and use it as needed for qualify of nodes.

    Another thing:

    Returns the local item: r {$i / eventtype,}

    What what do you want with "local:" here?

    The following should give the expected results:

    SELECT TMX.*

    of EXAMPLE_MESSAGES1

    XMLTABLE)

    XMLNAMESPACES ("http://www.w3.org/2001/XMLSchema-instance" as "ns0")

    , ' / ns0:event'

    EXAMPLE_MESSAGES1 OF PASSAGE. XML_MESSAGE

    COLUMNS

    EVENTTYPE VARCHAR2 (30) PATH 'data, object, eventtype.

    , RESULT VARCHAR2 (30) PATH ' object/data/result '.

    , PATH of VARCHAR2 (30) JREF ' info/jref.

    ) TMX;

  • Use the node property to get the value of control

    Hi all

    I know that you should keep the use of local variables to a minimum in order to avoid race conditions. Is this the same problem if you using the eg property node. a digital control?

    The reason why I want to do is to keep the son of the intersection when I need to use a control on one side of the diagram across the diagram...

    Basically to make the scheme simple and enjoyable to watch.

    I hope that makes sense!

    Good day!

    Kind regards

    Tommy

    Tombech84 wrote:

    [...] Is this the same problem if you using the eg property node. a digital control? [...]

    Exactly. Perhaps, he creates the race conditions and should not be used. Using wires to connect the terminals is the approach only "Save".

    In addition, performance decreases in the following order:

    -Terminal (+)

    -variable (0)

    -property to value node set (-)

    Norbert

  • How to extract the second sysdate value using the EXTRACT function

    Hello

    I want to extract the second sysdate value using the EXTRACT function.
    When I run the following query I get an error;

    SELECT extract (second OF SYSDATE) FROM dual;

    ORA-30076: field of invalid extract for the source of the extract.

    When I do to extract the month I get the correct result.

    Is there some necessary formatting by specifying the sysdate (or any other date value) in the query. ?


    Thank you.

    You can extract only the year/month / day, day

    SQL> Select extract(year from sysdate) from dual;
    
    EXTRACT(YEARFROMSYSDATE)
    ------------------------
                        2008
    
    SQL> Select extract(day from sysdate) from dual;
    
    EXTRACT(DAYFROMSYSDATE)
    -----------------------
                         20
    
    SQL> Select extract(month from sysdate) from dual;
    
    EXTRACT(MONTHFROMSYSDATE)
    -------------------------
                           11
    
    IF you enter Minute or Seconds
    
    SQL>  Select extract(minute from sysdate) from dual;
     Select extract(minute from sysdate) from dual
                                *
    ERROR at line 1:
    ORA-30076: invalid extract field for extract source
    but with timestamp you can get the seconds
    
    SQL> select EXTRACT(second FROM current_timestamp) from dual;
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                  39.473
    
    SQL> select EXTRACT(second FROM current_timestamp) from dual;
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                  57.474
    
    SQL> /
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                  59.787
    
    SQL> /
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                    .412
    
    SQL> /
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                     .99
    
    SQL> /
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                   1.458
    
    SQL> /
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                   1.896
    
    SQL> /
    
    EXTRACT(SECONDFROMCURRENT_TIMESTAMP)
    ------------------------------------
                                   2.334
    

    Edited by: Viswarayar Maran on November 20, 2008 14:30

  • How to change the value of string clustered, to implement using the node value of property instead of writing directly on the flow of data or using the variable

    new to labview :-) and I have a problem when I want to change the value of a string in bunches, and I want to implement this using the node value of property instead of writing directly to the stream or by using the variable, enclosed is the picture.   No matter, I have change in cluster (control) or value of Popery out (indicator) cluster, the value (sensor 7) dataflow keeps unchanged even I gave the new value by value of property node. Thank you to give me some advice about this.

    Hi GerdW

    Thanks a lot for your answer. The reason I'm stubbornly tring to break the flow of DATA is: we have a test system that have about 100 screws, they have a few connected flow, some of them will be unbundling a cluster dataflow chain to check the value in order to make the different cases.  Now I want to insert user event by changing the control and influential cases during run time.

    As I initially uses a global variable (to control cases) instead of unbundle string data flow, it works well.  But then, I found there are a lot of screws that are using the string unbundle.  One of the 'lazy' means, I tried is to change the value via the property node (because that way, I did not need to find all the places where using the unbundle string and replace them with the global variable), then I noticed a problem with "dataflow", the value in the stream of cluster in fact will not be changed by changing the value of the property node.

    I did a test with VI simple (like the picture in last post), and after reading your advice, I tell myself that I need to understand the concept of "DATAFLOW" in labview, it seems that my "lazy" way can not work in this scenario.

    I have attached the criterion VI here, have you furthur suggestions on what I can do in this case?

    Mant thanks!

    Minyi

  • XMLTABLE - how to extract the value of the escape of a node as-is sequence

    Hello

    How can I me XMLTABLE leave the string value of a node like the version with escape sequence, rather than unescaping it?

    E.g.:
    select extract(xmltype('<root><test>&lt;unset&gt;</test></root>'), '/root/test/text()').getstringval() col1 from dual
    union all
    select col1
    from   xmltable('/root' passing xmltype('<root><test>&lt;unset&gt;</test></root>')
                    columns
                    col1 varchar2(20) path 'test');
    
    COL1                                                                            
    ---------------------
    &lt;unset&gt;                                                                   
    <unset>     
    NB. you will need to hit rΘpondre α and then quote my post to see the actual text; For the life of me, I can't get the forum properly displays things. In short, the string returned by the EXTRACT is escaped, while the XMLTABLE chain is unescaped.


    ETA: I looked through the standards xml from the list of available functions, and nothing seems relevant. {noformat} * scratches head * {noformat}

    Published by: Boneist on March 19, 2013 14:11

    You can emulate what do I EXTRACT / getStringVal () by projecting the node text() as XMLType and type-casting to VARCHAR2 in the SELECT clause:

    SQL> set scan off
    SQL>
    SQL> select cast(col1 as varchar2(20))
      2  from xmltable(
      3         '/root'
      4         passing xmltype('<unset>')
      5           columns col1 xmltype path 'test/text()'
      6       ) ;
    
    CAST(COL1ASVARCHAR2(20))
    ------------------------
    <unset>
     
    
  • How to use the node function call library for a function in the dll with the data SUB type

    Hi all

    I would ask for your kind help

    I am facing a problem with the call library node.

    I have a C++ (stdcall) function, which has Sub as data type

    XXXX error code (hwnd, lid, getValue, * Sub data1, * Sub data2)

    data1 and data2 types are constantly changing based on the value of 'getValue '.

    Mainly I can use the call library node several times and adapt each node according to the types of data data1, data2 and extract the values and use in the code. Here is no question. Real question is:

    My question:

    How can I use a node of library time call and make a case according to the 'getvalue', who will control the data1, data2 data type. Here I really seeking solutions.

    My tests:

    I used varaints as entry to the libray call node of the data1, data2 and selected parameters in the call libraby node as "Adapt to type. Here labview just crashed.

    I appreciate your suggestions to feedbackand.

    Thank you

    Karine

    You must allocate enough space for data1 and data2, and then pass a pointer to this space. An easy way to do this is the function to initialize table. Set the U8 type and size for the number of bytes required. Pass this array to the function as a pointer of table data.

    After the function call returns, you need to extract the data in the table. You can do it manually, but a simple approach is to use the array of bytes to a string. Then, in a housing structure, use Unflatten chain to convert the string to the correct data type. This method also converts the "endianness" which will be probably necessary; Be sure to only set all entries for unflatten correctly.

  • Read the nodes that have the same value as the subnodes - XML

    It is more of a general JAVA / XML problem, but given that it is going into my BlackBerry app I thought I'd see if anyone knows.

    Consider a simple XML document:

                        Whatever 1                   Whatever 2               Whatever 3       
    

    Using the standard org.w3c.dom, I can get the nodes in X by the practice...

    NodeList fullnodelist = doc.getElementsByTagName ("x");

    But if I want to go to the next set of 'e', I try to use something like...

    Element element = (Element) fullnodelist.item(0);NodeList nodes = pelement.getElementsByTagName("e");
    

    EXPECTED back '3' nodes (because there are 3 series of 'e'), but it returns '9' - because it gets all entries including the 'e' apperently.

    It would be nice in the above case, because I could probably go through and find what I'm looking for. The problem I have is that when the XML file looks like the following:

                whatever              Something Else                    whatever              Something Else            
    

    When I ask 'e' value, it returns 4, instead of (what I want) 2.

    I am simply not understand how DOM parsing works? Generally, in the past I used my own XML documents so I name never articles like this, but unfortunately this isn't my XML file and I don't have the choice to work like this.

    What I thought I would do, it is write a loop knots "drills down" so that I can combine each node...

      public static NodeList getNodeList(Element pelement, String find)
        {
            String[] nodesfind = Utilities.Split(find, "/");
            NodeList nodeList = null;
    
            for (int i = 0 ; i <= nodesfind.length - 1; i++ )
            {
                nodeList = pelement.getElementsByTagName( nodesfind[i] );
                pelement = (Element)nodeList.item(i);
            }
    
            // value of the nod we are looking for
            return nodeList;
        }
    

    .. While if adopted you ' s/e' in the service, he would return the 2 nodes I'm looking (or elements, perhaps I'm using the wrong terminology?). on the contrary, it returns all the 'e' nodes in this node.

    Anyway, if anyone is still with me and has a suggestion, it would be appreciated.

    Well, there is no doubt that there is a learning curve robust for XML programming. You can take an hour or two and go through one of the tutorials that are circulating on the net. (Like that of w3schools.com.)

    Basically, almost everything in XML is a node, the Document that returns the parser. The API for node tells you that you can test the node type you have by calling getNodeType, which returns one of the constants of type node (Node.ELEMENT_NODE, Node.TEXT_NODE, etc..) If necessary, you can then convert the variable to the corresponding interface (element, text, etc.).

    Similarly, the API documentation say you for any node, calling getChildNodes (or for an element node or Document getElementsByTagName) will give you a NodeList (a little non-types of nodes in the XML API), while calling getFirstChild and getNextSibling to any node will give you another node (or null ).

    Once you learn the API, writing logic of course is not all that hard. For example, if the only 'e' interest tags are those directly under the element root of the document (as shown in your example) you can simply go to them directly:

    Vector getTopENodes(Document doc) {  Vector vec = new Vector();  NodeList nodes = doc.getDocumentElement().getChildNodes();  int n = nodes.getLength();  for (int i = 0; i < n; ++i) {    Node node = nodes.item(i);    if (node.getNodeType() == Node.ELEMENT_NODE &&        "e".equals(node.getNodeName()))    {      vec.addElement(node);    }  }  return vec;}
    

    Note that this example does not assume that all children are nodes of element 'e '. the document could have comments, white space or something else that makes it into the DOM as comment, text or any other type of node.

    On the other hand, if you want to capture every "e" tag which is directly under the ' tag, no matter the level, then you need to do something a little more complicated (it's on the top of my head - no guarantee):

    static class NodeListImp implements NodeList {  private Vector nodes = new Vector();  public int getLength() {    return nodes.size();  }  public Node item(int index) {    return (Node) nodes.elementAt(index);  }  public add(Node node) {    nodes.addElement(node);  }}
    
    NodeList getTargetNodes(Document doc) {  NodeListImp list = new NodeListImp();  getTargetnodes(list, doc.getDocumentElement(), false);  return list;}
    
    void getTargetNodes(NodeListImp list, Node node, boolean parentIsS) {  if (node.getNodeType() == Node.ELEMENT_NODE) {    // node name is tag name for element nodes    String name = node.getNodeName();    if (parentIsS && "e".equals(name)) {      list.add(node);    }    parentIsS = "s".equals(name);    for (Node child = node.getFirstChild();         child != null;         child = child.getNextSibling())    {      getTargetNodes(list, child, parentIsS);    }  }}
    

    I hope that it gets the idea across.

Maybe you are looking for

  • I can't update my iPhone to IOS 9.3.1

    I can't update my iPhone to IOS 9.3.1 6. Can U help me please?

  • Toshiba virtual Store account Reset - 17807

    Hello Please reset my account virtual store Toshiba 17807. Thanx

  • Unable to start my laptop

    Hello! I have a huge problem, and I would be grateful if someone could help me please. I was afraid that I had a virus on my laptop, so I installed Avast!. He successfully installed and asked me if I wanted to analyze the computer on the next boot. I

  • Satellite L30-10 X - instead of shown 80 GB 73 GB only

    Hi all! I just bought a computer laptop L30-10 X and I had a few problems for the three days that I used it. When I saw the origin of supply, the laptop stated to have a 80 GB HARD drive. When I started it for the first time, I saw that the HARD driv

  • Restore Windows XP to factory settings

    I have a HP Compaq d220 and I want to restore Windows XP to its factory setting, the problem is I can't find the CD anywhere, but I still have the license number. What I still have to buy windows again or can I download it? I tried the site HP and Wi