Reading from external XML source

Hi all,
I'm a noob at Flex but trying to learn.
I encountered a problem that i can't seem to fix.
I'm invoking an HTTPService like this:
Header 1
<mx:HTTPService id="searchName"url="
{compexUrl}"result="searchHandler(event)"
resultFormat = "
e4x">
 <mx:request xmlns="">
 <api_key>xxxxxxxx</api_key>
 </mx:request></mx:HTTPService>
Where compexUrl =
http://test/ + platform + "/" + searchTerms;
My searchHandler is like this:
[Bindable] 
public var item:XMLList = null; 
private function searchHandler(event:ResultEvent):void{item=
new XMLList(event.result);}
And the xml returned has the following aspect:
<?xml version="1.0" encoding="UTF-8" ?>
- <games xmlns="http://api.gamesradar.com">
- <game>
<id>20060418113640115000</id>
- <name>
- <![CDATA[ God Hand ]]>
</name>
</game>
- <game>
<id>2005120717012468975830</id>
- <name>
- <![CDATA[ God of War ]]>
</name>
</game>
- <game>
<id>20070510133243896018</id>
- <name>
- <![CDATA[ God of War Betrayal [mobile] ]]>
</name>
</game>
- <game>
<id>20060313151238825080</id>
- <name>
- <![CDATA[ God of War II ]]>
</name>
</game>
- <game>
<id>2005120717012341705322</id>
- <name>
- <![CDATA[ GoDai Elemental Force ]]>
</name>
</game>
- <game>
<id>2005120717012453155517</id>
- <name>
- <![CDATA[ Godzilla Save The Earth ]]>
</name>
</game>
- <game>
<id>20070918144248206042</id>
- <name>
- <![CDATA[ Godzilla: Unleashed ]]>
</name>
</game>
</games>
I want to populate my var item with all the values of the tag name but i can´t seem to figure out how?
Can you help me please?

Hi thanks for your reply but thats not the answer, i've tried that already....
My problem was that i had a namespace in my tags, aparently it changes the way we can access the attribute value
<games xmlns="http://api.gamesradar.com">
One way to deal with this namespace is to acces the variable like this:
var ns:Namespace = new Namespace("http://api.gamesradar.com");
item = XML(event.result).ns::game.*::name;
After i solved this issue i stumble upon another one, i wanted to put those results in a dataGrid like this:
 <mx:DataGrid x="10" y="101" width="786" id="searchInfo" dataProvider="{item}">
<mx:columns>
<mx:DataGridColumn headerText="Título" dataField="name"/>
<mx:DataGridColumn headerText="Identificador" dataField="id"/>
</mx:columns>
</mx:DataGrid>
Well Flex doesn't let me do that so i followed another route.....i simply removed the namespace from my xml with this function:
 public function result(response:Object):XML{
var xmlString:String;
var xmlnsPattern:RegExp;
var namespaceRemovedXML:String;
var responseXML:XML;
// get the XML payload
if(ResultEvent(response).result is XMLList){response = ResultEvent(response).result
as XMLList;}
else{response = ResultEvent(response).result
as XML;}
// convert it to a stringxmlString = response.toXMLString();
// define the regex pattern to remove the namespaces from the stringxmlnsPattern =
new RegExp("xmlns[^\"]*\"[^\"]*\"", "gi");// remove the namespaces from the string representation of the XMLnamespaceRemovedXML = xmlString.replace(xmlnsPattern,
// set the string rep. of the XML back to real XMLresponseXML =
new XML(namespaceRemovedXML);
return responseXML;}
Finally my handler was working and putting the values in my dataGrid by changing it to:
[Bindable]
public var item:XMLList = null;
private function searchHandler(event:ResultEvent):void{
item=result(event).game;

Similar Messages

  • Crystal Report that reads from an XML file Datetime or Date

    I have a Crystal Report 2008 that reads from an XML file, the source File XML Date data looks like this: 2008-03-10
    But the Crystal Report interpreted by datatime, I need the Crystal Report to look like this: 2008/03/10 (date) not 2008-03-10T00:00:00-05:00 (datatime)
    Look at an example (source file xml, report, and parameter file to execute report) at url: http://www.5websoft.com/sample.zip
    Import the file in the design and will to verify that interpret incorrectly the fields of type date as datetime
    not mapped currently for fields..
    Help.....
    Thanks!

    You could always reformat the field to only display the date portion:
    Format Field > Date and Time tab; choose the date style you need here.
    Or create a formula to extract just the date and use this field in your report:
    date({table.field})

  • Image coming from an xml source and on which we can't click...

    Hi everybody !
    Is it possible in LiveCycle Designer ES 8.2 (or in coming version of the software) to disable the click event on ImageField ?
    I read that it is not possible yet but there is may be another solution to proceed to have an image coming from an xml source and on which we can't click.
    Thanks.

    Hi,
    Yes , you can disable image field by setting acces value to readOnly.
    Example:
         imageField1.access = "readOnly";
    It works for Adobe Reader 9
    Best regards,
    Paul Butenko

  • How to read an external XML file in a indesign Plugin?

    Hi All,
    Can you please guide in reading an external XML file in a indesign Plugin in MAC system. I am an windows user.We are using this file for reading some inputs.
    Thanks,
    Daniel

    Hello Daniel,
    I am uncertain about the actual question. If you are developing a plug-in or otherwise interfacing with the guts of ID, I suggest asking the question in the SDK forum:
    InDesign SDK Forum
    Otherwise, what is it you are wanting to know concerning importing XML into InDesign?
    Mike

  • How to operate 3d model in adobe reader from external program

    Is it possible to operate 3d model with adobe reader from external program?
    Such as selecting a spefic node of 3d model and and highlighting it in adobe reader.
    Thanks a lot!

    Thanks Irosenth,
    One thing I am still not quite sure. Do you mean I can use "Acrobat 3D API" to create the plugin? But seems the  "Acrobat 3D API" only works with
    Acrobat Pro Extended. 
    That means the plugin will not be able to work with adobe reader. Is that correct?
    Or do you mean any other API which work with the reader?
    Thanks.

  • Help Required on Reading an External XML file in flex

    Hi Experts
    I want some help regarding flex.
    I want to read an external xml file in flex and want to show
    different datas in different components
    So bacically i need what is the procedure to call an external
    xml file and the procedure to catch the value of the xml tags and
    the option (options means ex: "id" or "type inside" "row" tag ) in
    side the xml file.
    Here is My xml file named "skn_organ.xml"
    <?xml version="1.0" encoding="UTF-8"?>
    <slide>
    <r>7</r>
    <c>8</c>
    <row id="A01" type="g">
    <organ>Skn</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="A02" type="g">
    <organ>Brt</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="A03" type="g">
    <organ>Spl</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="A04" type="g">
    <organ>Lnode</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="A05" type="g">
    <organ>Ske</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="A06" type="g">
    <organ>Lun</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="A07" type="g">
    <organ>Sgl</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="A08" type="g">
    <organ>Liv</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="B01" type="g">
    <organ>Gal</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="B02" type="g">
    <organ>Pan</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="B03" type="g">
    <organ>Ton</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="B04" type="g">
    <organ>Eso</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="B05" type="g">
    <organ>Sto</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="B06" type="g">
    <organ>Sto</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="B07" type="g">
    <organ>Sbl</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="B08" type="g">
    <organ>Col</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="C01" type="g">
    <organ>Skn</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="C02" type="g">
    <organ>Brt</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="C03" type="g">
    <organ>Spl</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="C04" type="g">
    <organ>Lnode</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="C05" type="g">
    <organ>Ske</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="C06" type="g">
    <organ>Lun</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="C07" type="g">
    <organ>Sgl</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="C08" type="g">
    <organ>Liv</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="D01" type="g">
    <organ>Gal</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="D02" type="g">
    <organ>Pan</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    <row id="D03" type="g">
    <organ>Ton</organ>
    <link>
    http://www.designgarbage.com</link>
    </row>
    </slide>

    Hi sanjivsutar,
    Put your xml file under folder "assets", the application demo
    is as following
    ====================================================================
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    initialize="init()">
    <mx:Script>
    <![CDATA[
    private var mainXML:XML;
    private var loader:URLLoader;
    private function init():void {
    loader = new URLLoader();
    loader.addEventListener(Event.COMPLETE, onComplete);
    loader.load(new URLRequest('assets/skn_organ.xml'));
    private function onComplete(evt:Event):void {
    mainXML = new XML(loader.data)
    out.text += "xml loaded, using E4X syntax: \n\n";
    out.text += "Row 1: "+mainXML.row[0]+"\n"
    out.text += "Row 6: organ = "+mainXML.row[5].organ+"\n"
    out.text += "Row(id='D02'): link =
    "+mainXML.row.(@id=="D02").link+"\n"
    ]]>
    </mx:Script>
    <mx:TextArea id="out" width="400" height="300"/>
    </mx:Application>
    ======================================================================
    Jeffrey

  • Read from an XML previously created by LabView

    Hi everyone,
    My problem is, as the title says, I need to read Data from an XML file, if the file does not exist, LabView creates it. So far it works. After the creation though, when I go through the subroutine again and want to read the data back from the XML file, it brings me the Error Code 1006 and tells me something about not being able to read it since "the XML-Tag isn't the same type as the type of the variable connected." (roughly translated from German)
    The Variable I want to read something back to is a Cluster consisting of 2 Clusters constisting of 1) two numeric elements and 2) a string and a 1-D array of 12 numeric element.
    The part that's confusing me is, that LabView saved the data itself w/o problems and in its own XML format. So it shouldn't really bring up any problems reading it back to the same variable, now should it?
    If anyone has an answer, I'm happy about anything, this has been driving me nuts the whole day
    Thanks in advance and Regards,
    Pedro
    Solved!
    Go to Solution.

    Hi,
    sorry for my vague description, lets try to fix this:
    For writing the XML-File, I use "Write To XML File.vi", the LabView standard XML writing VI.
    For reading from it again, I use "Read From XML File.vi", also the LabView standard.
    My LabView version is 8.5
    I'll attach some pictures and the created XML file which I hope will be of help.
    "Limits Template.png" is my Cluster to save the data in. As I said previously, the data was written from this very cluster, yet it cannot be read back to it. As you can see in there, the array is created correctly with 12 elements and their corresponding sizes.
    Thanks in advance,
    Regards,
    Pedro
    EDIT: checked again, the error code indeed is 1106
    Attachments:
    Limits Template.png ‏13 KB
    test123788_Limits.txt ‏2 KB

  • Reading from an xml file

    Hi All,
       I want to read an xml file and add that many checkboxes with the names specified in xml.
    Can anybody please share a working sample code please
    Thanks,
    Ravisha

    If this post answers your question or helps, please mark it as such.
    Greg Lafrance - Flex 2 and 3 ACE certified
    www.ChikaraDev.com
    Flex / AIR Development, Training, and Support Services
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
      <mx:XML id="xml" source="data1.xml"/> 
      <mx:XMLListCollection id="xlc" source="{xml..item}"/>
      <mx:Repeater id="rp" dataProvider="{xlc}">
        <mx:CheckBox label="{rp.currentItem}"/>
      </mx:Repeater>
    </mx:Application>
    <?xml version="1.0" encoding="utf-8"?><items>
      <item>check1</item>
      <item>check2</item>
      <item>check3</item>
    </items>

  • How do you direct EXS24 to read from External drive?

    my logic pro EXS24 is not reading from My external drive. How do i create a path??

    Hi Nastushka
    Glad you liked the website, it's my intention to keep updating over time and I hope people continue to find it useful. I was very lucky when I started out that lots of very smart people helped me out, so it's nice to continue the tradition.
    In answer to your question.
    To the best of my knowledge there's no way to have the actual .exs files on an external drive and have Logic still see them. My understanding is that Logic performs a number of "scans" on start up, during this process it checks a number of preset locations and then adds the files it finds to your available tools.
    The good news is that the .exs files are relatively small, so they shouldn't eat in to your hard drive space too much. It's the audio ( wav or aiff ) that takes up all the space.
    For example I have Pure E-Basses on my laptop ( from which I'm typing ) and the whole folder of .exs files is 6.5meg the related samples folder is 2.52gig.
    Ok, moving into speculative mode, _I haven't tried this myself_, if you absolutely must have the .exs files on an external drive I can think of no logical reason this couldn't be achieved with the judicious use of an Alias. So you'd create an Alias of the .exs files and put these in the correct location for Logic to scan and point these Aliases to the original files on your external HD.
    Unfortunately I'm not in a position to test this at the moment.
    Maybe somebody could chip in if they've tried it ?
    I'd also suggest that if you don't have enough room on you internal HD for the .exs files you may have bigger problems down the line. All HDs ( in my experience ) need a reasonable percentage of free space to work at their best.
    I'll copy this into the other thread, it may be sensible to continue this discussion in one thread from now on.
    James

  • Thread to read from external program

    Hello Fellows,
    Here it is, I'm trying to interact with other programs using Labview 8.0.
    I have read lots of messages on Active X and threads to understand a bit on that functionnalities and can't figure out if I could or not do my program.
    So image explains better than words, please look at the attached file to see my issue.
    Other question is about the the Open System Command Pipe.vi, read From Pipe.vi, Close Pipe.vi etc. Are these vi's able to create a vrtual COM port as a pipe ?
    And is this Vis available in LabVIEW 8.0 Full Dev ?
    Thanks for your reply....see you
    Attachments:
    ExplainPipe.jpg ‏41 KB

    Hi
    The Open System Command Pipe.vi, read From Pipe.vi, Close Pipe.vi etc are in Labview full but only linux and MAC OS version. You can not use pipe with Windows.
    Regards
    VéroniqueD
    NI France

  • Read from external source file in weblogic

    Hi,
    I am using Weblogic Server 10.3 in my project.
    In one of my modules , i have a requirement where I have to read the contents of a file from an external location.[ex: D:\Test\Sample.xml ].
    How to i configure this path in weblogic , so that I can read the content in my java source file.
    Please advice.
    Regards,
    Praveen

    only part i replied on was the part of how to read a file
    but i think in your case you could do the next
    use the sync file adapter to read in the file during your process
    based on this content you set a variable "myOutputDirectory"
    then create a file adapter (write) which will store the file on file system
    http://docs.oracle.com/cd/E23943_01/integration.1111/e10231/adptr_file.htm#CIACICFD
    4.3.2.2.5 Specifying a Dynamic Outbound File Name
    and use that (jca.file.Directory) property to store the file either on the archive location or the delete location

  • Ejb jars not being read from application.xml

    Hello. If somebody wouldn't mind reading this, I've been wrestling wiht this most of the day. I have a coupe of entity ejbs and a stateless session ejb, each packed into it's own jar. When I deploy the ear, the war deploys fine but the three ejb jar files are not read as per the application.xml. As a test, I put the jars into the default server lib directory and after I did that, the enterpise app launched as expected. I can't figure out why the server, resin 3.0.12, is not able to see these ejb jars. I've tried to add the directory after deployment to the classpath in the autoexec.bat but no dice. I've moved the ejb jars around into subdirectories and modified the application.xml accordingly but to no avail. I've also looked into the server configuration file but resin doesn't seem to have any taggings within it's ejb server tag that would dictate where the container would look for jar or class files. Does anybody have any ideas what this could be?...this is the application.xml...pretty straightforward...the ejb jars are located in the root of the ear...
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE web-app (View Source for full doctype...)>
    - <application>
    <display-name>MyApp</display-name>
    - <module>
    <ejb>cn.jar</ejb>
    </module>
    - <module>
    <ejb>cnf.jar</ejb>
    </module>
    - <module>
    <ejb>cni.jar</ejb>
    </module>
    - <module>
    - <web>
    <web-uri>nctims.war</web-uri>
    <context-root>/nctims</context-root>
    </web>
    </module>
    </application>
    Thank you very much for taking your time to read my post.

    Hello. Thank you very much for the reply.
    Yeah, application.xml is sitting in META-INF. The war referenced wihtin application.xml deploys fine...the container jsut seems to ignore the <module><ejb>..</ejb></module> tags when it reads the ejb deployment descriptors and tries to locate the classes. I've tried everything...shouldn't application.xml take care of all class-loader issues with the module references? Thank you again to everybody reading this or whatever.

  • WT210 Reading from external sensor

    Hi,
    I need help with using external sensor to read current in LabVIEW. Are there any examples? What I did was, from the "Measure Mode Value" example, I connect Config Ext Sensor Scaling. I don't know if it's right or not.
    Any help would be very appreciated.
    Thanks,
    Solved!
    Go to Solution.

    You can compare the commands that are in the function to the command in the manual. I haven't used that instrument.

  • Event structure doesn't handle all events from external DLL source

    Hi!
    I use a DLL, wich handles an USB CAN transceiver device, and generates LabVIEW user events with extcode.h and PostLVUserEvent() function.
    In my vi I use an event case structure to handle theese external events. The problem is, that if the events come too frequently, then it cannot handle all events.
    The vi contains a couple of parallel while loops which process the incoming data from the external event.
    In another application I use the same architecture, and that works fine. This one is more complex.
    Do you think I have reached the limits of the program? Or what else can be the problem?
    I have tried to use a queue in the  event structure, it helped a little, but yet, not all the events are handled. My external DLL sends all event, so the problem is not there.
    Thanks in advance!

    Hi Wasz,
    Thanks for the post and I hope your well.
    It is not possible for the event structure to miss events - it simply queues them up. To keep the event structure 'in time' with the code you must ensure the code to execute in each event is minimal to allow the event structure to handle the next event. 
    Please see this two links:
    event structure buffering: leading to,
    How to avoid built-up for "cursor move" events? : where somone is trying to avoid handling all events.
    What sort of events are not being handled? Could it be an issue your events are not configured correctly? Maybe if you could produce a small example in LabVIEW code, so we can just test the event structure configuration... someone working around the external dll call - which you seem sure is working correctly.  
    In terms of queuing to process the events in other loops is certainly an option to speed up the event structure. To do this, use a produce/consumer design pattern.
    hope this helps,
    Kind Regards
    James Hillman
    Applications Engineer 2008 to 2009 National Instruments UK & Ireland
    Loughborough University UK - 2006 to 2011
    Remember Kudos those who help!

  • How to read from a xml file(in String format) using a java program

    hi friends
    i have a string , which is xml format. i want read the values and display it.can any one suggest how to read a xml file of string format using a javaprogram
    thanks

            final DocumentBuilder db =  DocumentBuilderFactory.newInstance().newDocumentBuilder();      
            final InputStream documentStream = new ByteArrayInputStream(documentXMLSourceString.getBytes("utf-8"));
            final Document document = db.parse(documentStream);

Maybe you are looking for

  • What are the DMS metrics related to Open/Total JDBC Connections?

    Hi, We need to monitor that state of the JDBC Connection Pool (Available conns, Max conns, etc.) by reading DMS, however we are struggling to find which is the right DMS metric associated to it? We tried the table modplsql_DatabaseConnectionPool howe

  • Adobe toolbox vs PHP pure upload?

    Been using MX 2004 and enjoyed the PHP pure file upload behavior. Now downloaded the trial version of DW CS3 and find that my file upload behavior wont work, then downloaded the toolbox and find that it's so much more different than my usual way of u

  • No available themes in iPhoto '09 when I try to print photos

    When I try to print photos in iPhoto '09 a window pops up and says "No Available Themes, There were no themes located". I use to be able to print photos all the time and I have iLife installed - Version 9.0.3.  What has happened and what do I need to

  • Problems Changing Password

    When I go to Users, select a user then choose "Reset Password," I'm presented with a dialog asking for the new password, verification, and an opportunity to check "Require password change at next login." After changing the password that user can no l

  • My sound is like echo and i can't solve the problem with realtek hd audio manager

    HP G72 notebook Windows 7 64 bit Sound is like echo and can't solve problem with Realtek HD audio manager