Create XML file dynamically textInput fields

Hello

I am very new to Flex and trying to create an application that creates XML files on the computer that is local to the user, based on a users entry in textInput fields.

For the moment I'm having trouble figuring out how to dyamically create a XML file external at all, ideally when the user press a key a browseForSave dialog will open allowing the user to select somewhere on their hard drive to create the XML file.

Can someone give me some advice what I should go in the direction?

Thank you

If this post has answered your question or helped, please mark it as such.

You can use a SharedObject for small files, but in general the Flex has no access to the local hard disk.


http://www.Adobe.com/2006/mxml '.
Initialize = "init ()" > "
 
    public var mySO:SharedObject;
     
public void init (): void {}
OSJM = SharedObject.getLocal ("mydata");
If {(mySO.data.myData!=null)}
var XML = mySO.data.myData;
fname.text = xml.fname;
Lname.text = xml.lname;
xml.email = email.text;
}
}

private function storeData (): void {}
var xml =
          ;
If (fname.text! = "") {}
xml.appendChild ({fname.text});
}
If (lname.text! = "") {}
xml.appendChild ({lname.text});
}
If (email.text! = "") {}
xml.appendChild ({email.text});
}
mySO.data.myData = xml;
mySO.flush ();
}
 
private function resetData (): void {}
mySO.clear ();
fname. Text = "";
Lname. Text = «»
email. Text = "";
}
]]>
 
 
   
     
   

   
     
   

   
     
   

 

 
 
 

Tags: Flex

Similar Questions

  • Creating XML files

    Hello

    I know this is going to sound very vague, but what is a good way to create XML files, so there is some sort of connection with the scan operation? Find it me easier to say

    out=fileConnection.getOutputStream();
    out.write( (""+fileName+").getBytes() );
    

    etc. but I know it's very stupid and source of errors. And after writing the file, I discovered that BlackBerry has no MIME type that are associated with. Any suggestions?

    try to use the write() method (like what I did in my first message) instead of writeChars()

    in fact, I would recommend the tree as follows to reduce errors in construction:

    DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();            DocumentBuilder builder=factory.newDocumentBuilder();            Document doc=builder.newDocument();
    
                Node root=doc.createElement("SyncMyNetConfig");            doc.appendChild(root);
    
                Node n_tmrConnect=doc.createElement("tmrconnect");            Text tx_tmrConnect=doc.createTextNode(tmrConnect+"");            n_tmrConnect.appendChild(tx_tmrConnect);            root.appendChild(n_tmrConnect);
    
  • java.io.FileNotFoundException for newly created XML file

    Hello

    I created an xml file called config.xml under public_html\WEB-INF.

    When I tried to read this xml from the java class file, I make
    java.io.FileNotFoundException: public_html\WEB-INF\config.xml
     (The system cannot find the path specified.)
    My version of Jdev is
    10.1.3.04
    How can I solve this? What is the correct path to call my newly created xml file from anywhere in the project is java JSP?

    Concerning

    Published by: Chackochen on August 2, 2010 01:48

    Published by: Chackochen on August 2, 2010 01:58

    Hi Chackochen,

    Try this and see...

    FacesContext context = JSFUtils.getFacesContext ();
    ServletContext servletContext = (ServletContext) context.getExternalContext () .getContext ();
    Path String = servletContext.getRealPath("/WEB-INF/config.xml");
    = New File (path);

    Kind regards
    Suganth.G

  • Passing values from a CO of a page in the xml file of a field with LOV.

    Hello

    I have 2 pages in this CUSTOMIZATION and the 2nd page got fields that have their turn to LOV.

    The query behind the LOV is sitting in the XML file and as an amendment to this motion, he needs some dynamic values

    I got to a stage where in the Commander of the 2nd page I set up values using getparameters.

    But how to pass this value from the 2nd page to the XML FILE.

    Thank you

    Regis

    Hi Regis

    Leave; s first focus on your first build errors. You said very well reconstruction work but compilation error comes when you run the page.

    It's strange. Can you please confirm if you have added the OFA libraries to your project. Ideally, they should be there once you create an OA project

    Concerning

    Marie Lise S

  • Create XML file

    I use AIR and the class FileStream to save the file locally, but I don't "know how to create the XML file using ACE. I think I should use something like this:

    var xmlPoincon:XML = new XML();

    But I don't know how to create the XML node, then the values.

    Kind regards

    Daniel Cantin

    Here is a simple code snippet:

    private function createXML(): void{
        var xm:XML = ;
        var nodeName:String = "EMPLOYEENAME";
        var nodeValue:String = "KUMAR";
        var xmlList:XMLList = XMLList("<"+nodeName+">"+nodeValue+"");
        xm.appendChild(xmlList);
        Alert.show(xm);
    }
    

    The most important here is the appendChild() method, which allows you to add a node that you have built.

    http://flexonblog.WordPress.com/2008/02/04/generate-XML-data-dynamically-in-Flex/

    If this post answers your question or assistance, please mark it as such. Thank you!

    http://www.stardustsystems.com
    Adobe Flex development and Support Services

  • Creating XML file using data from database table

    I have to create an xml file by using the data in the table of multiples. The problem that I face is data are huge it's millions, so I was wondering is it possible efective for the creation of an XML of this type.

    It would be great if you can suggest an approach to achieve my requirement.

    Thank you
    -Vinod

    An example of the forum: Re: how to generate the XML from the database table

    Published by: Marco Gralike on 18 October 2012 21:41

  • Create XML file and make available via WebDAV

    Hello

    I'm new to XML DB ;-)
    Has anyone got a short example how to create an XML file (possibly with XSD in XML DB schema file) via XML DB and make it available via WebDAV?

    Thanks in advance.

    Best regards
    Martin
    SQL> select xmltype(cursor(select * from dual)) from dual;
    
    XMLTYPE(CURSOR(SELECT*FROMDUAL))
    -----------------------------------------------------------------------------
    
    
     
      X
     
    
    
    1 row selected.
    
    SQL> DECLARE
      2
      3    XMLDoc XMLType;
      4
      5  BEGIN
      6
      7    select xmltype(cursor(select * from dual))
      8    into   XMLDoc
      9    from dual;
     10
     11    IF (DBMS_XDB.CREATERESOURCE('/public/dual.xml',XMLDoc)) THEN
     12       DBMS_OUTPUT.PUT_LINE('Resource is created');
     13    ELSE
     14       DBMS_OUTPUT.PUT_LINE('Cannot create resource');
     15    END IF;
     16
     17    COMMIT;
     18
     19  END;
     20  /
    
    PL/SQL procedure successfully completed.
    
    SQL> select xdbURIType ('/public/dual.xml').getClob() from dual;
    
    XDBURITYPE('/PUBLIC/DUAL.XML').GETCLOB()
    -------------------------------------------------------------------------
    
    
      
        X
      
    
    
    1 row selected.
    
    -- You will see an /public/dual.xml file via the WebDav functionality
    
  • How to integrate the dynamic SQL generated in the data definition XML file?

    Hi all

    I have it here is the XML file that is attached to the definition of data model RTF as below. Also, I have a function that will return to create a dynamic query as shown below.

    <?xml version="1.0" encoding="UTF-8"?> 
    <dataTemplate name="XYZ" description="iExpenses Report" Version="1.0"> 
    <dataQuery> 
    <sqlStatement name="Q2"> 
    <![CDATA[
    

    Hi guys,.

    I was able to solve above the requirement. It was not possible to create only from SQL dynamically. Instead, I created a procedure that would create & update (attached to the data definition) XML file dynamically for each race.

    Kind regards

    Patricia K.

  • Hyperlinks in dynamic text fields

    What is the method for creating hyperlinks in dynamic text fields for navigation to other images in the film? http://www.avistarmedia.com/McClure.html

    SM6601 wrote:
    > What is the method for creating hyperlinks in dynamic text fields for navigation to other images in the film? http://www.avistarmedia.com/McClure.html

    using ASfunction.
    Check the help files for the above name, you will get all the details
    detail.

    --
    Best regards

    Urami

    --

    !!!!!!! Merry Christmas!
    &
    Happy new year


    If you want to send me a message - DO NOT LAUGH at MY ADDRESS

  • Best option for creating XML

    Hello

    I am facing problem,

    I have created the XML file, but I can't see it / exit it.

    Please can anyone suggest what's best way to create xml files?

    (1) create xml with DocumentBuilderFactory and then analyze or

    (2) manually create xml hardcoded and save it to the sd card and then access it for analysis.

    I have continuously variable data text in xml files.

    What approach will be following me more?

    Help, please.

    Thank you

    Françoise.

    Why you are unable to view the XML file? How to read as a byte array and look into the debugger? That way at least you can check the syntax of the XML prologue is correct. Then, you can read in as an array of characters using the appropriate encoding and check the syntax of the entire file.

    Regarding the creation of XML code, the best approach depends entirely on what you start with. You have built a DOM model or or do you have custom data structures you want to encode?

    The XMLWriter class in net.rim.device.api.xml.jaxp is not all that useful for generating XML, because it is designed to be used as a Manager when parsing existing XML - it is more than an XML processor to an XML writer. It's not too hard to write your own code to generate XML; a search on the web will be probably some examples of implementation.

    To find out where to keep the XML on the device: the file system, permanent storage, or RMS all work fine. Your basis in the analysis job it will be to open an input stream on what you've stored, create an InputSource of the stream and feed it to one of the analyzers. In general, unless you really need to generate a DOM model, the approach of SAX parser is much more effective. You can create your custom data directly structures as the analysis takes place, rather than going back in a DOM trying to get information. Still, a web search for "SAX compared to DOM parsing" or a similar collection of key words meet a number of good tutorials on how to do this.

    PS After re-reading your original post, I think you may be confused about something. The DocumentBuilderFactory and the SAXParserFactory are tools to transform XML in an internal data structure. You do not use them to go the other way. For this, you are going to have to write your own code, or find others, you can borrow; I don't think that there is something useful in the RIM API. (XMLWriter can be used to move from the existing to the new, equivalent XML, XML, which is not that it would be useful for you.)

  • Assign the XML content to dynamic text fields

    Hey there,

    After the search in the forums, I found that I can load files XML and content to animate CC using the XMLHttpRequest, but how do I load content in a specific dynamic text field?

    I found a few answers that confirm that we should use XMLHttpRequest and some users who made it work, but not how. Any help would be much appreciated.

    Below is how I added the request and how the dynamic field has been implemented.

    This.frame_0 = function() {}

    var xhttp = new XMLHttpRequest();

    xhttp.onreadystatechange = function() {}

    If (xhttp.readyState == 4 & & xhttp.status == 200) {}

    myFunction (xhttp);

    }

    };

    xhttp. Open ("GET","profil.xml", true);

    xhttp. Send();

    Function myFunction (xml) {}

    var xmlDoc = xml.responseXML;

    document.getElementsByTagName("nameTextField").innerHTML = / * this part is not correct, but so far I have found no better solution * /.

    xmlDoc.getElementsByTagName ("title") [0] Sublst.ChildNodes(1).ChildNodes(0) [0] .nodeValue;

    }

    }

    And for the text field (created by animate CC):

    this.nameTextField is new syc. Text ("", "53px 'Arial'");
    this.nameTextField.name = "nameTextField";
    this.nameTextField.textAlign = 'center ';
    this.nameTextField.lineHeight = 61;
    this.nameTextField.lineWidth = 388;
    this.nameTextField.setTransform (265,124.4);

    this.timeline.addTween (syc. Tween.get (this.nameTextField). Wait (2));

    I really hope someone can help, I spent hours looking and trying solutions.

    See you soon,.

    Luke

    As already said:

    this.mydynamictextfield.text = "hello I am text in a dynamic text field";
    

    If you need really, really specific, it would be in this case:

    this.mydynamictextfield.text = animals[0];
    
  • Create a script of the class dynamic text field

    Hi all

    I came across a few subjects that relate to t my question but after reading, try different approaches and internet research, I'm still confused. How to create Visual elements, for example a text field, dynamically from Actionscript in a class file?

    Basically, I created a class file that loads an external XML file and now I want to create fields of dynamic text for the items in the XML file. I did some debugging and I know that the XML is properly loaded. I can also get it to create dynamic text fields when I place the code inside the fla. The problem is when the code is in the class file. I read that you must pass the display for the class object, but I'm still not clear on how to do it.

    Any help would be greatly appreciated! Thank you in advance!

    My fla has the following code on the first frame:

    Import classes.estimatesheet;

    var sheet1:estimatesheet = new estimatesheet("xml/estimationSheetFields.xml");

    Here's my class file:

    {classes package

    flash.xml import. *;
    import flash.display. *;
    import flash.events. *;
    flash.net import. *;
    import flash.utils. *;
    import flash.text. *;

    public class estimatesheet extends Sprite {}

    public var textFields:Array = new Array();

    public void estimatesheet (file:String) {}

    xmlLoader (file);

    }

    public void xmlLoader (file:String) {}
    var loader: URLLoader = new URLLoader();
    loader.dataFormat = URLLoaderDataFormat.TEXT;
    loader.addEventListener (Event.COMPLETE, handleComplete);
    Loader.Load (new URLRequest (file));
    }

    public void handleComplete(event:Event) {}
    try {}
    var allXml = new XML (event.target.data);

    {for each var item: XML (in {allXml.elements ())}
    createSheet (element);
    }

    } catch {(e:TypeError)}
    trace ("cannot parse for XML");
    trace (e.message);
    }
    }

    public void createSheet(data:XML) {}

    var textFormat:TextFormat = new TextFormat ("Verdana", 11);

    {for each var item: XML (in {data.elements ())}

    var textField:TextField = new TextField();
    textField.setTextFormat (textFormat);
    textField.text = element.@label;
    textField.x = 150 * i;
    textField.y = 150 * I
    stage.addChild (textField);
    i ++ ;
    }

    }
    }

    Each feature display MovieClip, Sprite, TextField, etc. should be added to the display list/stack. The addChild in your class only adds TextFields to the estimatesheet class by using addChild (textField) and adds them to the scene of the film using stage.addChild (textField). Note that the latest works if estimatesheet is added to the movie because if estimatesheet is not added to the film the stage property is zero and you can't add items to something that is null, does not exist. AddChild (estimatesheet) prepares the ground for reference the main movie.

    As for making your class of the document class, you need to rearrange some things in your class and add a way to load the XML file. Things aren't sure how flexible can be.

    Sean

  • View of dynamic text in an xml file

    I'm looking to display dynamic text in an external xml file. When I trace for the variable, all is well in the output window. But the text does not appear in the published movie.

    Here is my current code:

    var myXML:XML;
    var myLoader:URLLoader = new URLLoader();
    myLoader.load (new URLRequest ("AskAnExpert.xml"));
    myLoader.addEventListener (Event.COMPLETE, processXML);
    function processXML(e:Event):void {}
    myXML = new XML (e.target.data);

    var topic1:String = myXML.TOPIC [0]. FIELD_NAME;

    trace (topic1)

    };

    On the screen, I have a dynamic text field with an instance name of the Topic1. When I play the movie, the text does not appear. I tried various options of incorporation of text and using _without, but this does not seem to do the trick either. Help!

    You say you have a textfield with an instance name of the topic1, but in your code, you also declare a variable Topic1 you cast as a string.  The two cannot coexist.  If you really have a textfield named topic1then assign the xml value using textfield...

    Topic1. Text = myXML.TOPIC [0]. FIELD_NAME;

    But do not use a varioable with the same name as the TextField

  • Names of dynamic XML files in ODI

    Hi all

    Is there a way can we call the XML names dynamically. ?

    Here's the scenario,
    I have several XML files of the same structure to load into an Oracle table.

    I first created a root XML and gave the exact path and file name for the inversion of the XML model for the first time. The JDBC url was,
    JDBC:SNPs:XML? f = / xml/file / #XML_TEST. FILE_TEST.XML & s = XML_TEST & dod = true & ro = true

    After he hit, I changed the root XML JDBC url
    JDBC:SNPs:XML?f=/XML/file/#XML_TEST.var_FILE_NAME.XML & s = XML_TEST & dod = true & ro = true

    I created a variable * #XML_TEST.var_FILE_NAME* to get all the names of XML file.

    After that I tried to see the data from data warehouses are under previously reverse the XML model, but became the following error:
    java.sql.SQLException: while generating the DTD of the XML, an exception org.xml.sax.SAXParseException is produced by saying: element the Document root is missing.

    Do I need to change anything in the XML model or data warehouses?

    Best regards,
    VERIFIED BY VISA

    Since you are using the Variable, when you right-click and view its lack of required passage of the file, as the variable value is not determined, to do this, you need to refresh or set the variable and call the interface or other objects of ODI and loop continue to read XML files one by one and that should work data store.

  • create table from the XML file at several levels

    Hello

    I'm working on the provision of an app to display xml data, which are currently using data from the settings file where the data was stored in a table.

    CONT =]
    [{txt: 'Perfume'} //main menu]

    [[{txt: 'Top Note', framework: 'topNote'}, {txt: 'Heart notes', frame: "heartNote"}, {txt: frame, 'Note of Base': 'gaps'}] / / submenu]

    ,[
    {txt: 'Packaging', field: 'packaging'} / / main menu

    ]

    ]

    I created an xml file and am able to recover data and impossible to find the same.

    Here's the xml file

    < Products >
    < produces txt = setting "Perfume" = "" > "".
    < = frame 'Top Note' = "topNote" txt file name > < / name of the file >
    < = txt file name ' heart notes"frame ="heartNote"> < / name of the file >
    < file name txt = "Core score" frame = 'gaps' > < / name of the file >
    < / product >
    < produces txt = framework of 'Packaging' = 'packaging' > < / product >
    < produces txt = framework "3D Animation" = "tvAd" video = "true" flvName = "video.flv" w = "547" h = "309" > < / product >
    < product txt framework "advertising Lla' = 'the package' = >
    < name of the txt-file = "Print Ad Creative Pack" frame = "printCp" > < / name of the file >
    < / product >
    < / product >

    AS A CODE

    ---------------------------------------

    (GlobalVarContainer.myXML is the place where is stored the xml file)

    var node:XMLNode = GlobalVarContainer.myXML.firstChild;
    var navItm:int = int (node.childNodes.length);
    for (i = 0; i < wheel; i ++) {}

    var temp_array:Array = new Array();
    var subnavCount:int = int (node.childNodes [i].childNodes.length);     subnav
    var obj:Object = new Object();
    obj.txt = node.childNodes [i] .attributes ['txt ""]
    obj. Frame = node.childNodes [i] .attributes ["frame" "]
    trace (node.childNodes [i]. Attributes ['txt'])

    for (var j: int = 0; j < subnavCount; j ++)
    {
    trace (node.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [j]. Attributes ['txt'])
    obj.subtxt = node.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [j]. Attributes ['txt'];
    obj. Subframe = node.childNodes [i] Sublst.ChildNodes(1).ChildNodes(0) [j]. Attributes ['frame'];
    temp_array.push (obj);
    }
    GlobalVarContainer.my_array.push (temp_array);

    }

    If I add - trace (GlobalVarContainer.my_array); -to code the outout is

    [object Object], [object Object], [object Object]
    [object Object], [object Object], [object Object],.
    [object Object], [object Object], [object Object],.
    [object Object], [object Object], [object Object], [object Object]

    but trace (.txt [i] GlobalVarContainer.my_array + "array"); or trace (GlobalVarContainer.my_array [i] [0] .txt + "array"); no results.

    need advice to move forward from here.

    Thank you

    AYUSH

    What I meant is that if you load the XML e4x, you have to analyze in a table to use it. You can retrieve the syntax of e4x XMLList and use it directly in your code. You can treat the XMLList almost as you treat any array using a for each loop for example.

    Take the code below as an example and adapt it to your needs:

    var mainMenu:XMLList = this.testXML.menu;

    for each {var menu: XML (in mainMenu)}

    trace ("Menu:" + menu.@txt);

    You can use your logic to create menu main point here

    var mynavItem:Navitem = new Navitem (0, spatie * i, GlobalVarContainer.my_array [i] [0], [i, 0], false, true);

    this.holder.addChild (mynavItem); ABLE TO VIEW THE MAIN MENU

    var items: XMLList = menu.children ();

    If (items.length () > 0) {}

    for each {var point: XML (in the points)}

    trace ("point:" + item.@txt);

    Logic of creation of subitem here

    var mySubnavItem:Navitem = new Navitem (dash, spatie * (i + 1 + j), GlobalVarContainer.my_array [i] [2], [i, j], true);

    this.holder.addChild (mySubnavItem);        DISPLAYS ONLY THE LAST ENTRY IN THE SUBMENU

    }

    }

    }

Maybe you are looking for