analysis using XML dom

Hi all

very new development for mobile am my doubts may be stupid to you all,.

but I need your help as am new to this platform.

My requirement is, I need to parse a xml form url DOM parser and

I need to analyze the sectionname only an xml file and display them in a

ListField.when I select one of the item listfield it must navigate

next screen and parse and xml again and list the contents of the sectionname.

class VVFApplication extends UiApplication{      MainScreen _screen= new MainScreen();      String _node,_element;      Connection _connectionthread;

public static void main(String arg[]){     VVFApplication application = new VVFApplication();     application.enterEventDispatcher(); } 

public VVFApplication() {   

    _screen.setTitle("Vishwak Video Framework");    _screen.add(new RichTextField("LOADING"));     _screen.add(new SeparatorField());      pushScreen(_screen);     _connectionthread = new Connection();     _connectionthread.start();} 

public void updateField(String node, String element){ 

     String title="SectionName";     _screen.add(new RichTextField("*"+element));    // _screen.add(_listElements.addElement("*"+element) );     if(node.equals(title)){     _screen.add(new SeparatorField()); } } 

private class Connection extends Thread{     public Connection()    {        super();     } 

public void run()    { 

     Document doc;      StreamConnection conn;      try{      conn=(StreamConnection)Connector.open;       DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory. newInstance();      DocumentBuilder docBuilder= docBuilderFactory.newDocumentBuilder();       docBuilder.isValidating();      doc = docBuilder.parse(conn.openInputStream());      doc.getDocumentElement ().normalize ();      NodeList list=doc.getElementsByTagName("SectionName");     _node=new String();     _element = new String();      Object obj = Application.getEventLock();     for (int i=0;i

now, I need to have a selectable listfield, who displays the sectionname in list.and wen I select the list item, it must navigate to the next screen to display its content.

can anyone suggest me some ideas.thanks in advance

If the screen is blank, then there not all fields or fields not display anything. Show us the code for how you build the screen, how do fill you the listfield and anything else that might be relevant. More (relevant) information, it is more likely that you will receive assistance.

Did you read the documentation for ListField? In addition, RIM has several articles on listfield in the category of fields of knowledge base. There is a tutorial at http://developerlife.com/tutorials/?p=898, and a search on the web for "blackberry listfield" will many examples.

You must extract the DOM, the information that you want to view and add to the (usually an array or a vector) data structure used by a ListFieldCallback registered with the ListField. If you use the ObjectListField, it acts as its own ListFieldCallback and attracts each element as a line of text using ToString. Otherwise, you must write your own ListFieldCallback, which is pretty easy, unless you want fancy layout for each line.

Tags: BlackBerry Developers

Similar Questions

  • Analysis of XML with SAX parser

    
    
    
      
         
        
                
        
                
            
        
        
                
        
                
            
    
    
        
                
    
        
                
          
    
    
        
                
    
        
                        
    
            
                
    
        
                
        
                
    
        
                
        
    
    
    

    It comes to my XML. I am able to analyze using the DOM parser, bt I m new analysis SAX. Can someone help me to analyze it using SAX parser

    There is a snippet of Code to call the HTTP Xml & only to the analyzed using Sax parser.

    SAXParserImpl saxparser = new SAXParserImpl();
    ListParser receivedListHandler=new  ListParser();
    static DataInputStream din = null;
    public static String response;
    
        HttpConnection hc = null;
            OutputStream os;
               try
               {
                   final String url =""+ InitClass.getConnectionString()+";ConnectionTimeout=25000";
    
                   hc = (HttpConnection)Connector.open(url);
    
                   os = hc.openOutputStream();
                   os.write(postDataBytes);
    
                   if (hc.getResponseCode() == 200)
                        din = hc.openDataInputStream();
                    else
                        response = "" + hc.getResponseCode();
                    saxparser.parse(din, receivedListHandler);
               }
               catch (Exception e)
               {
    
               }
               finally
               {
                  try
                  {
                      if(din!=null)
                          din.close();
                      din = null;
                      if(hc!=null)
                          hc.close();
                      hc = null;
                  }
                  catch (Exception e) {   }
               }
    

    class Analyzer

    public class ListParser extends DefaultHandler
    {
    private String Key="";
    private  Hashtable ht=new Hashtable();
    vector vec = new Vector();
    public ListParser()
    {
    
    }
    /**
    * Gets called, whenever a Xml is start .
    */
    public void startDocument() throws SAXException
    {
    
    }
    /**
    * Gets called, whenever a Xml is End .
    */
    public void endDocument() throws SAXException
    { 
    
    }
    /**
    * Gets called, whenever a new tag is found.
    */
    public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException
    {
        if(name.equals(""))
        {
            ht = null;
            ht = new Hashtable();
        }
        else if(name.equals(""))
        {
    
        }
        Key=name;
    }
    
    /**
    * Gets called, whenever a closed tag is found.
    */
    public void endElement(String uri, String localName, String name) throws SAXException
    {
        if(name.equals(""))
        {
            vec.addElement(ht);
        }
    }
    public void characters(char[] ch, int start, int length) throws SAXException
    {
        String element=new String(ch, start, length);
        ht.put(Key, element);
    }
    }
    

    It will analyze your XML file and you will get data of vector vec in hash tables by XML tag.

  • To get the attributes of node of a node using a DOM parser

    Hi, is there an easier way to obtain the attributes of a node using a DOM parser. I do not understand the method getAttributes() because it returns NamedNodeMap where are all the getters return a node. I have just this simple xml structure:

    EditField
    First name

    For example, I am able to do "editfield" and "First name" but I want to be able to get the id attribute of matching nodes as well. The just getNodeValue() returns me null and getLocalName() and getNodeName() returns just me TYPE or a QUESTION.

    Any help please if anyone knows. Oh and I don't want to use the DOM, SAX parser. Thank you very much in advance

    I discovered how to get the attributes after some Google search and changes. It's here

    NamedNodeMap attributes = (NamedNodeMap) tempNode.getAttributes ();
    for (int = 0; g g< attributes.getlength();="" g++)="">
    Attribute attr = (Attr) attributes.item (g);
    System.out.println ("attribute:" + attribute.getName () +)
    ("with the value" + attribute.getValue ());
    }

    You do not have to use NamedNodeMap, I did not know how before. You go around casting too. Awesome, I didn't use SAX after all now

  • I can get the data of a hygrometer using the RS232 port with the following T75.2F:H17.0% using a RS232 data logger format. I was wondering if I can collect this data for later analysis using Dasylab. Any help is appreciated.

    I can collect data from a hygrometer in a text file using the RS232 port with the following T75.2F:H17.0% format, these data are collected using a data logger software. I was wondering if I can collect this data for later analysis using Dasylab. Any help is appreciated.

    The setting below causes the error. Change for the second selection, output values of all channels.

  • Save the class file using XML

    Hi-

    I made a new class for LabVIEW, and I try to save a file using XML. Attached pictures show how to create the file and how I read it, and I get the error message. I tried a variety of different methods and nothing worked so far. I was wondering if anyone had any advice or examples to save a class to file via XML.

    In the meantime, I'll use the method described here:

    http://forums.NI.com/NI/board/message?board.ID=170&message.ID=215511&query.ID=672786#M215511

    but I would prefer XML for more usability later down the line.

    I also thought just not related to the group all the data structure, recording via XML and then just group it upward and writing to an instance of the class. This seems to be more work that needs to be necessary and should be redone every time I have change the class.

    Probably, it goes without saying that I am fairly new to LabVIEW so I hope this isn't a stupid error that is obvious to the vet...

    Thanks in advance,
    Nate

    First - Sorry for wany waste of time to download the wrong screenshot in the op.

    Second - I solved it! I was about to send a screenshot of my hierarchy for you to take a look at, but that made me think. I re-arranged my hierarchy; This solves the problem.

    Now, for all those who had the same problem (Error 1527):

    The first screenshot is my original project hierarchy, which did not work.

    The second is my hierarchy updated the project that solved the problem.

    Thanks for your help!

  • Problem with pole-zero analysis using multisim

    Problem with pole-zero analysis using multisim

    Party a pole / zero analysis is linearizing circuit using an operational RODC analysis, in which a driver acts as a short circuit. The problem is that in your circuit, the inductor in parallel with a source of internal tension unit.

    Use a small resistor (1mOhm will do in your case) in series with the generator output functions to break the loop short-circuit.

  • Error trying to update the model XML using XML Publisher administrator

    Hello people,

    We are on R12.1.3

    I changed a condition in a report and you try to download the new model XML using XML Publisher administrator.

    When I click the button to apply, it is throwing an error "bad request".

    Navigation: XML Publisher Admin > data definitions > query report

    Click on the report name > click 'Update file', in addition to the data model > choose file > click Apply

    I get the below error

    Bad request

    Your browser has requested that this server could not understand.


    Now, I could not download a new model of XML.


    I'm doing something wrong.


    Kind regards

    Kris

    user10163762 wrote:

    Thanks Eugen and Hussein.

    The problem is not with the template.

    It seems to be a problem in this particular case.

    Transferred to another instance.

    However once I run the program, I can't display the output as flashes and disappears from the window of the browser.

    My colleague says, it's to do with the trusted site to download something from the browser.

    Can you please guide me on how to solve this problem?

    http://bit.LY/1k8e2vi

    Thank you

    Hussein

  • I use XML to create a custom markup language. How can I get Dreamweaver to provide advice to code?

    I use XML to create a file that is read by some devices. The used tags, their attributes, etc... are needed and I wonder if there is a way to have Dreamweaver know which tags are used, provide advice to code for each individual tag attributes, etc...

    Basically how Dreamweaver treats HTML (he knows a < select > element, for example, has only some attributes) but I want to acknowledge my tags and attributes.

    This could be useful to check http://help.adobe.com/en_US/dreamweaver/cs/extend/WS5b3ccc516d4fbf351e63e3d117f53d62b7-7ff 5 html

    You can add the code tips menus to Dreamweaver by defining them in your own XML files using the XML schema format described in this topic and placing them in the Configuration/CodeHints folder.

    best,

    Shocker

  • Generating PDF editable using XML Publisher

    Hello

    I'm trying to generate an editable pdf form of R12 using XML Publisher.  I am able to generate my PDF and load some data to it, but whenever I generate the PDF, it turns out all of my read-only form fields.  I tried to create the xdo.cfg file and place it in $XDO_TOP/resource by using the code below.

    <config version="1.0.0" xmlns="http://xmlns.oracle.com/oxp/config/">
        <!-- Properties -->
        <properties>
            <property name="all-fields-readonly-asis">true</property>
        </properties>
    </config>
    

    After that, I had my rebound DBA simultaneous server manager, but it did not work.  I don't know that if there is something else miss me.  Any help would be appreciated.

    Thanks in advance.

    Daniel

    So, I realized what my problem was.    For some reason any my xdo.cfg file in $XDO_TOP/resource has not been read. Now, I tried putting in $OA_JRE_TOP/lib and it worked.  Thanks for your help.

    Daniel

  • AR: Journal Entries report convert to Excel using XML

    Hi all

    The customer asks to add a column and change the output to Excel format (using the XML publish) the standard report "AR: Journal Entries Report" whish is generated...
    I know that the report calls another report called "Journal entries report - out" with a few parameters one of them is "P_LAYOUT_DESCRIPTION" which may be 1 of these values
    Print account details, print details by category, print summary by account, print the summary by category
    and each of them has a different layout

    Now, I want to know
    1 - the ability to add a column to this report (SPAWNED)
    2 - the ability to translate the output as EXCEL, PDF, RTF (using XML Publisher)
    I know that the steps of how convert a XML report using the definition of data and model, but the program laid 'Journal Entries report - Output' calls specific parameters and does not mention the name of the template that will be used or the type of the output model
    as if I'm going to create 4 models for each presentation how to let the main report called the output report, which gives the correct model to be displayed

    Best regards

    Amir

    Of course I used it and I created for her many models with different layouts,
    But the user needs this report especially :(

  • Long story the numbers displayed in exponential form in excel using XML Pub

    Hi all
    I'm generating bank accounts of employees using XML Publisher. In excel, long account as 1014021420701 numbers
    are displayed as 1.01402E + 12.

    Please let me know how shud we do inorder to make them appear correctly.

    Thank you

    If you use rtf model put forward = and double quotes around the field as -.
    <><+field_name+>,'"')?>. This will force Excel to treat the value as text and not to apply the number format.

    -Jeet

  • Analysis of XML, how to get a specific tag?

    Hello

    I'm new to Flex, attempts to load data from the xml file using httpservice. all right, but I don't know how to access a specific tag.

    xml mapping is shown in the image:

    imageforum.JPG

    I'm trying to access DEVICE1, dataService.Lastresult.trames.tramdevices [?] something like that. Sombody knows how? Thank you very much. I used xml with java but in flex is a little different. Thank you very much for all.

    Hi neoto,.

    Have you tried ... dataService.Lastresult.trames.tramdevices.Device1?

    Thank you

    Jean Claude

  • Miniature load using XML sequence

    Hello

    I'm still learning how to use XML to load photos and I'm confused about something. Need some advice...

    Andrei has provided a link to a tutorial and I'm having good luck with it. I have created the XML file and am load as shown below.

    Now I would like to add the duplicates of the thumbs in order to appear as a reflection. Created another charger and charge of each file again. (I tried "ldr2.content = ldr1.content" and many other versions of this statement to try and together the second content loader to do the same as the first, but could not do anything at work. So I resorted to loading new thumbs).

    Did. As well, all right. Even used the "rotationX = 180" wrong guys showed me to reverse the pictures. The value 'y' in the ldr2
    "ldr1.y - event.target.content.height 'I learned from yous as well." Got this work and have now two rows of photo thumbnails. Just looking forward to the application of a mask (something other guy showed me) to reflect really well melted.

    HOWEVER, at runtime, it load the pictures in the two rows of Chargers in a different sequence. They are displayed OK, and it would work except for the fact that the second row of pictures, those 180 degrees along their X - axis rotation - "Reflections" - are not in the same order as the first line.

    I'm probably missing a few very basic knowledge about how to do this, but I'm out of ideas. Can anyone suggest how to control the order in which the XML file is loaded while the two rows of photos (thumbs, actually) to the height? Just things load faster and seem random, even if the same XML file is used?

    Thank you!

    (Sorry, don't know how to reach code this question.)
    ====================================================

    AS3=======================
    var xmlRequest:URLRequest = new URLRequest ("DiagPMpics.xml");
    var xmlLoader:URLLoader = new URLLoader (xmlRequest);
    var imgData:XML;
    var numKids:int = 0;
    var imgNum:int = 0;
    var hite:int;
    var wit: int;
    var startX:int = 100;
    var startY: int = 100;
    var newX:int = 100;
    var newY:int = 100;
    var rawImage:String;
    var bigLoader:Loader = new Loader();
    var Xaccum:int;
    var x 2: int = agree;
    var y2:int = y + 200;


    xmlLoader.addEventListener (Event.COMPLETE, xmlLoadedF, false, 0, true);

    xmlLoader.load (xmlRequest);

    function xmlLoadedF(event:Event):void {}
    imgData = new XML (event.target.data);
    numKids = imgData. * () .length;

    while(imgNum<4) //numKids)
    {
    rawImage = imgData.pic [imgNum] .thumb;
    var ldr:Loader = new Loader();
    var refl:Loader = new Loader();
    ldr.contentLoaderInfo.addEventListener (Event.COMPLETE, kmp);
    refl.contentLoaderInfo.addEventListener (Event.COMPLETE, kmp2);
    LDR. Load (new URLRequest (rawImage));
    refl. Load (new URLRequest (rawImage));

    imgNum ++;
    }
    }

    function kmp (event): void {}

    Event.Target.Content.x = agree;
    Event.Target.Content.y = y - event.target.content.height;
    addChild (event.target.content);
    Agree += event.target.content.width + 2;

    }

    function kmp2 (event): void {}
    var sp2:Loader = new Loader();
    Event.Target.Content.x = x 2;
    Event.Target.Content.y = y + Event.Target.Content.Height + 2;
    event.target.content.rotationX = 180;
    addChild (event.target.content);
    x 2 += event.target.content.width + 2;
    }

    ==========================

    XML=======================
    <!-note: XML this file was created for a different project and the "Polish", "imgH,' 'BIGimgW', and 'BIGimgH' fields are not used here. ->

    <? XML version = "1.0" encoding = "utf-8"? >
    < photos >
    < pic >
    thumbs/1t.jpg < go > < / inch >
    images/1.jpg < big > < / big >
    < > 57 imgW < / imgW >
    < > 31 imgH < / imgH >
    < BIGimgW > 922 < / BIGimgW >
    < BIGimgH > 500 < / BIGimgH >
    < / pic >
    ...
    ==========================

    Thank you very much.

    Yes, if you do not control the loading process and just use a loop to load things in, then files can arrive in a different sequenxce than what the code says.  To control the load order you want to load images one at a time, using the completion of loading one to trigger calling charged to the other.  So in your xmlLoaded function you would simply call a function that will load one of the images rather than having the while loop.  You will assign a listener for the completion of loading and when triggered, the function he calls does that image in place, set the value of imgNum and if imgNum is not yet equal to numKids, again calls the load function.

  • Using XML with special characters - not rendered

    Hello

    I use xml to fill the contents of a Flash file, but we located the contents for different regions of the world. Thus, when the content contains special characters like 'e' that they don't appear at all in flash. I tried using & eacute; but making just the actual code...

    Is there a solution for this?

    Thank you

    Rothrock,

    With your help, I was able to determine exactly what was going on. You hit the nail head when you mentioned the police include parameters. The people who originally created the file not selected one of the Latin glyphs or no matter what foreign glyphs, so I changed it and republished.

    Another problem was that the XML of files that I saved in Homsite were detects not properly register with the UTF - 8 encoding as default does not read Homesite file encoding when you open a file. I changed the setting and now correctly saves it in a file encoded in UTF - 8. (for those who need to know how to change this setting, go to the top in the Options > settings > file settings > check the box ' Enable non ANSI file encoding. ")

    Thanks for your help, might not have thought of it otherwise!

    Edit: This accidentally marked as the answer, but Rothrock was indeed the answer n the post above...

  • Analysis of XML base using E4X syntax

    Hello

    I'm going crazy with E4X parsing. I'm trying to parse an XML document that is rather simple, but I can't seem to find a way to analyze what I need.

    I try to extract the name of vApps (VAPP only 1 in this example):

    var xmldoc = new XML(test);
    if (!xmldoc) {
      System.debug("XML PAS BON");
      var errorCode = "Invalid XML Document";
      throw "Invalid XML document";
    }
    System.debug("test 1 : "+xmldoc..AdminVAppRecord.@name);
    
    

    It's (a response to vCloud Director REST API 5.1) XML content:

    <?xml version="1.0" encoding="UTF-8"?>
    <QueryResultRecords xmlns="http://www.vmware.com/vcloud/v1.5" total="1" pageSize="25" page="1" name="adminVApp" type="application/vnd.vmware.vcloud.query.idrecords+xml" href="https://myvcloudhost.com/api/admin/extension/vapps/query?page=1&pageSize=25&format=idrecords&filter=isExpired==true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://myvcloudhost.com/api/v1.5/schema/master.xsd">
      <Link rel="alternate" type="application/vnd.vmware.vcloud.query.references+xml" href="https://myvcloudhost.com/api/admin/extension/vapps/query?page=1&pageSize=25&format=references&filter=isExpired==true"/>
      <Link rel="alternate" type="application/vnd.vmware.vcloud.query.records+xml" href="https://myvcloudhost.com/api/admin/extension/vapps/query?page=1&pageSize=25&format=records&filter=isExpired==true"/>
      <AdminVAppRecord vdcName="john-vdc" vdc="urn:vcloud:vdc:4cc245-23f0-439a-9b98-e85319106af1" storageKB="8388608" status="SUSPENDED" ownerName="system" org="urn:vcloud:org:19893ffe-b5de-40a6-9a08-307e41ac0f49" numberOfVMs="1" name="qsdqs" memoryAllocationMB="3072" isVdcEnabled="true" isInMaintenanceMode="false" isExpired="true" isEnabled="true" isDeployed="false" isBusy="false" creationDate="2013-08-02T15:01:39.260+02:00" cpuAllocationMhz="2" id="urn:vcloud:vapp:fe07c653-4848-4f03-a1f8-ddba8da13a50" honorBootOrder="false" pvdcHighestSupportedHardwareVersion="9" cpuAllocationInMhz="4000" taskStatus="success" lowestHardwareVersionInVApp="9" task="urn:vcloud:task:090db9f8-4b04-4550-a1a3-5396c4f25043" autoDeleteDate="2013-08-10T17:47:56.683+02:00" numberOfCpus="2" taskStatusName="vdcUpdateVapp"/>
    </QueryResultRecords>
    

    Could someone give me a hand on this one? I believe that an example of work would be enough for me to start the analysis correctly.

    Thank you for your help.

    A few errors here:

    1. your XML file is not correct because it contains no sequence of escape '&' characters; they should be replaced by '& '.

    2. your XML elements are in a namespace (see "xmlns" attribute), but your E4X query is not. You must define the namespace, for example

    var vcloud = new Namespace("http://www.vmware.com/vcloud/v1.5");
    

    and then the query will become

    System.log("test 1 : " + xmldoc.vcloud::AdminVAppRecord.@name);
    

    Hope this helps,

    -Ilian

Maybe you are looking for

  • files missing msi.dll in win xp sp3

    When I start my system, a panel appears 'status' and tries to install a file called status.msi.exe or dll, sometimes one or two, and it asks for the location of the file that does not exist. then I asked the system disk, which does not exist because

  • Windows 8 for Windows 8.1 upgrade

    I was told that there are a few problems to upgrade my laptop HP fram WIN 8 to 8.1 to WIN. Please tell me is it true? My laptop is: Laptop HP Pavilion 15-n042sl (ENERGY STAR) Modello:F0D82EA .. .and for example if I do not upgrade and I'm staying wit

  • C00D11C6 error message.

    Have XP. Have a lot of memory and no other programs are running. I installed Media 11 the other day, but that did not help. What to do

  • Want 5532: What cartridge to change

    E e printer told me to replace the cartridge, but I don't know whether to replace black, color or both. Can you tell me?

  • Movie Maker in Vista is only to watch boxes 4 green and purple

    Original title: my career in game - NEED HELP from WINDOWS MOVIE MAKERI have windows developer and I love using it and is very useful, BUT recently im trying to make my bmx video edit and going to use it to try to get offered and took at least 6 hour