Generate items in a list in an XML file

If I have a xml file called temp.xml as
< object id = "Item #1" data = 'Something1' >
< object id = "Item #2" data = 'Something2' >
< object id = "Item #3" data = "Something3" >
< object id = "Item #4" data = "Something4" >

and in my flex application, I have a < mx:List... / > what is the best way to fill the list items in the xml file?
Thank you

I guess I wasn't too clear, but I found the answer to what I was looking for.

In my list, I can set the dataProvider of the ListItems array and call my loadmyXML() method


Import mx.collections.ArrayCollection;

public var listItems:ArrayCollection = new ArrayCollection();

public function loadmyXML (): void {}
var loader: URLLoader = new URLLoader();
loader.addEventListener (Event.COMPLETE, handleComplete);
Loader.Load (new URLRequest ("some.xml"));
}

private void handleComplete(event:Event):void {}
try {}
var toolsXML:XML = new XML (event.target.data);
This will just display the xml code in the console
trace (toolsXML);
for each (var items: XML in toolsXML.elements ())
{
Add each element from the xml code in the table
var something: Object = new Object();
Something.label = in stock;
listItems.addItem (something);
}
}
catch(e:TypeError)
{
trace ("cannot parse text for XML");
trace (e.message);
}
}
]]>

Tags: Flex

Similar Questions

  • Can I automate creating a cluster in LabView using the structure of data created in a generated automatically. CSV, C header or XML file?

    Can I automate creating a cluster in LabView using the data structure created in an auto generated. CSV, C header or XML file?  I am trying to take the data structure defined in one or more of these files listed and have LabView automatically create a cluster with structure types and the same data.  (Ideally, I would like to do it with a C header file only.)  Basically, I'm trying to avoid having to create the cluster by hand, as the number of cluster elements could be very large. I looked in EasyXML and contacted the rep for the add-on.  Unfortunately, this feature was not created yet.  Did anyone done something like this before? Thanks in advance for the help.


  • IMAQdx attributes listed in the xml file not found in labview

    Hello

    Some attributes of my camera our watch camera (DALSA CamExpert) software but are not displayed in MAX.

    When I opened the xml file, I don't see a difference between the attributes shown and hidden.

    Why LabView displays all possible attributes?

    The sml file has specific requirements?

    Any ideas?

    Hello Eric,

    I solved the problem yesterday!

    I use a DALSA camera. Dalsa software downloads the XML file and saves it in a directory 'dalsa"on my local disk.

    National instruments software (MAX) downloaded XML file and saves it in another directory. The 2 files were not equal. I replaced the XML file OR the XML of Dalsa file and now I'm able to get all attributes.

    But thanks for your response!

    Kind regards

    Kim

  • Prepopulate the drop-down lists with xml file

    Hello world

    I'm trying to prepopulate a dropdown list using an xml file. There are many tutorials on the internet that allows me to do from the overview of the Designer tab. However, when I did it worked well, but I am not able to 'embed' the xml file so that the values appear in the workspace when the user starts a process.

    I tried to load the xml file with the contents of resource reading in the action profile of the first task and put the result in the "xmlPrepareData" but the problem is that I can't put all the values of the xmlPrepareData after because the xml model is not exactly the one used by LiveCycle.

    Any thoughts? Someone is already managed to prepopulate a dropdown list with an XML within the process?

    Kind regards

    Thomas

    OK gr8...

    Assuming you're able to get the XML process LC to your XDP/PDF form field.

    You can fix the XML from the drop-down under-

    clear the drop-down list box
    * DROPDOWN_Field.clearItems ();

    choiceList = XMLData.parse (* XML_Field.rawValue, false);

    divide the choiceList in an array of values

    choice = choiceList.resolveNodes("root.element[*].*NODENAME");

    var numchoices = choices.length;

    Adds an array of values in drop-down list
    for (var i = 0; i)< numchoices;="">

    {
    * DROPDOWN_Field.addItem (choices.item (i) .value);
    }

    * DROPDOWN_Field - is your field drop-down list.

    * XML_Field - is your XML data stored in a TextField.

    * NODENAME - is the name of the node in your XML to solve.

    I hope that Hepls...

    Regards-

    Chalukya.

  • form2xml generate xml files with '? ' for non-Latin characters

    I used form2xml in oracle 10 g costume to convert formulas 5 .fmb .xml. using the command:

    frmf2xml.bat OVERWRITE = YES myform.fmb

    Forms contains the set of Arabic characters, but the xml file is generated with the character "?", and the xml file is unusable ".

    What can I do to keep the Arabic characters in the generated xml files.

    Edit:

    I run form2xml on windows xp SP3 with Arabic support (codepage = 1256)

    The xml file is generated in UTF-8 format

    I solved the problem.

    Step 1: Search the registry for each NLS_Lang key and change its value to the codepage 1256 using regedit

    Step 2: in the Panel of control-region and language, I changed the language to be Arab

    Now everything is good

  • Need to remove the tags file Nullable while generating XML files

    Hello.

    I have a requirement where I have to generate an XML file, but the generated XML file does not display the tags when the column is null. An example below:

    CREATE TABLE emp_tab (emp_id NUMBER PRIMARY KEY
    name VARCHAR2 (20).
    dept_id NUMBER);
    Table created.
    INSERT INTO emp_tab VALUES (30, 'Scott', NULL);
    1 line of creation.
    INSERT INTO emp_tab VALUES (31, 'Mary', NULL);
    1 line of creation.
    INSERT INTO emp_tab VALUES (40, 'John', NULL);
    1 line of creation.
    COMMIT;

    When I generate the XML code, you can find the output like below:
    < EMPLOYEE >
    < EMP_ID > 30 < / EMP_ID >
    Scott < NAME > < / NAME >
    < / EMPLOYEE >

    I just the Worklfow Developer's Guide and the example above was taken from Page 561 and 562 by looking at the DBMS_XMLGEN.setNullHandling using DBMS_XMLGEN procedure. DROP_NULLS as a parameter.

    Now, I understand the concept, but my requirement is a little different. I get a record as my procedure parameter PLSQL type, but requires the choice of a base table, which means maybe I have to insert first the folder I get as parameter in a table of basic and then select in the same when you set the context, which is what I don't want in the DBMS_XMLGEN.newContext. This is an additional burden.

    I've previously planned to use XMLELEMENT and XMLFOREST to generate the XML file (and was rather more simple), but this requirement to remove the tags altogether when the values are NULL led me to believe that maybe I might have to go down the path of using the API DBMS_XMLGEN.

    Can you suggest a better way, replacement to achieve what I want? Or perhaps give an example on how I can get there using XMLDB?


    Thank you and best regards,
    JD

    Can I use just the XMLElement and XMLForest to achieve?

    Sure. As said, XMLForest does not create elements for NULL values:

    http://docs.Oracle.com/CD/E11882_01/AppDev.112/e23094/xdb13gen.htm#ADXDB5006

    If the expression value is null, then no element is created for this expression.

    This is the code I wrote your above mentioned suggestion discussion forum

    Yes, but this solution is taken out of context.
    Here, it is obviously preferable to not generate empty items in the first place:

    SELECT XMLElement("Address"
           , XMLForest(
               lr_addr_rec.account_name     as "AccountName"
             , lr_addr_rec.address_line_1   as "Addressline1"
             , lr_addr_rec.lot_number       as "Addressline1"
             , lr_addr_rec.address_city     as "City"
             , lr_addr_rec.address_state    as "State"
             , lr_addr_rec.address_postcode as "PostCode"
             )
           )
    FROM dual;
    
  • How to generate an xml file?

    I just starting to learn how to generate xml data with the actionscript here is what I have so far:

    var xml =
    < ErikPhotos >
    < / ErikPhotos >;

    so that {(xml.photo.length (< 20))
    var point: XML = < photo / >;
    DevBlog var = xml.photo.length () + 10001;
    Item.@name = photoIndex.toString () .substr (1);
    xml.appendChild (item);
    }

    trace (XML);

    If I followed what I get:

    < ErikPhotos >
    < name photo = "0001" / >
    < name photo = "0002" / >
    < name photo = "0003" / >
    < name photo = "0004" / >
    < name photo = "0005" / >
    < name photo = "0006" / >
    < name photo = "0007" / >
    < name photo = "0008" / >
    < name photo = "0009" / >
    < name photo = "0010" / >
    < name photo = "0011" / >
    < name photo = "0012" / >
    < name photo '0013' = / >
    < name photo = "0014" / >
    < name photo = "0015" / >
    < name photo = "0016" / >
    < name photo = "0017" / >
    < name photo = "0018" / >
    < name photo = "0019" / >
    < name photo = "0020" / >
    < / ErikPhotos >

    that is what I wanted... So far so good.  Now I want to do is make the script write a real xml file which will be in my directory after you run the script.

    If this isn't a web-based application, you can use adobe air.

  • iTunes generates a XML file.

    iTunes generates a XML file.

    https://discussions.apple.com/message/28513383#28513383 - new with iTunes 12.2 setting preferably do not create .xml

  • Wait signal generator complete the scan list before sending the next command

    I am writing a program for Agilent E4421B signal generator scan to list between a range of frequencies (ramp up to the maximum frequency and then back down to the original frequency) specified. The signal generator has only a list of 401 points, which is a problem when I want to wash over a wide frequency range. To work around this problem, I would like to perform several scans of list in a row. However, I can't figure out an effective way to "say" the program to wait until the previous scan has finished before sending a new order of scanning for the signal generator. Any ideas? For reference, I use Agilent ESG drivers series LabVIEW.

    Thank you!

    If you use standard VISA calls, I would say just that send the scan command, but add; * mutual fund? (operation ends?) make a query.  Then, run a VISA to read what's coming.  This indicates to the device to send a 1 to the output buffer when the scan is complete (or just about any other operation, also).  As you are waiting for a response, your computer will wait the amount of time to wait so he could see a response, it is not less, your way with the exact amount of time - no more - to be actually taken.

    A few warnings:

    (1) make sure that the time-out is longer than the length of most slow scan.

    (2) there are variants of the '1' being returned.  I saw '1', '01', and even "1.00E + 3" therefore to allocate more than one byte to read."

  • failure of the deletion of an item in a list

    Hello

    I am new to AIR und QNX and try to work through documentation of the RIM.

    Now, I'm at http://developer.blackberry.com/air/documentation/playbook/ww_air_developing/Create_a_list_ms_197099...

    The program creates a list. If I click on a button, it should remove an item from the list. But it doesn't work. Maybe someone has an idea why?

    Just a second question:

    Is there a difference between these two lines? Which variant is to be preferred?

    myList.removeItemAt (1);

    myList.dataProvider.removeItemAt (1);

    Here the important parts of the code:

    Import qnx.fuse.ui.listClasses.List;

    private function initializeUI (): void

    {

    arrMonth.push ({label: "Jan"});

    arrMonth.push ({label: "Feb"});

    ...

    myList.dataProvider = new DataProvider (arrMonth);

    }

    private void myButtonEvent(event:MouseEvent):void

    {

    now remove an item

    option 1: works well!

    myList.removeItemAt (1);

    HERE, THE ERROR SE PRODUCT

    option 2: does not work

    error message: the item to remove is not found

    myList.removeItem ({label: "Jan"});

    I still don't understand the etiquette thing. So I tried that, but it didn't work either

    myList.removeItem ("Jan");

    }

    Thank you very much

    Sebastian

    RemoveItem, you give him the real object that was originally registered on the data provider (pointer reference). You cannot give a new object that has the same values of the original object. If you don't, then you must create a function that makes a loop on your table of data provider and compare the unique field (usually, 'data') of the object is passed to, then call removeItemAt, based on the index in the array.

    It is also a good idea to not rely on the label to be unique in the list. AS3 convention will usually have a 'data' field that is unique for the list. The data field can then be matched to. Without it and you have multiple items with the same label, will lead to problems of selection.

  • Selecting the item in a list of images

    Hi @ll,

    I tried to get the selected item in a list of images (bbui - 0.9.2.js). If I try to get the selected item as described here

    https://github.com/BlackBerry/bbUI.js/wiki/image-list

    .. .the result is still "not defined".

    Here is my snip of code:

    var mc;
    var bb10HighlightColor = '#00A8DF';
    
    bb.init({bb10HighlightColor: bb10HighlightColor,
          bb10ActionBarDark: true,
          bb10ControlsDark: true,
          bb10ListsDark: false,
          bb10ForPlayBook: true,
    
          onscreenready: function(element, id) {
             if (id == 'dataOnLoad') {
           dataOnLoad_initialLoad(element);
        } else if (id == 'imagelist') {
                var resultList = element.getElementById('resultlist');
                for (var i = 0; i < mc.count; i++) {
                   var item = document.createElement('div');
                   item.setAttribute('data-bb-type', 'item');
                   item.setAttribute('id', mc.contactarray[i].ID);
                   item.setAttribute('data-bb-title', mc.contactarray[i].Company);
                   item.setAttribute('data-bb-img','img/company.png');
                   item.innerHTML = mc.contactarray[i].Zip + " " + mc.contactarray[i].City;
                   item.onclick = function() { onItemSelected('test'); };
                   resultList.appendChild(item);
                }
             }
          },
    
          ondomready: function(element, id) {
          }
    });  
    
    function doSearch() {
       parseJASONAndOpenList('{"count":3,"contactarray":[{"Company":"Acme Inc.","Lastname":"Jackson","Firstname":"Bill","City":"Maincity","ID":"45D6"},{"Company":"Backman Inc.","Lastname":"Burger","Firstname":"Marc","City":"Downtown","ID":"45D7"},{"Company":"Jingle Inc.","Lastname":"Sampson","Firstname":"John","City":"Outercity","ID":"45D8"}]}');
    };
    
    function parseJASONAndOpenList(jsonString) {
       mc = JSON.parse(jsonString);
       bb.pushScreen('imagelist.htm', 'imagelist');
    };      
    
    function onItemSelected(text) {
       alert(text);
       var selectedItem = document.getElementById('resultlist').selected;
       alert(selectedItem.getAttribute('id')); //selectedItem is always undefined here
    }
    

    The image list:

    
    
    
    
    
       
    Test item

    The image list holds something hard (id = "TEST1"), then I add three objects dynamically. After selecting one of the items, I would like to show more details in a new screen.

    I tried to solve in different ways, but the result of

    var selectedItem = document.getElementById('resultlist').selected;
    

    is always "not defined".

    I'm looking for any help!

    Hello!

    This javascript interface comes in 0.9.3 still not available in the version you are using.

  • By clicking on specific items in a list

    Hey there,

    I am completely new to this (development of applications in general) so I apologize if these questions seem super simple.

    I created a list that appears on the half left of my screen, and I'm trying to load a second list based on which item in the list is selected.

    I am able to get the second list is loaded, but any item is selected in the first list, it still load the same. How can I specify what loading list?

    Thanks again. I searched on the forum and read multiple adobe resources and can't seem to understand this one.

    Well, ithink there are many solutions to your problem, but in my humble OPINION.

    I would not creat the rightlist where the Manager, instead, I got creat that it outside and just sets the data provider in the array/Collection you want as a result.

    i.e.

    rightlist = new List();
    rightlist.dataProvider = myData2;
    rightlist.setSize (list.width = 512 list.height = 300);
    rightlist.setPosition (512, 300);
    rightlist.selectionMode = ListSelectionMode.SINGLE;
    rightlist.allowDeselect = true;
    rightlist. Scrollable = true;
    rightlist.scrollBarAlpha = 0.5;
    rightlist.graphics.beginFill (0x5eff62, 1);
    rightlist.graphics.endFill ();
    addChild (rightlist);

    list.addEventListener (ListEvent.ITEM_CLICKED, onClick);
    }
                
    private void onClick(e:ListEvent):void {}

    If (leftlist. SelectedIndex == 0) rightlist.dataProvider = myData2

    else rightlist.dataProvider = myData3;

    You can make the switch box or something fancy you like...
    }

    It's the easiest way I think (with the exception of the link etc). But you can do many more things facny also...

  • How to enable recent items on jump list

    Not sure if it of a problem or not. I would like a list of recent items on my list of jump (in fact, only for MS Word) in the task bar. I only have pinned files, but would like to be able to place a file in the list of recent files and PIN which as well. My problem is that I do not see the recent files on any list to jump from a program in the task bar. I went into the properties of taskbar (start menu/customize) and tried to click on the number of recent files, but it is zero and is grayed out so I can't change it. What should I do? Or is it a problem that requires a repair?

    I've seen a few discussions about this in this forum - I don't know if this is a problem, or if there is somewhere a seting I forgot to check.

    Right-click on the Start button, and then select Properties. Click on Start menu tab and check the box in front of the store and display recently items in the start menu and the taskbar.

    http://Windows.Microsoft.com/en-GB/Windows7/whats-new-with-the-Windows-7-taskbar

    http://www.SevenForums.com/tutorials/14067-Jumplist-Launcher-create-custom-jump-lists.html

  • List box and the choice list showing only 25 first items on the list

    Hi people,

    I implemented a component selectOneChoice for locations and a selectOneListbox for asset groups. Two display objects are based on relevant queries. When you try to choose a location, I see only the items in 25 list first in the drop-down list. It's the same thing with the Group of assets held as well. Queries provide a set of data that has more than 25 records of each of the db. Are there property that must be set for these components in JDeveloper? I use Jdev Studio ver 12.1.3.0.0. Please, share your ideas.

    Thank you

    25 is the size of the default range for the iterator.

    Components as selectOneChoice does not support paging so you must set this value-1 (select your iterator pageDef and replace the RangeSize property)

    Dario

  • Problem adding items to wish list

    I use ATG 10.0.3. I am trying to add items to wish list using the following code

    < dsp:form id = 'giftlist' >

    < dsp:input bean = "GiftlistFormHandler.catalogRefIds" type = "hidden" / > "

    < dsp:input bean = "GiftlistFormHandler.giftlistId" type = "hidden"

    beanvalue = "Profile.Wishlist.ID" / > "

    < dsp:input bean = "GiftlistFormHandler.productId" paramvalue = "itemId" / > "

    < dsp:input bean = "GiftlistFormHandler.addItemToGiftlist"

    Type = "submit" value = "Add to wish list" > < / dsp:input >

    < dsp:input bean = "GiftlistFormHandler.addItemToGiftlistSuccessURL"

    Type = "hidden" value="/store/wishlist.jsp" > < / dsp:input >

    < / dsp:form >


    When I submit the form, it accesses the success page. However the articles are not added to the wish list. SiteId and quantity properties were needed? Here are the logs for debugging

    00:23:50, 245 INFO [GiftlistFormHandler] DEBUG error form - stay on the same page.

    00:23:50, 245 DEBUG INFO [GiftlistFormHandler] Validating giftlist ID: gl1390002

    00:23:50, 245 INFO [GiftlistManager] DEBUG inside the getGiftlist: gl1390002

    00:23:50, 245 INFO [GiftlistFormHandler] DEBUG error form - stay on the same page.

    00:23:50, 245 INFO [GiftlistFormHandler] DEBUG error form - stay on the same page.

    00:23:50, 255 INFO [GiftlistFormHandler] not DEBUG any form error - redirect to: /store/wishlist.jsp

    After the property of GiftlistFormHandler.quantity , the elements are added to the wish list. I didn't know that the property is required in the docs. Also debug logs aren't useful.

    Here is the labour code,

         

    value = "sku40003" / >

          

    beanvalue = "Profile.Wishlist.ID" / > "

          

          

    beanvalue="/ATG/multisite/site.ID" / >

          

    value = "1" / >

          

    Type = "submit" value = "Add to wish list" >

          

    Type = "hidden" value="/store/wishlist.jsp" >

    Here are the logs

    14:01:57, 879 INFO [GiftlistFormHandler] DEBUG error form - stay on the same page.

    14:01:57, 879 DEBUG INFO [GiftlistFormHandler] Validating giftlist ID: gl1530002

    14:01:57, 879 INFO [GiftlistManager] DEBUG inside the getGiftlist: gl1530002

    14:01:57, 879 INFO [GiftlistFormHandler] DEBUG error form - stay on the same page.

    14:01:57, 879 INFO [GiftlistManager] DEBUG inside the getGiftlistItemId: giftlist id = gl1530002, skuId = sku40003, productId = prod20001, siteId = basicSite

    14:01:57, 959 INFO [GiftlistManager] DEBUG inside the getGiftlistItems: gl1530002

    14:01:57, 959 INFO [GiftlistManager] DEBUG inside the creatGiftlistItem

    14:01:57, 959 INFO [GiftlistManager] DEBUG inside the addItemToGiftlist: gl1530002, gi10003

    14:01:57, 959 INFO [GiftlistFormHandler] DEBUG error form - stay on the same page.

    14:01:57, 959 INFO [GiftlistFormHandler] not DEBUG any form error - redirect to: /store/security/accounts/wishlist.jsp

    14:01:58, 009 point find DEBUG INFO [GiftlistLookupDroplet]: id = gl1530002; type = gift registry

    14:01:58, 009 DEBUG INFO [GiftlistLookupDroplet] Found point: gift-list: gl1530002

Maybe you are looking for