Extracting array from loaded xml

I'm using Flex 4 in an AIR project and need to load the following xml text file
<list>
    <month name="Jan-04" revenue="400263" average="80052">
        <region name="APAC" revenue="46130"/>
        <region name="Europe" revenue="106976"/>
        <region name="Japan" revenue="79554"/>
        <region name="Latin America" revenue="39252"/>
        <region name="North America" revenue="128351"/>
    </month>
    <month name="Feb-04" revenue="379145" average="75829">
        <region name="APAC" revenue="70324"/>
        <region name="Europe" revenue="88912"/>
        <region name="Japan" revenue="69677"/>
        <region name="Latin America" revenue="59428"/>
        <region name="North America" revenue="90804"/>
    </month>
</list>
The original example (the old Flex 2 Dashboard example) used
   <mx:HTTPService id="srv" url="results.xml" useProxy="false" result="resultHandler(event)"/>
to load the xml file, then used the line:
            monthData = event.result.list.month.source as Array;
to convert the text to an array. Since this is an AIR project I'm using Filestream etc. to load the file but cannot convert it to an array. Not sure why. Here is the filestream code:
private function loadFile():void{
var file:File = File.applicationDirectory.resolvePath("results.xml");
var fileStream:FileStream = new FileStream();
fileStream.open(file, FileMode.READ);
var xmlList:XML = XML(fileStream.readUTFBytes(fileStream.bytesAvailable));
fileStream.close();
monthData = xmlList.month.source as Array;
trace(monthData);
but the trace is always null no matter what I try.

Ignore all the httpService vs Filestream, the xml seems to be loading ok but I can't extract the array from the xml. The original example was from Flex 2 so I'm not sure if something has changed but the original
monthData = xmlXML.month as Array;
doesn't work. The xml seems fine as I can extract anything from it.
trace(xmlXML.month[2].region[0].@name);
I just can't turn it into an Array like in the original.

Similar Messages

  • Obtain Array from an XML file with Multiple Arrays

    Hi,
    So I have been struggling with this program I am making for the last few months but I am almost there. I have a program that creates multiple arrays and place them one after another in an xml file and each array has its own unique name. Now I would like to create a VI that takes this XML file and when the user inputs the specific array name they are looking for it goes into the xml file finds the entire array under that name and displays it in an output indictor to be viewed on the VI. Attached is a sample of my xml file and the VI that creates this xml file.
    Thanks,
    dlovell
    Solved!
    Go to Solution.
    Attachments:
    I_Win.zip ‏20 KB

    Here is a slightly different version. The one above reads from a file. This is how you would read from an already loaded XML string.
    =====================
    LabVIEW 2012
    Attachments:
    Find Array.vi ‏18 KB

  • Need help in extracting value from an xml tag.

    Hi ALL,
    Good Morning to all, i have problem in fetching a value from a xml tag. I have created a xml schema based on the schema i have created a xmltype table and inserted a value to the table. When i am trying to fetch a value from a particular tag i am unable to do so.. Kindly help me to solve this. Here by i am posting all the workings i have done...
    I am using the following client:
    SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jan 31 11:44:59 2011
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    ////////////////////////////////// XML Schema ///////////////////////
    begin
    dbms_xmlschema.registerSchema(
    'http://www.oradev.com/chipsxml.xsd',
    '<schema xmlns="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.oradev.com/chipsxml.xsd"
    xmlns:samp="http://www.oradev.com/chipsxml.xsd"
    version="1.0">
    <element name="Field1">
    <complexType>
    <sequence>
         <element name="UTI">
              <complexType>
              <sequence>
              <element name = "U01" type = "string"/>
              <element name = "U02" type = "string"/>
              <element name = "U03" type = "string"/>
              <element name = "U03a" type = "string"/>
              <element name = "U03b" type = "string"/>          
              <element name = "U03c" type = "string"/>          
              <element name = "U04" type = "string"/>                    
              <element name = "U05" type = "string"/>                    
              </sequence>
              </complexType>
         </element>
    </sequence>
    </complexType>
    </element>
    </schema>',
    TRUE, TRUE, FALSE, FALSE);
    end;
    ////////////////////////// Table which has multiple Column //////////////////////////
    CREATE TABLE chipsxmltable1 (
    id number, XMLDATA XmlType)
    XMLTYPE XMLDATA STORE AS OBJECT RELATIONAL
    XMLSCHEMA "http://www.oradev.com/chipsxml.xsd"
    ELEMENT "Field1";
    ///////////////////////////////// Insert Query in chipsxmltable //////////////////////////
    INSERT INTO chipsxmltable VALUES(
    xmltype.createxml('<?xml version="1.0"?>
    <samp:Field1 xmlns:samp="http://www.oradev.com/chipsxml.xsd" >
    <UTI>
    <U01>No</U01>
    <U02>Y</U02>
    <U03>Y</U03>
    <U03a>Y</U03a>
    <U03b>Y</U03b>
    <U03c>Y</U03c>     
    <U04>Y</U04>
    <U05>Y</U05>          
    </UTI>
    </samp:Field1>'));
    To show the data as a field with structure:
    1. Query:
    Select * from chipsxmltable1;
    Output:
    ID XMLDATA
    1 <?xml version="1.0"?>
    <samp:Field1 xmlns:samp="http://www.oradev.com/chipsxml.xsd">
    <UTI>
    <U01>No</U01>
    <U02>No</U02>
    <U03>Y</U03>
    <U03a>Y</U03a>
    <U03b>Y</U03b>
    <U03c>Y</U03c>
    <U04>Y</U04>
    <U05>Y</U05>
    </UTI>
    </samp:Field1>
    2. Query: (Both the query displays the same Output)
         SELECT X.xmldata.getClobVal() "XMLDATA" FROM chipsxmltable1 X;
         select extract(XMLDATA, '/Field1').getstringval() "XMLDATA" from chipsxmltable1 x;
    Output:
    XMLDATA
    <?xml version="1.0"?>
    <samp:Field1 xmlns:samp="http://www.oradev.com/chipsxml.xsd">
    <UTI>
    <U01>No</U01>
    <U02>No</U02>
    <U03>Y</U03>
    <U03a>Y</U03a>
    <U03b>Y</U03b>
    <U03c>Y</U03c>
    <U04>Y</U04>
    <U05>Y</U05>
    </UTI>
    </samp:Field1>
    To show the data as a single string without structure using "getstringval()":
    3. Query
         select extract(XMLDATA, '//text()').getstringval() "CHIPS - XML" from chipsxmltable1 x;
    OUtput:
    CHIPS - XML
    NoNoYYYYYY
    To show the data as a single string without structure using "getclobval()":
    4.Query
         select extract(XMLDATA, '//text()').getClobVal() "CHIPS - XML" from chipsxmltable1 x;
    Output:
    CHIPS - XML
    NoNoYYYYYY
    To show the data in a particular tag with/Without structure (Which is not working) using "EXTRACT" function:
    6.Query:
         select extract(XMLDATA, '/Field1/text()').getstringval() "XMLDATA" from chipsxmltable1 x;
         select extract(XMLDATA, '/Field1/UTI').getstringval() "XMLDATA" from chipsxmltable1 x;
         select extract(XMLDATA, '/Field1/UTI/U01').getstringval() "XMLDATA" from chipsxmltable1 x;
         select extract(XMLDATA, '/Field1/UTI/U01/text()').getstringval() "XMLDATA" from chipsxmltable1 x;
    Output:
    CHIPS - XML
    The above queries are not fetching the value.
    To show the data in a particular tag with/Without structure (Which is not working) using "EXTRACTVALUE" function:
    7. Query:
         select extractValue(XMLDATA, '/Field1/UTI') "XMLDATA" from chipsxmltable1 x;
         select extractValue(XMLDATA, '/Field1/UTI/U01') "XMLDATA" from chipsxmltable1 x;
    Output:
    X
    The above queries are not fetching the value.
    My question is:
    How to fetch values from xml tag when the value are inserted through xml schema?
    Apologies if the description is not clear. Kindly let me know if further details are needed. Many thanks for your help.
    Very best regards,
    Godwin Jebakumar C.V.

    Hi,
    You need to declare the namespace of each element used in the XPath expression, like this :
    SQL> select extractvalue( XMLDATA
      2                     , '/samp:Field1/UTI/U01'
      3                     , 'xmlns:samp="http://www.oradev.com/chipsxml.xsd"' ) "XMLDATA"
      4  from chipsxmltable1 x
      5  ;
    XMLDATA
    No
    SQL> select extract( XMLDATA
      2                , '/samp:Field1/UTI'
      3                , 'xmlns:samp="http://www.oradev.com/chipsxml.xsd"'
      4                ).getstringval() "XMLDATA"
      5  from chipsxmltable1 x
      6  ;
    XMLDATA
    <UTI>
      <U01>No</U01>
      <U02>Y</U02>
      <U03>Y</U03>
      <U03a>Y</U03a>
      <U03b>Y</U03b>
      <U03c>Y</U03c>
      <U04>Y</U04>
      <U05>Y</U05>
    </UTI>
    Please see EXTRACT and EXTRACTVALUE documentation :
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions051.htm#i1006712
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions052.htm#SQLRF06173
    BTW, "XMLDATA" is a pseudo-column used by Oracle. I don't know if it'll ever cause any conflict but maybe you should rename your column.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/pseudocolumns010.htm#SQLRF00256
    Regards.

  • Extracting elements from an xml string - org.apache.xerces.dom.DeferredText

    Hello all,
    I am new to xml, and I thought I had a handle on things until I got this problem...I am getting an xml string from the body of an e-mail message, and then I am trying to extract elements out of it. Here is an example xml string:
    <?xml version="1.0" encoding="UTF-8"?>
    <filterRoot>
       <filter action="MOVE" bool="AND" name="My Saved Filter" target="Deleted Items">
          <condition attribute="TO" bool="AND" contains="CONTAINS">
             <value>[email protected]</value>
             <value>[email protected]</value>
             <value>[email protected]</value>
             <value>[email protected]</value>
             <value>[email protected]</value>
          </condition>
       </filter>
    </filterRoot>I am trying to extract the <filter> element out and store it into a Vector of Elements (called, not surprisingly, filters). However, I am getting a class cast exception:
    java.lang.ClassCastException: org.apache.xerces.dom.DeferredTextImplIt is being called from where I trying to extract the <filter> in this way:
            filterRoot = doc.getDocumentElement(); // get topmost element
            NodeList list = filterRoot.getChildNodes();
            Vector newFilters = new Vector();
            debug("There are "+list.getLength()+" filters in document");
            for(int i=0; i<list.getLength(); i++) {
                Node n = list.item(i);
                debug("Node "+i+" getNodeValue() is "+n.getNodeValue());
                Element temp = (Element)n;
                newFilters.add(temp);
            }Perhaps my question is, how do I correctly get hold of the <filter> node so that I may cast it as an Element?
    thanks,
    Riz

    Yes, I already knew that it is not a bug.
    But, I got next step problem.
    I put "false" to "include-ignorable-whitespace" feature in xerces parser.
    But, I still found unnecessary TextNodes in my parser object.
    Feature link : http://xerces.apache.org/xerces-j/features.html.
    I use xerces-2_8_0.
    DOMParser parser = new DOMParser();
    parser.setFeature("http://apache.org/xml/features/dom/include-ignorable-whitespace", false);
    parser.parse(inputSource);
    document = ps.getDocument();
    System.out.println(document.getDocumentElement().getChildNodes().length()); // still wrong lengthIs tehre any example of usage this feature?
    What is default defination of white-space "\n "(enter with one space) or " "(juz white space) or something else?
    Thanks,

  • Extracting records from an XML

    Hi All,
    I have an XML in this format.
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <pm testval="1" xmlns:xsi="http://urltest">
    <mid>15</mid>
    <mname>Info</mname>
    <mrid>145</mrid>
    <fs id="11">
    <fd>
    <fd-id>73</fd-id>
    <pfd>23</pfd>
    <pfn>Test descr1</pfn>
    <pft>Type1</pft>
    <z>
    <pfzd/>
    <pfzn>67.7</pfzn>
    <pfx>4444</pfx>
    </z>
    </fd>
    <fd>
    <fd-id>88</fd-id>
    <pfd>552</pfd>
    <pfn>Test Descr2</pfn>
    <pft>Type3</pft>
    <z>
    <pfzd>523</pfzd>
    <pfzn>532</pfzn>
    <pfx>555</pfx>
    </z>
    </fd>
    </fs>
    <fs id="22">
    <fd>
    <fd-id>73</fd-id>
    <pfd>23</pfd>
    <pfn>Test descr1</pfn>
    <pft>Type1</pft>
    <z>
    <pfzd/>
    <pfzn>67.7</pfzn>
    <pfx>4444</pfx>
    </z>
    </fd>
    <fd>
    <fd-id>88</fd-id>
    <pfd>552</pfd>
    <pfn>Test Descr2</pfn>
    <pft>Type3</pft>
    <z>
    <pfzd>523</pfzd>
    <pfzn>532</pfzn>
    <pfx>555</pfx>
    </z>
    </fd>
    </fd>
    <fd>
    <fd-id>89</fd-id>
    <pfd>552</pfd>
    <pfn>Test Descr2</pfn>
    <pft>Type3</pft>
    <z>
    <pfzd>523</pfzd>
    <pfzn>532</pfzn>
    <pfx>555d</pfx>
    </z>
    </fd>
    </fs>
    <pm/>
    And I would want the output in this format.
    mid mname mrid fs fd-id pfd pfn pft pfzd pfzn pfx
    15 Info 145 11 73 23 Test Descr1 Type1 67.7 4444
    15 Info 145 11 88 552 Test Descr2 Type3 523 532 555
    15 Info 145 22 73 23 Test Descr1 Type1 67.7 4444
    15 Info 145 22 88 552 Test Descr2 Type3 523 532 555
    15 Info 145 2 2 89 552 Test Descr2 Type3 523 532 555d
    Could you help.

    Solution is something like this...
    SELECT extractValue(p.xml,'/pm/mid/text()') mid,
    extractValue(p.xml,'/pm/mname/text()') mname,
    extractValue(p.xml,'/pm/mrid/text()') mrid,
    extractValue(x.column_value,'/fs/@id') fsid,
    extractValue(y.column_value,'/fd/fd-id/text()') fd_id,
    extractValue(y.column_value,'/fd/pfd/text()') pfd,
    extractValue(y.column_value,'/fd/pfn/text()') pfn,
    extractValue(y.column_value,'/fd/pft/text()') pft,
    extractValue(z1.column_value,'/z/pfzd/text()') pfzd,
    extractValue(z1.column_value,'/z/pfzn/text()') pfzn,
    extractValue(z1.column_value,'/z/pfzn/text()') pfx,
    FROM xml_table p,
    TABLE(XMLSequence(extract(p.xml,'/pm/fs','xmlns:xsi="http://urltest"'))) x,
    TABLE(XMLSequence(extract(x.column_value,'/fs/fd','xmlns:xsi="http://urltest"'))) (+) y,
    TABLE(XMLSequence(extract(y.column_value,'fd/pft/z','xmlns:xsi="http://urltest"')))(+) z1

  • Extracting data from an XML document that uses namespaces

    Hello all,
    Firstly, please let me wish you all a very happy and prosperous 2013!
    I have a piece of XML containing namespaces (retrieved from a web service) and I am having difficulty extracting values
    (If you're interested this is the webservice: http://api.worldbank.org/countries/FRA/indicators/NY.GDP.MKTP.CD?date=2009)
    Here is some test code with two cases -
    1) where I leave in the namespace and
    2) where I strip out all references to the namespace
    Case 1 doesn't work, whereas Case 2 works well.
    I would prefer a more elegant solution than simply stripping out the namespace.
    I have probably just misunderstood something about how to work with namespaces in PL/SQL.
    Do any of you have suggestions about how best to approach this?
    Many thanks in advance.
    Niall.
    set serveroutput on
    set define off
    DECLARE
    v_xml XMLTYPE;
    v_clob CLOB;
    v_country VARCHAR2(255);
    BEGIN
    v_clob := '<?xml version="1.0" encoding="utf-8"?>
    <wb:data page="1" pages="1" per_page="50" total="1" xmlns:wb="http://www.worldbank.org">
    <wb:data>
    <wb:indicator id="NY.GDP.MKTP.CD">GDP (current US$)</wb:indicator>
    <wb:country id="FR">France</wb:country>
    <wb:date>2009</wb:date>
    <wb:value>2619685000757.11</wb:value>
    <wb:decimal>0</wb:decimal>
    </wb:data>
    </wb:data>';
    v_xml := XMLTYPE(v_clob);
    SELECT extractvalue(v_xml,'/data/data[1]/country', 'xmlns:"http://www.worldbank.org/"')
    INTO v_country
    FROM dual;
    dbms_output.put_line(' ');
    dbms_output.put_line('*** Case 1');
    dbms_output.put_line('*** '||nvl(v_country,'nothing'));
    dbms_output.put_line(v_xml.getStringVal());
    v_xml := XMLTYPE(replace(v_clob,'wb:')); -- strip out wb:
    SELECT extractvalue(v_xml,'/data/data[1]/country', 'xmlns:"http://www.worldbank.org/"')
    INTO v_country
    FROM dual;
    dbms_output.put_line(' ');
    dbms_output.put_line('*** Case 2');
    dbms_output.put_line('*** '||nvl(v_country,'nothing'));
    dbms_output.put_line(v_xml.getStringVal());
    END;
    /

    Your case 1 query should be
    (not tested)
    SELECT extractvalue(v_xml,'/wb:data/wb:data[1]/wb:country', 'xmlns:wb="http://www.worldbank.org/"')If the XML is going to be small, you could also do it this way purely in PL/SQL
    [url http://anononxml.blogspot.com/2010/06/xml-parsing-with-namespaces-via-plsql.html]XML Parsing with Namespaces via PL/SQL. Ignore the DOMDocument examples (first two) in there.
    If the XML will be large and you are on 11.1 or greater, then it would be faster to insert the XML into a column in a DB table (could be a global temporary table) where the column is XMLType and the storage is SECUREFILE BINARY (default on 11.2.0.2+). Then you could use XMLTable, like
    [url http://anononxml.blogspot.com/2010/08/xml-parsing-with-namespaces-via.html]XML Parsing with Namespaces via XMLTable 

  • Extract graphics from loaded swf / Big problem

    Hello,
    my English isn't very good, so sorry for mistakes I have swf which consist of many vector graphics.
    You can show it right here: http://www.watchtime24.sisco.pl/moje...orowanka_1.swf
    If I import the swf to the stage, than I can manipulate this graphics. But this is not enough for me. I need to manipulate from Action Script.
    I need to change the colors of this piceses from AS. I tried to use function
    getObjectsUnderPoint(new Point(mouseX, mouseY))
    but it doesn't work. This function doesn't see shapes, graphics or something else.
    Is any solution which can fix my problem ? Has anyone any idea ?

    Hey Mich,
    What you can do is turn eachof the items in your shapes, into a movieClip or sprite or even a bitmap.
    like the boy in the drawing.. take all of thsoe and then convert them into a movieClip.  Then when you do this give them a name and export them for actionscript.  Give this a class Name.
    then when you load the swf, you can actually target those files with this line.
    Say i converted the BOY into a movieClip.
    import flash.system.ApplicationDomain
    import flash.utils.geClasstDefinition
    var myswfHoldingBoy
    var myLoader:URLLoader = new URLLoader()
          myLoader.addEventListener(Event.INIT,onInit)
         var myURLRequest('path to myswfHoldingBoy')
    myLoader.load(myURLRequest)
    privaate function onInit(e:Event){
    //here is where we will extract the boy for the library of the other swf
    var ldrAppdomain= e.target.loaderInfo.applicationDomain
    var boyObject:Class= ldrAppdomain.getByDefinition('class name you gave the boy as i said eralier') as Class
    // now we have boyObject that will be able to be used as a class
    addChild(new boyObject())  // this will addYourBoy movieClip to the stage.  but keep a reference to him so that you can then manipulate him.

  • Extracting arrays from cases, 2nd try

    Hallo,
    since my first trys of this topic was unclear, I try it again:
    I have a case structure with two cases:
    case 1: 2D-arrays, case 2: 1D-arrays and Strings
    In the two subcases you have another select case -- structure with various cases:
    case 1: subcase 1, subcase 2 etc.
    case 2: subcase 1, subcase 2 etc.
    I want to save the arrays and the strings to one text-file. How can I do that? If I connect a wire to one of the arrays, the VI doesn't run because of a "tunneling error" (missing assignment to tunnel).
    I know how to write arrays to a file, my problem is getting them out of the case-structure.
    Hoping fr help,
    Arno

    Hallo,
    >> Since Case 1 and Case 2 output different data types, you cannot put them on the same wire. Why don't you put the save operation inside the case structure, in case 1 you save the 2D array and in case 2 you save the 1D array and strings. <<
    That works (I already tried), but I cannot use that idea because of two reasons: First, I want to save all the arrays and strings to ONE file in an order I decide. Second, the VI should do that with approx. 10 arrays / strings and that 100 times for 100 files. Working with temporary files is not possible.
    >> Alternatively, you can convert your data in each case to the final string result to be saved, which you then can save using write characters to file at a later point in the code. Since only a
    string leaves the case structure, there is no data conflict. <<
    My problem is not a data conflict (arrays, strings etc.) but getting the data out of the case-structure. I don't even get a simple string constant out of it.
    To make my problem clear, I attached a simple (not running) VI. "Your task" is getting the data out of the structures.
    Arno
    Attachments:
    readdatafromcase.vi ‏12 KB

  • Extract data from xml file and insert into another exiting xml fil

    hello,
    i am searching extract data from xml file and insert into another exiting xml file by a java program. I understood it is easy to extract data from a xml file, and how ever without creating another xml file. We want to insert the extracted data into another exiting xml file. Suggestions?
    Regards,
    Zhuozhi

    If the files are small, you can load the target file in a DOM document, insert the data from the source file and persist the DOM.
    If the files are large, you probably want to use a StAX or SAX.

  • Is it possible to extract the xpath for fields from a XML file

    Hi,
    After all we do the recording to capture the xpath of the fields, so i thought of extracting xpath from a XML file will be a good idea.
    Is there a way to do this?
    Please suggest
    regards
    Suresh

    Yes, there is.  Go to the Tools menu -> Generate XPaths and load in your xml file.  Select the element you are interested in and you will get the XPath to utilise.
    Regards,
    Jamie

  • How to extract data from xml file and store that data inti data base table

    Hii All
    I have one table that table contains one column that column contain an XML file
    I want to extract data from that XML file and want to store that extracted data into an other table.
    That xml file has different different values
    I want to store that values into table in diff diff columns

    Hi,
    I am also facing the same problem.I have a .xml file and i need to import the data into the custom table in oracle database.
    Can you please let me know if you know the solution how to do it in oracle apps.
    Thanks,

  • Hi, extract data from xml file and insert into another exiting xml file

    i am searching code to extract data from xml file and insert into another exiting xml file by a java program. I understood it is easy to extract data from a xml file, and how ever without creating another xml file. We want to insert the extracted data into another exiting xml file. Suggestions?
    1st xml file which has two lines(text1.xml)
    <?xml version="1.0" encoding="iso-8859-1"?>
    <xs:PrintDataRequest xmlns:xs="http://com.unisys.com/Anid"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://com.unisys.com/Anid file:ANIDWS.xsd">
    <xs:Person>
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://com.unisys.com/Anid file:ANIDWS.xsd">
    These two lines has to be inserted in the existing another xml(text 2.xml) file(at line 3 and 4)
    Regards,
    bubbly

    Jadz_Core wrote:
    RandomAccessFile? If you know where you want to insert it.Are you sure about this? If using this, the receiving file would have to have bytes inserted that exactly match the number of bytes replaced. I'm thinking that you'll likely have to stream through the second XML with a SAX parser and copy information (or insert new information) as you stream with an XML writer of some sort.

  • Running a live stream from an XML playlist

    I have just successfully installed Adobe FMS on my server.
    I would now like to know how to program a script to run a continuous live stream, of MP4 videos, from an XML playlist.
    Can anyone tell me how to do this? ...or provide me a good tutorial? (I am a complete newbie to ActionScript.)
    Thanks in advance...

    application.allowDebug = true;
    application.onAppStart = function(){
    this.userID =0;
    this.playObj = new Object();
    this.timObj = new Object();
    this.passCli = new Object();
    this.couObj = new Object();
    this.couObj.count = 1;
    application.so0 = SharedObject.get("so",false);
    this.dates = new Object;
    this.dates.dat0 = new Date().valueOf()+"a";
    this.dates.dat1 = new Date().valueOf()+"b";
    this.dates.dat2 = new Date().valueOf()+"c";
    this.dates.dat3 = new Date().valueOf()+"d";
    this.myStream = new Object;
    this.myStream.st = Stream.get (this.dates.dat0.toString());
    this.myStream.st1 = Stream.get (this.dates.dat1.toString());
    this.myStream.st2 = Stream.get (this.dates.dat2.toString());
    this.myStream.st3 = Stream.get (this.dates.dat3.toString());
    this.int0
    this.int1
    this.int2
    this.int3
    this.int4
    this.lock0=0;
    this.lock1=0;
    this.lock2=0;
    this.lock3=0;
    this.lock4=0;
    listen();
    function listen(){
    clearInterval(application.int3);
    application.int0 = setInterval(time,1000,application.myStream.st);
    application.myStream.st.onStatus = function(info){
    if(info.code == "NetStream.Play.Stop"&&application.lock0==0){
      trace("code0"+info.code);
      clearInterval(application.int0);
      application.timObj.tim = 0;
      application.int1 = setInterval(time,1000,application.myStream.st1);
      application.couObj.count = 2;
      playcurr(application.passCli.cli);
      switchStream(application.so0);
      listen1(application.myStream.st1);
      application.lock0=1;
      function listen1(mystreamst1){
      mystreamst1.onStatus = function(info){
    if(info.code == "NetStream.Play.Stop"&&application.lock1==0){
      trace("code1"+info.code);
      mystreamst1 = null;
      clearInterval(application.int1);
      application.timObj.tim = 0;
      application.int2 = setInterval(time,1000,application.myStream.st2);
      application.couObj.count = 3;
      playcurr(application.passCli.cli);
      switchStream(application.so0);
      listen2(application.myStream.st2);
      application.lock1=1
      function listen2 (mystream2){
    mystream2.onStatus = function(info){
    trace("code2"+info.code);
    if(info.code == "NetStream.Play.Stop"&&application.lock2==0){
      clearInterval(application.int2);
      application.mystream2 = null;
      application.timObj.tim = 0;
      //application.int3 = setInterval(time,1000,application.myStream.st3);
      application.couObj.count = 4;
      playcurr(application.passCli.cli);
      switchStream(application.so0);
         application.lock2=1;
      listen3(application.myStream.st3);
      function listen3(mystream3){
    mystream3.onStatus = function(info){
    trace("code3"+info.code);
    if(info.code == "NetStream.Play.Stop"&&application.lock3==0){
      trace("yes yes yes yes yes yes");
      clearInterval(application.int3);
      application.couObj.count = 1;
      mystream3 = null;
      application.timObj.tim = 0;
      //application.int4 = setInterval(time,1000,application.myStream.st);
      playcurr(application.passCli.cli);
      switchStream(application.so0);
      application.lock0=0;
      application.lock1=0;
      application.lock2=0;
      application.lock3=0;
    application.dates.dat0 = new Date().valueOf()+"e";
    application.dates.dat1 = new Date().valueOf()+"f";
    application.dates.dat2 = new Date().valueOf()+"g";
    application.dates.dat3 = new Date().valueOf()+"h";
    application.myStream.st = Stream.get (application.dates.dat0.toString());
    application.myStream.st1 = Stream.get (application.dates.dat1.toString());
    application.myStream.st2 = Stream.get (application.dates.dat2.toString());
    application.myStream.st3 = Stream.get (application.dates.dat3.toString());
    application.myStream.st.play(application.playObj.vid[0],0,-1,0);
    application.myStream.st1.play(application.playObj.vid[1],0,-1,0);
    application.myStream.st2.play(application.playObj.vid[2],0,-1,0);
    application.myStream.st3.play(application.playObj.vid[3],0,-1,0);
    listen();
    ///here next
    application.onConnect = function(client){
    application.acceptConnection(client);
    application.passCli.cli = client;
    client.call("setUserID",null,this.userID);
    this.userID++;
    if(application.clients.length == 1 ){
    videoArray = new Array();
    var playlist = new XML();
    playlist.ignoreWhite = true;
    //parse xml play list for individual elements
    playlist.onLoad = function( success ) {
    if(playlist.loaded == true) {
    if (playlist.firstChild.hasChildNodes()) {
    for (var aNode = playlist.firstChild.firstChild; aNode != null; aNode=aNode.nextSibling) {
    if (aNode.nodeType == 1) {
    //create array from parsed xml elements.
    videoArray[aNode.attributes.id] = aNode.attributes.name ;
    //pass array out of onload function
    application.playObj.vid = videoArray;
    application.myStream.st.play(application.playObj.vid[0],0,-1,0);
    application.myStream.st1.play(application.playObj.vid[1],0,-1,0);
    application.myStream.st2.play(application.playObj.vid[2],0,-1,0);
    application.myStream.st3.play(application.playObj.vid[3],0,-1,0);
    pass0(videoArray);
    //play first video on playlist
    playlist.load("http://www.privatechatnow.com/fmsuser/playlist.xml");
    }//end onetime if statement
    function pass0(videoArray){
      //receive array
      //play intial video
      if(application.clients.length == 1){
    // application.playObj.vid=videoArray;
    playcurr(application.passCli.cli);
    for (var key in application.playObj){
    trace(key + ": " + application.playObj[key]);
       //put currently playing videio into object
      //isolate playlist switching loop for each connected client
      //listen to currently playing stream with onStatus
      //change to next video in playlist
      //use onStatus and current duration and seek to scrub to cuurently playin video each time a user connects.
      //continue untill playlist is played then loop back to first video in playlist.
        //onConnect play currently playing video
    if (application.clients.length >1){
    playcurr(application.passCli.cli);
    //message client with currently play flv
    //message client when flv changes
    //message client with metadata
    application.onPublish = function(clientObject, streamObject){
    trace("Stream name :: "+streamObject.name);
    function switchStream(so0){
    if(application.couObj.count == 1){
        clength = application.timObj.tim-3;
    currlen = application.playObj.vid[0].length;
        nextlen = application.playObj.vid[1].length;
    so0.send("playSecond",application.playObj.vid[0],clength,currlen,nextlen);
    if(application.couObj.count == 2){
        clength = application.timObj.tim-3;
    currlen = application.playObj.vid[1].length;
    nextlen = application.playObj.vid[2].length;
        so0.send("playSecond",application.playObj.vid[1],clength,currlen,nextlen);
    if(application.couObj.count == 3){
    clength = application.timObj.tim-3;
    currlen = application.playObj.vid[2].length;
      nextlen = application.playObj.vid[3].length;
        so0.send("playSecond",application.playObj.vid[2],clength,currlen,nextlen);
    if(application.couObj.count == 4){
        clength = application.timObj.tim-3;
    currlen = application.playObj.vid[3].length;
      nextlen = application.playObj.vid[0].length;
        so0.send("playSecond",application.playObj.vid[3],clength,currlen,nextlen);
    function playcurr(client){
    trace("count = "+application.couObj.count.toString());
    if(application.couObj.count ==1){
        clength = application.timObj.tim-3;
    currlen = application.playObj.vid[0].length;
      nextlen = application.playObj.vid[1].length;
        client.call("playZero",null,application.playObj.vid[0],clength,currlen,nextlen); 
    if(application.couObj.count ==2){
        clength = application.timObj.tim-3;
    currlen = application.playObj.vid[1].length;
      nextlen = application.playObj.vid[2].length;
        client.call("playZero",null,application.playObj.vid[1],clength,currlen,nextlen); 
    if(application.couObj.count ==3){
        clength = application.timObj.tim-3;
    currlen = application.playObj.vid[2].length;
      nextlen = application.playObj.vid[3].length;
        client.call("playZero",null,application.playObj.vid[2],clength,currlen,nextlen); 
    if(application.couObj.count ==4){
        clength = application.timObj.tim-3;
    currlen = application.playObj.vid[3].length;
      nextlen = application.playObj.vid[0].length;
        client.call("playZero",null,application.playObj.vid[3],clength,currlen,nextlen); 
    application.onDisconnect = function(oldclient){
    if(application.clients.length ==0){
    this.userID--;
    function time(myStream){
    application.timObj.tim = myStream.time;

  • Loading xml file using owb

    Hi Gurus,
    I am new to owb and as per requirement we need to load xml files into oracle table using owb.
    below is the xml file:
    <bookstore>
    <book category="COOKING">
    <title lang="en">Everyday Italian</title>
    <author>Giada De Laurentiis</author>
    <year>2005</year>
    <price>30.00</price>
    </book>
    <book category="CHILDREN">
    <title lang="en">Harry Potter</title>
    <author>J K. Rowling</author>
    <year>2005</year>
    <price>29.99</price>
    </book>
    <book category="WEB">
    <title lang="en">Learning XML</title>
    <author>Erik T. Ray</author>
    <year>2003</year>
    <price>39.95</price>
    </book>
    </bookstore>
    please help me in loading above xml file using owb.

    You can leverage the XML SQL functions to extract from XML using the database, see the blog post below;
    https://blogs.oracle.com/warehousebuilder/entry/leveraging_xdb
    For example to extract information from your XML document the following SQL can be generated from OWB;
    select extractValue(value(s), '/book/author'),
    extractValue(value(s), '/book/year'),
    extractValue(value(s), '/book/price') from
    ( select XMLType('<bookstore>
    +<book category="COOKING">+
    +<title lang="en">Everyday Italian</title>+
    +<author>Giada De Laurentiis</author>+
    +<year>2005</year>+
    +<price>30.00</price>+
    +</book>+
    +<book category="CHILDREN">+
    +<title lang="en">Harry Potter</title>+
    +<author>J K. Rowling</author>+
    +<year>2005</year>+
    +<price>29.99</price>+
    +</book>+
    +<book category="WEB">+
    +<title lang="en">Learning XML</title>+
    +<author>Erik T. Ray</author>+
    +<year>2003</year>+
    +<price>39.95</price>+
    +</book>+
    +</bookstore>') adoc from dual+) r,
    table(XMLSequence(extract(r.adoc, '/bookstore/book'))) s;
    Cheers
    David

  • Extracting date from oracle/other databases exactly to java

    Hello Friends,
    Iam creating a simple program which extracts data from any database and stores it in an XML file and also it can extract data from an XML file and updates the database.
    My program is just getting the tablename as an input and from that it builds the query (select * from tablename). Through ResultSet, Iam extracting date fields with getDate() method of ResultSet, which is yeilding converted dates [In oracle if date is 23-DEC-1980, Im getting it as 1980-12-23 in java]. Even getString() method of ResultSet doesn't work.
    I want my program to work with any database engine, which may have their own date formats. Kindly can anyone suggest me a way to extract date from any database exactly as it is to java.
    NOTE:: I can't use to_char(datefield) type commands in SQLQUERY as the only input to my program is tablename and my query is, select * from tablename.
    Regards,
    Ch.Praveen.

    HI Friends,
    Thanks for your fast replies. My program is extracting data from a database and generating an XML file for it, which is as follows.
    <?xml version="1.0" encoding="UTF-8"?>
    <table tableName="EMP">
    <row>
    <column columnName="EMPNO" columnType="NUMBER">7369</column>
    <column columnName="ENAME" columnType="VARCHAR2">'SMITH'</column>
    <column columnName="JOB" columnType="VARCHAR2">'CLERK'</column>
    <column columnName="MGR" columnType="NUMBER">7902</column>
    <column columnName="HIREDATE" columnType="DATE">'1980-12-17'</column>
    <column columnName="SAL" columnType="NUMBER">800</column>
    <column columnName="COMM" columnType="NUMBER" />
    <column columnName="DEPTNO" columnType="NUMBER">20</column>
    </row>
    <row>
    <column columnName="EMPNO" columnType="NUMBER">7499</column>
    <column columnName="ENAME" columnType="VARCHAR2">'ALLEN'</column>
    <column columnName="JOB" columnType="VARCHAR2">'SALESMAN'</column>
    <column columnName="MGR" columnType="NUMBER">7698</column>
    <column columnName="HIREDATE" columnType="DATE">'1981-02-20'</column>
    <column columnName="SAL" columnType="NUMBER">1600</column>
    <column columnName="COMM" columnType="NUMBER">300</column>
    <column columnName="DEPTNO" columnType="NUMBER">30</column>
    </row>
    </table>
    Here you can observe that HIREDATE column is having date in different format than in oracle. We are getting an error while we are extracting data from an XML file and updating the database, as dateformats differ. Can anyone provide a solution, which extracts date from database to java exactly as per the dateformat in database.

Maybe you are looking for

  • Transport  Error occurred during post-handling RS_AFTER_IMPORT for ISCS L

    Hi,    We are moving cube 0IC_C03 of material stocks/movements from Dev to Quality and we are facing problem while transporting the Transfer Structure 2lis_03_BF. Other  two TS moved successfully. The transporting is failing with the below error:   

  • Want to put graphics inside my Text

    I want to do a traveling matte like you can do in FCP, in which I have text that's filled with an image that I have on another layer. I don't want to see the other layer as background, only inside the text. I've been playing with Primatte RT, but it

  • IE5.5 works different than IE 6...  What is going on.

    On IE 6.0.28 with the XP operating system. I get different results than IE 5.5. Is there any known bug with the following problem. My html has the OBJECT tag with static versioning (8a...) for clssid... My browser tells me to install the 1.4.1_01 plu

  • Programmatically change selected cell/row of multicolumn listbox

    I want to programmatically change the selected cell of a multicolumn list box whose Selection Mode is set to Highlight Entire Row.  I would use this to be able to highlight which ever row of the listbox I choose to.  It would function in the same man

  • Quorum disk question

    What is the best practice for the quorum disk asignment in a dual-node cluster ? 1.Is there any benefit to have a dedicated quorum disk and if yes - what size should it be ? 2.The manual says: "Quorum devices can contain users data". Does it mean the