parsed xml data to store as an object & display in listfield

I am new bie to java of bb.

I've analyzed online xml.


      S1-C558-1
     Gold


       http://www.something.com/images/jewel/1_1.jpg
     


       http://www.something.com/images/jewel/1_1.jpg
     


       http://www.something.com/images/jewel/1_1.jpg
     

My code:

_listElements = new Vector();
_listField = new ListField();
                
ListCallback _callback = new ListCallback();
_listField.setCallback (_callback);
                
Add (_listField);

doc.getDocumentElement () .normalize ();
                
List of NodeList = doc.getElementsByTagName("*");
_node = new String();
element = new String();
                
          
for (int i = 0; i)<>
Node value = list.item (i).
getChildNodes () .item (0);
_node = List.Item (i) .getNodeName ();
element value = .getNodeValue ();
updateField (_node, element);
} //end for

' public void METTREAJOURCHAMP (String node, string element) {}
Jewel jewel = new Jewel();
int k = 0;
If (node. Equals ("Ref"))
{
_refference = element;
k ++ ;
}

If (node. Equals ("Matt"))
{
         
_material = element;
k ++ ;
             
}
If (node. Equals ("P1"))
{
_listElements.addElement (element);
_img1 = element;
               
k ++ ;
}
If (node. Equals ("P2"))
{
_img2 = element;
k ++ ;
}
If (node. Equals ("P3"))
{
_img3 = element;
k ++ ;
}
         
jewel.setRef (_refference);
jewel.setMat (_material);
jewel.setPic1 (_img1);

If (!) () element is nothing))
{
updateList (jewel, k);
Dialog.Inform ("no:" + k);
_listElements.addElement (Jewel);
}
reloadList();
         
}

dataListrow print all 5 listdata, I want only one line jewel object

' public void drawListRow (list ListField, Graphics g, int index, int y, int w)
{
Jewel jewelToDraw = _listElements.elementAt (index) (jewellery);
int drawColor = Color.GRAY;
g.setColor (drawColor);
g.drawText (jewelToDraw. getRef() + "" + jewelToDraw. getMat(), 0, 0, w);

}

class Jewel
{
private String _ref;
private String _mat;
private String _pic1;
private String _pic2;
private String _pic3;
 
public (to jewel)
{
//
}

public String getRef()
{
return _ref;
}
public String getMat()
{
return _mat;
}

public String getPic1()
{
Return _pic1;
}
    
public String getPic2()
{
Return _pic2;
}
public String getPic3()
{
Return _pic3;
}
    
    
public void setRef (String str)
{
_ref = str;
}
public void setMat (String str)
{
_mat = str;
}
Public Sub setPic1 (String str)
{
_pic1 = str;
}
Public Sub setPic2 (String str)
{
        
_pic2 = str;
}
Public Sub setPic3 (String str)
{
        
_pic3 = str;
}
    
}

can any help to show only one line instead of the line 5 data object.

Thanks to resolve...

Tags: BlackBerry Developers

Similar Questions

  • Reading XML data into the dynamic text object

    XML... < Quesiton > there is a long line of text from the XML file. < / Question >

    I have an XML file that I've read in a long line of text. I tried to format the string of information with a line break. Have tried to use < br / > and setting the text as htmlText and works except there is an empty line between the sentances. Tried to use the \n and affecting the text object just text, but that brings the \n in the text string.

    Any suggestions how to make text coming to have a line break?

    Well guess what? I've just entered my code and added in my XML CDATA, as I had done before but this time it worked! GO figure... Thanks for the suggestion.

  • Parsing xml and store the details in the hierarchical tables

    Hi all

    I'm trying to parse a xml code and store the details in the hierarchical tables, however, I am unable to analyze the child attributes of tags and store the details in relational format.

    Oracle - 11.2.0.4 version

    My XML looks like in below:

    <Root>
    <ParentTag name="JobName" attrib1="Text" attrib2="SomeOtherText">
      <ChildTag childAttrib1="SomeValue1" childAttrib2="SomeValue2" />
      <ChildTag childAttrib1="SomeValue3" childAttrib2="SomeValue4" />
      <ChildTag childAttrib1="SomeValue5" childAttrib2="SomeValue6" />
    
      <OtherChildTag childAttrib1="SomeValue1" childAttrib2="SomeValue2" />
    </ParentTag>
    </Root>
    
    

    The table structure is as follows:

    create the table parent_details
    (
    job_id number primary key,
    VARCHAR2 (100) job_name,.
    job_attrib1 varchar2 (100),
    job_attrib2 varchar2 (100)
    );

    create the table child_details
    (
    child_id number primary key,
    number of parent_job_id
    child_attrib1 varchar2 (100),
    child_attrib2 varchar2 (100),
    Constraint fk_child_details foreign key (parent_job_id) refers to parent_details (job_id)
    );

    After analysis, I would expect the data to be stored in the format below:

    Table Name:-
    parent_details
    ID Name     Attribute1  Attribute2
    1  JobName  Text        SomeOtherText
    
    
    ChildTable (Store Child Tag details)
    ID Parent ID Attribute1  Attribute2
    1  1         SomeValue1  SomeValue2
    2  1         SomeValue3  SomeValue4
    3  1         SomeValue5  SomeValue6
    
    

    I tried following SQL, but it does not work. Please suggest if the same SQL can be improved to get the details in the expected format or should I use another solution.

    select job_details.*
      from test_xml_table t,
           xmltable ('/Root/ParentTag'
                      passing t.col 
                      columns 
                        job_name varchar2(2000) path '@name',
                        attribute1 varchar2(2000) path '@attrib1',
                        attribute2 varchar2(2000) path '@attrib2',
                        childAttribute1 varchar2(2000) path '/ChildTag/@childAttrib1'
                    ) job_details;
    

    I'm not forced to have a SQL solution, but would if it can be in SQL.

    Kind regards

    Laureline.

    Post edited by: Jen K - added the SQL, I tried to build.

    Well, the XML contains hierarchical data, and SQL is a "dish" of data, so it's up to you to treat lines that are coming out of the flat style and determine how to get that in separate tables.

    Suppose that we have several nodes of ParentTag each containing several nodes of ChildTag...

    SQL > ed
    A written file afiedt.buf

    1 with t (xml) as (select xmltype ('))
    2
    3
    4
    5
    6
    7

    8
    9
    10
    11
    12

    13
    ') of double)
    14-
    15 end of test data
    16-
    17 select x.p
    18, x.name, x.attrib1, x.attrib2
    19, including
    20, y.childattrib1, y.childattrib2
    21 t
    22, xmltable ('/ Root/ParentTag ')
    23 passage t.xml
    p 24 columns for ordinalite
    25, path name varchar2 (10) '. / @name'
    26, path of varchar2 (10) of attrib1 '. / @attrib1 '


    27, way to varchar2 (10) of attrib2 '. / @attrib2 '
    28 children xmltype road '.'
    29                 ) x
    30, xmltable ('/ ParentTag/ChildTag ')
    passage 31 x.children
    c 32 columns for ordinalite
    33, path of varchar2 (10) of childattrib1 '. / @childAttrib1 '
    34 road of varchar2 (10) of childattrib2 '. / @childAttrib2 '
    35*                ) y
    SQL > /.

    P NAME ATTRIB1 ATTRIB2 C CHILDATTRI CHILDATTRI
    ---------- ---------- ---------- ---------- ---------- ---------- ----------
    1 text JobName SomeOtherT 1 SomeValue1 value2
    1 text JobName SomeOtherT 2 SomeValue3 SomeValue4
    1 text JobName SomeOtherT 3 SomeValue5 SomeValue6
    JobName2 TextX SomeOtherT 1 SomeValue6 SomeValue8 2
    JobName2 TextX SomeOtherT 2 SomeValue7 SomeValue9 2

    Using the 'ordinalite' gives us the line number for this node in the XML file, so that you can identify each parent as well as to say who is the first record of this parent (because it will have a child with the ordinalite 1).

    An INSERT ALL tuition assistance we can insert into two different tables at the same time to keep related data... for example

    SQL > create table tbl1 (pk number, name varchar2 (10), attrib1 varchar2 (10), attrib2 varchar2 (10))
    2.

    Table created.

    SQL > create table tbl2 (parent_pk number, attrib1 varchar2 (10), attrib2 varchar2 (10))
    2.

    Table created.

    SQL > insert all
    2 when c = 1 then
    3 in the tbl1 (pk, attrib1, attrib2)
    4 values (p, attrib1, attrib2)
    When 5 1 = 1 then
    6 in the tbl2 (parent_pk, attrib1, attrib2)
    7 values (p, childattrib1, childattrib2)
    8 with t (xml) as (select xmltype ('))
    9
    10
    11
    12
    13
    14

    15
    16
    17
    18
    19

    20
    ') of double)
    21 select x.p
    22, x.name, x.attrib1, x.attrib2
    23, including
    24, y.childattrib1, y.childattrib2
    25 t
    26, xmltable ('/ Root/ParentTag ')
    27 passage t.xml
    p 28 columns for ordinalite
    29, path name varchar2 (10) '. / @name'
    30, path of varchar2 (10) of attrib1 '. / @attrib1 '
    31, path of varchar2 (10) of attrib2 '. / @attrib2 '
    32 children xmltype road '.'
    33                 ) x
    34, xmltable ('/ ParentTag/ChildTag ')
    passage 35 x.children
    c 36 columns for ordinalite
    37, path of varchar2 (10) of childattrib1 '. / @childAttrib1 '
    38, path of varchar2 (10) of childattrib2 '. / @childAttrib2 '
    39                 ) y
    40.

    7 lines were created.

    SQL > select * from tbl1;

    PK ATTRIB1 ATTRIB2 NAME
    ---------- ---------- ---------- ----------
    1 text JobName SomeOtherT
    2 JobName2 TextX SomeOtherT

    SQL > select * from tbl2.

    PARENT_PK ATTRIB1 ATTRIB2
    ---------- ---------- ----------
    1 SomeValue1 value2
    1 SomeValue3 SomeValue4
    1 SomeValue5 SomeValue6
    SomeValue6 2 SomeValue8
    SomeValue7 2 SomeValue9

  • Store XML data in tables

    Hello

    I must write a procedure which takes the XML data and inserts in some tables.

    If the XML format is fixed so I can use the extract for analysis and can insert in the tables.

    But the problem is not fixed the XML format.

    Y at - it no integrated package that supports the xml for analysis data...

    Can you please suggest me in this case.

    Thank you
    Vinod

    >

    Hi vinod,

    I must write a procedure which takes the XML data and inserts in some tables.
    If the XML format is fixed so I can use the extract for analysis and can insert in the tables.
    But the problem is not fixed the XML format.
    Y at - it no integrated package that supports the xml for analysis data...

    You will have to do a little reading. I would recommend that you start here
    http://docs.Oracle.com/CD/B10500_01/AppDev.920/a96621/adx20ppl.htm (if all else fails, read the docco!  ;))
    http://www.Oracle-base.com/articles/9i/parse-XML-documents-9i.php
    http://www.quovera.com/whitepapers/downloads/xml_oracle.PDF
    http://anononxml.blogspot.IE/2010/12/methods-to-parse-XML-per-Oracle-version.html
    http://www.orafaq.com/wiki/XML

    orafaq and oracle-base are good global Oracle sites.

    You can also look at [url http://forums.oracle.com/forums/forum.jspa?forumID=34] here - the XML DB forum.

    HTH,

    Paul...

    Vinod

  • Update the XML data store

    Hello experts,

    I've created an interface when an xml file is reversed in the form of a source data store. Xml data are pumped into a target of oracle db. All this goes well.

    I'm creating a scenario where I get an xml file from a ftp server on a daily basis (with agent). This new xml file has the same structure as that already used in the interface. The question is: How can I update the data in the xml data store?

    I tried to replace the original xml file, but it does not work and cdc does not seem to apply here, I searched for quite a while now.

    Thank you very much!

    Yves

    Hello

    See if that helps
    XML for the interface Oracle even insert County regardless of input XML file

    Thank you
    Fati

  • Parsing XML and get the required data only using PLSQL

    Hi friends,

    I have a XML data

    < MAJOR_LINE >

    < LINEID > 143424538 < / LINEID >

    nom_element < ITEMNAME > = < / ITEMNAME >

    < > 78245 ITEMPATH < / ITEMPATH >

    < QUANTITY > 10 < / QUANTITY >

    < MINORLINE >

    < LINEID > 143424799 < / LINEID >

    TCC_ITEM_NAME < ITEMNAME > < / ITEMNAME >

    < > 78245 ITEMPATH < / ITEMPATH >

    < QUANTITY > 10 < / QUANTITY >

    < MINORLINE LINEID = "123456_line_id" xmlns = "xxyyzz" >

    < message > < / message >

    < status > < / status >

    < covered_Product_line_id > '123_coveredProductLineID '.

    < / covered_Product_line_id >

    < itemName > < / itemName >

    < quantity > < / quantity >

    "< service lineId ="456_service_line_id">."

    "< covered_Product_line_id >"123_coveredProductLineID"

    < / covered_Product_line_id >

    < productAttributes / >

    < itemType > < / itemType >

    < itemPath > < / itemPath >

    < coveredProducts childProductLineId = "" / > "

    < / coveredProducts >

    < parentCoverage / >

    < / service >

    < / MINORLINE >

    < / MINORLINE >

    < / MAJOR_LINE >

    I want to extract only the Covered_product_line_id and the Service_line_id of the above XML format, these data can come from any where in the xml file and the xml can be any length.

    First we need to find the covered_product_line_id and the service_line_id associated with line_id, (as I pointed out in bold) here only a single pair i showed, but it can be in any number. (Note the line_id is inside the tag).

    #PLSQL

    Help, please.

    Thanks in advance

    Hey Odie,

    Me do string literal too long error:

    Select x.*

    from xmltable)

    XmlNamespaces(default ')

    , ' for $i in //serviceLine

    , $j in $i / coveredProduct

    Returns the element r {}

    $i / lineId

    , $j/childProductLineId

    }'

    from xmltype (')

    45146937

    N20

    1

    63090598

    CON-S

    1

    SNT

    UCS - IOM

    342544294

    N20-FW012

    342544295

    342544294

    UCS-IOM2

    1

    N20-C6508-UPG:

    45146937

    CON-S

    1

    SNT

    342544295

    N20-FW012

    1

    N20-C6508-UPG:

    45146937

    CON-SN

    1

    SNT

    342544296

    FET - 10G

    16

    N20-C6508 - UPG:U SC EXPERIENCE

    342544297

    UCSB-5108-PKG-FW

    1

    N20-C6508-UPXPANSION O

    342544298

    N20-CBLKP

    2

    N20-C6508 - UPG:0 - CBLKP

    342544299

    N01-UAC1

    1

    N20-C6508 - UPG:N01 - UAC1

    342544300

    N20-CBLKI

    1

    N20-C6508 - UPG:U HC EXPANSION OPT: N20-CBLKI

    342544301

    N20-FAN5

    8

    N20-C6508 - UPG:U HC EXPANSION OPT: N20-FAN5

    342544302

    N20-CBLKB1

    6

    N20-C6508-UPG-CBLKB1

    342544303

    N20 - CAK

    1

    N20-C6508-OPT: N20 - CAK

    342544304

    UCSB-B420-M3-D

    1

    N20-C6508-UP-B420-M3-D

    63090594

    CON-SNT-B420M3D

    1

    SNT

    UCS-UC-E5-4617

    342544305

    UCS-ML-1X324RY-A

    342544306

    342544305

    UCS-UC-E5-4617

    2

    N20-C6508 - UPG:PU - E5-4617

    342544304

    CON-SNT-B420M3D

    1

    SNT

    342544306

    UCSRY-A

    2

    N20-C624RY-A

    342544304

    CON-SNT-B420M3D

    1

    SNT

    342544307

    UCS0MS

    1

    N FIO-1600MS

    63090595

    CON-SNT-FIOB16MS

    1

    SNT

    342544308

    N2KD

    4

    N20-C6LKD

    342544309

    UCSB-HS-01-EP

    2

    N20-C65B-HS-01-EP

    342544310

    N1K-VSG-UCS-BUN

    1

    N20-C6508 - UPG:U-BLA1K-VSG-UCS-BUN

    342544311

    VSG-VLEM-UCS-1

    1

    N20-C6508 - UPG:U BLN1K BUN: VSG-VLEM-UCS-1

    63090596

    CON-SAU-VSGUCS

    1

    SAU

    342544312

    N1K-VLEM-UCS-1

    1

    N20-C6508CS-BUN: VMW N-UCS-1

    63090597

    CON-SAU-VLEMUCS

    1

    SAU

    342544313

    UCSB-ACDV

    2

    N20ACDV

    342544314

    R2XX-DMYMPWRCORD

    2

    PWRCORD N20 - C6

    ')

    columns for the ordinalite seq_id

    , path number child_product_line_id "childProductLineId".

    , service_line_id number path "lineId.

    ) x ;

  • The use of SQLite to store the JSON object

    Hello

    Can someone guide on how to store a JSON object returned after the use of the Adobe provide parser JSON which returns the native object

    as

    resultobject = JSON.decode (data)

    Where the data is a JSON string.

    The 'result' object is a complex subject, but I would like to keep this object because it is in the SQLite database.

    I tried BLOB for the column type but doesn't seem to work to store this object. Ideally, I prefer to use this way to avoid the redesign of the main code as I am currently using the SharedObject method.

    Any ideas?

    Can you just store the data as a BLOB string?

  • Widget to the Web service, parsing XML

    I worked on the communication with my web services and back to my widget.

    By using the code below, I was able to perform a GET and repay the XML, but I can't find data where I expect it to be node-wise when parsing XML. I return an object with 3 variables attached to it. I expect to be child nodes 1, 2, and 3. They proved to be 1, 3 and 5 nodes.

    Any ideas on why or how? I feel I'm missing just a simple thing in all of this.

    XML response

    
    - http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
      1000
      Test Station
      105.285
      
    

    The widget code

    //****************** Ajax Logic ******************
    var xmlHttp;
    function getStationUpdate() {
    
        alert("in station update");
        xmlHttp = new XMLHttpRequest();
    
        var Posturl = "http://MachineIPGoesHERE:51107/Service1.asmx/HelloWorld2?";
        alert("after post url");
        xmlHttp.onreadystatechange = updateData;
        alert("after onReadyStateChange");
        xmlHttp.open("GET", Posturl, true);
        alert("after GET");
    
        xmlHttp.send(null);
    }
    
    function updateData() {
        if (xmlHttp.readyState == 4) {
            alert(xmlHttp.responseText);
            parser = new DOMParser();
            var xmlDoc = parser.parseFromString(xmlHttp.responseText, "text/xml");
    
            alert(xmlDoc.documentElement.childNodes[1].tagName + " " + xmlDoc.documentElement.childNodes[1].childNodes[0].nodeValue);
            //alert(xmlDoc.documentElement.childNodes[1].childNodes.length);
            //alert(xmlDoc.documentElement.childNodes[1].hasChildNodes());
            //alert(xmlDoc.documentElement.childNodes[2].hasChildNodes());
            //alert(xmlDoc.documentElement.childNodes[2].tagName + " " + xmlDoc.documentElement.childNodes[2].childNodes[0].nodeValue);
            alert(xmlDoc.documentElement.childNodes[3].tagName + " " + xmlDoc.documentElement.childNodes[3].childNodes[0].nodeValue);
            alert(xmlDoc.documentElement.childNodes[5].tagName + " " + xmlDoc.documentElement.childNodes[5].childNodes[0].nodeValue);
    
            alert(xmlDoc.documentElement.childNodes.length);
        }
    

    Web service

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Services;
    using System.Xml.Serialization;
    
    namespace WebService1
    {
        /// 
        /// Summary description for Service1
        /// 
        [WebService(Namespace = "http://tempuri.org/")]
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
        [System.ComponentModel.ToolboxItem(false)]
        // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
         [System.Web.Script.Services.ScriptService]
        public class Service1 : System.Web.Services.WebService
        {
    
            [WebMethod]
            public string HelloWorld()
            {
                return "Hello World";
            }
    
            [WebMethod]
            public myTestObj HelloWorld2()
            {
                myTestObj test = new myTestObj();
                return test;
            }
        }
    
        [Serializable]
        public class myTestObj
        {
            private int _StationID;
            private string _StationName;
            private double _Volume;
    
            [XmlElementAttribute(Order = 0)]
            public int StationID
            {
                get
                {
                    return this._StationID;
                }
                set
                {
                    this._StationID = value;
                }
            }
    
            [XmlElementAttribute(Order = 1)]
            public string StationName
            {
                get
                {
                    return this._StationName;
                }
                set
                {
                    this._StationName = value;
                }
            }
    
            [XmlElementAttribute(Order = 2)]
            public double Volume
            {
                get
                {
                    return this._Volume;
                }
                set
                {
                    this._Volume = value;
                }
            }
    
            public myTestObj()
            {
                StationID = 1000;
                StationName = "Test Station";
                Volume = 105.285;
            }
        }
    }
    

    > Any ideas on why or how? I feel I'm missing just a simple thing in all of this.

    White space nodes?

  • Can I create an XSD from XML data into a CLOB?

    Environment:


    Oracle 11.2.0.3 EE on Solaris.


    Highly an XML newbie so please be nice!

    I spent the past few days pouring through the documentation and various articles, including this one, but... I need help.

    I am trying to extract XML data stored in a CLOB and produce a flat file for the user's consumption.

    They sent me what they think is the XSD for XML data, but when I look at the data in the CLOB I don't see tags in the XSD.

    I would like to produce a XSD based on real data to compare with what they sent.

    Is this possible?

    I am able to query XML data using the tags that I see in data using XMLTable and it works fine.

    Any help is greatly appreciated.

    -gary

    Welcome to the side of the world, where you're going to love it and curse, like any other piece of XML technology.

    So if I understand correctly, the scope of your operation is to extract information from an XML file and then write this information to the disk, correct?

    A few questions

    -Why did the XML stored in a CLOB instead of an XMLType column?  Without knowing the history of the system, it is a pertinent question.

    -What size are the XML?  I ask this question, it is because when the XML is stored in the columns of XMLType (relational structure object or XML BINARY SECUREFILE format), then Oracle can parse the XML much more easily when it is stored as a CLOB.  If the XML is small enough, you can see no difference in performance between the two.

    The Oracle DB itself has no built in the ability to generate a schema from an XML file.  To do this, you need to use a third-party tool that has this feature in.  For example, XML Spy can do.  Other tools as well, but that's what comes to mind first is what I use.  The only thing to remember is that the scheme he built is only an XML instance.  Other XML instances can be different and not valid against the schema you generated, but still valid against the original schema unknown.

    You can save the schema in the database and then use the XML to create an XMLType instance related to the schema and then validate the XML in this way.  An example XML DB FAQ and here's another one Re: validation of XML schema

    Hope that helps you continue.

  • XML data. Extraction of elements and attributes using Xpath or another?

    Hi experts,
    With the help of Oracle 11 g.
    I have an XML table that stores XML in a column (xml_col) like the structure below.
    Example:
    <measure id="abc">
      <data-elements>
        <data-element id="ab">
          <value>40</value>
        </data-element>
        <data-element id="cd">
          <value>8</value>
        </data-element>
        <data-element id="ef">
          <value>38</value>
        </data-element>
        <data-element id="gh">
          <value>32</value>
        </data-element>
      </data-elements>
    </measure>
    I tried constantly to run XPath queries on this column to get the node < element > attribute data and the value of the < value > node in.

    My goal is to turn this into a table of:

    AB | 40
    CD | 8
    EF | 38
    GH | 32


    My mind is stuck on him doing this below and dressing with a CSV file to query hierarchical lines. I can't convert xmltype in chain to do this work so.
    select str1,str2 from (
    select extract(xml_col, 'string-join(//@id, '','')') str1
    ,extract(xml_col, 'string-join(//value, '','')') str2
    from xml_temp_table)
    CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (str1, '[^,]+')) + 1;
    But I get the following error:

    ORA-31011: XML parsing failed
    ORA-19202: an error has occurred in the processing of XML
    LPX-00607: Invalid Reference: "string-join".

    I am looking for a solution not PL.

    Any suggestion is appreciated.
    Thank you

    Published by: chris001 on February 26, 2013 12:06

    Published by: chris001 on February 26, 2013 12:07

    chris001 wrote:
    My mind is stuck on him doing this below and dressing with a CSV file to query hierarchical lines. I can't convert xmltype in chain to do this work so.

    Oh boy!

    This should relieve your pain ;)

    SQL> select x.*
      2  from xml_temp_table t
      3     , xmltable(
      4         '/measure/data-elements/data-element'
      5         passing t.xml_col
      6         columns element_id  varchar2(10) path '@id'
      7               , element_val number       path 'value'
      8       ) x ;
    
    ELEMENT_ID ELEMENT_VAL
    ---------- -----------
    ab                  40
    cd                   8
    ef                  38
    gh                  32
     
    
  • Problem of Parsing XML

    Hi all

    I have a XML Data...

    As

    
    
        
        
        
        
        
        
        
        
        
        
    
    
    

    I want to get the name of node and its values...

    But I'm not able to analyze and get access those.

    I tried using DOM parser.

    Everyone please help.

    Thanks and greetings

    Stephenson

    Similar to what manojkbaghela wrote:

    DocumentBuilderFactory docFact = DocumentBuilderFactory.newInstance ();
    DocumentBuilder docBuilder = docFact.newDocumentBuilder ();

    Doc document = docBuilder.parse ({inputSource file});
    doc.getDocumentElement () .normalize ();
    NodeList listOfRecords = doc.getElementsByTagName ("node");
    int totalElements = listOfRecords.getLength ();

    for (int s = 0; s< totalelements;="" s++)="">

    Element myElement = listOfRecords.item (s) (element);

    LinkID = myElement.getAttribute ("LinkID") string;
    String subject = myElement.getAttribute ("Topic");
    Position of the string = myElement.getAttribute ("heading");

    }

  • Loading XML data in ListView of C++ after extraction of http data

    I'm sorry did searh but could not find any refrence related to my problem
    I am trying to load the xml data returned from a web service HTTP Post QNetworkRequest and QNetworkReply in c ++.

    My XML that gets donwloaded is as

    
     http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://tempuri.org/">
      
        tu7652
        F
        Marry
        Wijaya
      
      
        23
        F
        Marry
        Wijaya
      
    
    

    In My QML, it comes to the ListView can say SearchResult.qml

    ListView {
              objectName: "resultlist"
              dataModel: feedsdatamodel
              listItemComponents: [
                ListItemComponent {
                            type: "item"
                            PeopleListItem {
                                name: ListItemData.givenName + ", " + ListItemData.sn
                                role: ListItemData.ExtFunction
                                leftPaddingText: 40
                            }
                        }
               ]
            }
     attachedObjects: [
           // The data model that contains the content of a XML file
            GroupDataModel {
                id: feedsDataModel
                sortingKeys: [
                    "givenName"
                ]
                grouping: ItemGrouping.None
            }
        ]
    

    PeopleListItem.qml

    import bb.cascades 1.0
    
    Container {
        property alias name: titleLabel.text
        property alias role: functionLabel.text
        property alias leftPaddingText: textcontainer.leftPadding
    
        layout: StackLayout {
            orientation: LayoutOrientation.TopToBottom
        }
        preferredWidth: 768
        preferredHeight: 135
        Container {
    
            id: textcontainer
            topPadding: 10
    
            layout: StackLayout {
                orientation: LayoutOrientation.TopToBottom
            }
            Label {
    
                id: titleLabel
                textStyle.base: SystemDefaults.TextStyles.TitleText
                textStyle.color: Color.Black
            }
            Label {
                id: functionLabel
                textStyle.base: SystemDefaults.TextStyles.BodyText
                textStyle.color: Color.Gray
            }
        }
        Divider {
            verticalAlignment: VerticalAlignment.Bottom
        }
    }
    

    This is the function I'm using to display the QML it is called from main.qml and works correctly.

    void PeopleFinder::onSearchClicked() {
        qDebug() << "PeopleFinder::PeopleFinder::onSearchClicked::\t" << "begin";
        qDebug() << "PeopleFinder::PeopleFinder::onSearchClicked::\tfname:"
                << m_fname << "\tlname:" << m_lname;
    
        // Create a network access manager and connect a custom slot to its
        // finished signal
        mNetworkAccessManager = new QNetworkAccessManager(this);
    
        // create a data model with sorting keys for lastname and firstname
        Q_ASSERT(
                connect(mNetworkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestFinished(QNetworkReply*))));
    
        //Load the bew QML file of Search from here
        QmlDocument *qml = QmlDocument::create("asset:///SearchResults.qml").parent(
                this);
        qml->setContextProperty("peoplefinder", this);
    
        Page *mypage = qml->createRootObject();
        qml->setParent(mypage);
        qDebug() << "PeopleFinder::PeopleFinder::onSearchClicked::\t s444444";
    
        // Retrieve the activity indicator from QML so that we can start
        // and stop it from C++
    //  mActivityIndicator = mypage->findChild("myIndicator");
    
        // Retrieve the list so we can set the data model on it once
        // we retrieve it
        mListView = mypage->findChild("resultlist");
    
        mNavigator->push(mypage);
    }
    

    Once the page loads in the QML it call the launch request providing c ++ file and once the
    query is completed under function is called with the data. I checked that data are downloaded properly

    void PeopleFinder::requestFinished(QNetworkReply* reply) {
        qDebug() << "PeopleFinder::PeopleFinder::requestFinished::\t"
                << "response received";
        // Check the network reply for errors
        if (reply->error() == QNetworkReply::NoError) {
    
            // Open the file and print an error if the file cannot be opened
            qDebug() << "PeopleFinder::PeopleFinder::requestFinished::\t"
                    << "No error";
    
            // Write to the file using the reply data and close the file
            QByteArray xml = reply->readAll();
            qDebug() << "Data: \n" << xml;
    
            // load the xml data
            XmlDataAccess xda;
            QVariant list = xda.load(xml, "ArrayOfPeople");
    
            qDebug() << "List:::\n" << list;
    
            GroupDataModel *datamodel = (GroupDataModel*)mListView->dataModel();
            // add the data to the model
            datamodel->clear();
            datamodel->insertList(list.value());
            datamodel->setSortingKeys(QStringList() << "givenName" << "sn");
            qDebug() << "PeopleFinder::PeopleFinder::requestFinished::\t"
                    << "Datamodel set size:: " << datamodel->size();
    
            // Set the new data model on the list and stop the activity indicator
    
        } else {
            qDebug() << "\n Problem with the network";
            qDebug() << "\n" << reply->errorString();
        }
    }
    

    But now, the real problem begins as in how to convert QByteArray data type of QVariantList which can be loaded into the datamodel
    I don't want to write the data to the XML file and then pass that as a list his will is very slow, once I move test environment to the production environment.

    Please help me solve this problem

    I got it to work using xml parsing with QXmlStreamReader

  • Parsing XML and get the attributes of a tag

    Hello

    When parsing XML for application of Cascades in C++, I am able to get the value of a tag as follows:

    00000

    But I also want to get the attributes of a tag:

    But I don't know how to get the 'CA' and 'California' attributes with my current code.  Can anyone help?  Here is the code I use to parse the XML code:

    void CMController::requestFinished(QNetworkReply* reply) {
    
        if (reply->error() == QNetworkReply::NoError) {
    
            QXmlStreamReader xml;
    
            QByteArray data = reply->readAll();
            xml.addData(data);
    
            QString zip;
            QString id;
            QString location;
    
            while (!xml.atEnd() && !xml.hasError()) {
    
                /* Read next element.*/
                QXmlStreamReader::TokenType token = xml.readNext();
    
                /* If token is just StartDocument, we'll go to next.*/
                if (token == QXmlStreamReader::StartDocument) {
                    continue;
                }
    
                /* If token is StartElement, we'll see if we can read it.*/
                if (token == QXmlStreamReader::StartElement) {
    
                    if (xml.name() == "zip") {
                        zip = xml.readElementText();
                    }
    
                    if (xml.name() == "id") {
                        ???
                    }
    
                    if (xml.name() == "location") {
                        ???
                    }
    
                }
    
            }
    
            emit succeeded(result);
    
        } else {
            emit failed();
        }
    
        reply->deleteLater();
    
    }
    

    Thank you!

    I found a working example:

    if(xml.name() == "state"){
        QXmlStreamAttributes attrib = xml.attributes();
        QStringRef ref = attrib.value("location");
        qDebug() << "location: " << ref;
    }
    
  • extract data from blob field containing xml data big

    I'm working on Oracle 11 g 2, 11.0.2.0.3. UNIX database server.

    my oracle instance receive large xml data service web ftp, I put this file as blob in a table called TBL_ALERT_XML (ID_ALERT NUMBER, DATE of the TIMESTAMP_ALERT, ALERT_XML BLOB).

    My goal is to get data of BLOB content e file put in one or more other tables.

    I try with the opening of a cursor on

    SELECT XMLTYPE (UTL_RAW.cast_to_varchar2 (ALERT_XML)). Extract (' alerts/points/point / / Text () ') threads

    OF TBL_ALERT_XML

    without any filter on ID_ALERT.

    But I get the error:

    ORA-22835: buffer too small for to CHAR CLOB or BLOB to RAW conversion



    Please help me, thank you very much

    Because the web service is deployed in python and my co worker is not able to call a stored procedure with the parameter xmltype, but only with the setting of the BLOB.

    If you can't get around it, so be it. All the less, using CLOB would be better.

    However, which prevents you to convert BLOB XMLType entry within the stored procedure and store it in an XMLType column.

    To do this, simply use the XMLType of BLOB.

    create table tbl_alert_xml)

    number of id_alert

    date of timestamp_alert

    alert_xml xmltype

    );

    insert into tbl_alert_xml

    values)

    1

    sysdate

    xmltype (p_blob

    , nls_charset_id ('AL32UTF8') - put the encoding of the file here

    )

    );

    Then, you will be able to execute queries optimized using XMLTABLE.

  • How to get the XML from the Request of Java object before sending. SOAP Web services

    I'm building Java request to Online Web Services and we'll call it application A . I got the WSDL forms the second part of the file in order to communicate with their application and we'll call it application B .

    Of the WSDL file generate the Java required classes that are Requests and Responses . classes Application A will send some request object after setting the parameters required and with the exception of response object of application B .

    The connection is established and the two applications A and B communicate with each other.

    Question:

    Of application A How can I get the xml data (or text file) for the request object before sending it to application B ?

    As described the connection is passing Java object such as request and I know that in some point this request will be converted to xml file. How to get it?

    -EDIT-

    Missing important information which can be confusing.

    I'm generated the Java rating were generated using the Axis framework

    The problem is solved by, add the following statements in the bindingStub class that was automatically generated from the WSDL file to the web-services you are trying to access.

       String request = _call.getMessageContext().getRequestMessage().getSOAPPartAsString(); 
     String response = _call.getMessageContext().getResponseMessage().getSOAPPartAsString();
    

    These statements should be placed after the following method call _call.invoke otherwise you will get NullPointerException .

    _callis a variable of type org.apache.axis.client.Cal and it is automatically generated byAxis

Maybe you are looking for

  • Toshiba virtual Store account Reset - 33929

    Can you please reset my account 33929THANKS, DALIBOR [email protected] email address

  • iWnn IME

    I found this app on my bike e... It is supposed to be on nexus devices, so why is it on a motorcycle?

  • How to change the icon tdms?

    Hello for reasons unknown, some of my tdms files - have different icons when I open the tdms files in Diadem. Some have an hourglass icon and only change the icon when I click on the sign '+' of the folder itself. Someone knows this problem and how c

  • G62Notebook HP G62-341NR PC: G62-341NR

    The problem is that the video light keeps going on this unit. Actually I Can shine a flashlight and you can see what is on the screen, but it's as if there is a blackout on it. I don't know what the problem is or how to fix it. He does intermittently

  • question of ListField remove the last element

    Hi all! Is there a known problem in ListField which explains the revival of an OutOfboundException when removing an element from a list with a single element? When you use listField.delete () I get this exception when the screen tries to set the focu