Writing an XML file on disk using PHP

Hello.

I decided it's time to ask for help with the issue I'm having.

I have a photo gallery that loads images with a legend with the aid of a local XML file. I want the user to click on a photo to change the caption and thus change the XML. Then I need to rewrite the XML in Flex updated in the local XML file. I'm really surprised that I was not able to find examples online. I learned that the security settings are preventing us to write directly on the Flash/Flex, the solution disk, with I came is therefore to use PHP. Currently, Flex passes the XML updated string to the PHP script and PHP replaces the local XML file with the string.

I have 2 numbers.

1. I can see in the bin-debug folder that the updated file XML is written correctly, but raise the request meets my TileList with OLD data.  The strange thing is that if I delete the XML file completely from my project (source and bin-debug folders), or if I change the URL in the httpService to an alias file, the application still works very well with old data. The other weird thing is that a few times during my troubleshooting, suddenly has worked well as expected. I tried to clean up the project and many other things that I can't even remember (like changing the path to the PHP/XML files, run the application outside of Flex Builder, change the path to build in the project settings)...

Am I right in thinking it's weird, or am I missing something really simple? Any ideas? I'm even on this a good way to write the XML through PHP?

2. the second question, I think is less important, but I will explain because maybe it is related to the first. By clicking on the button to call the PHP script causes the text "localhost... data transfer". "appears at the bottom of my browser indefinitely.

Thanks in advance.

Simply attach a timestamp after each call to xml:

var req:URLRequest = new URLRequest ("http://localhost/gallery.xml?refresh=" + new Date () .getTime ());

This will make the browser suggests that the link can be potentially a different content due to URL variable evolution and recharge it every time.

Tags: Flex

Similar Questions

  • How to load an XML file for salesforce using API BULK?

    Hello

    Please let me know how to download an XML file for salesforce using API bulk?

    Thank you

    AND

    Hello

    I think it's a matter of SalesForce.com more and think that you will have better luck in looking at SOAP API Developer Guide for salesforce. Sending of a server API SOAP request is very straight forward and there are several tutorials and well documented in this topic.

    See you soon,.

    Stefan

  • Writing a XML file

    I have successfully read a XML file in my script and data used.  Very convenient.

    Now, I want to be able to create an XML file and save it.

    I saw in the documentation for the addition of a child and so on - so I think I can handle this small.

    I guess I can save a file (locally) - but how? I was not able to find a "Save".

    If you are targeting FlashPlayer 10.x and store your data in an XML object, use this:

    #save () .html http://help.Adobe.com/en_US/FlashPlatform/reference/ActionScript/3/Flash/NET/FileReference

    var yourXML:XML = {your object/XML data};

    var file:FileReference = new FileReference();

    leader. Save (yourXML, "YourXMLFilename.xml");

  • Load the XML file into oracle using sql loader

    Hello

    I'm trying to load an xml file into a table using sqlldr.
    I have a table as follows:
    CREATE TABLE xmlloadtable
    ( id number,
     data_xml XMLType
     )
      XmlType data_xml STORE AS CLOB;
    I have a control file that I know is perfectly false:
    LOAD DATA 
    INFILE '/home/oraread/'
    INTO TABLE xmlloadtable 
    (
    id,
    data_xml 
    )
    I googled for the file control and tried in different ways, but of no use.
    I want to load the entire xml file into the table.
    Can someone help me with the correct control file. Any help is appreciated!

    Try this

    LOAD DATA
    INFILE '/home/oraread/'
    INTO TABLE xmlloadtable
    (id,
     file_name          filler,
     data_xml          lobfile(file_name) terminated by eof
    )
    

    You can add the file as a column name field to your table between the id and xml column and remove the word to fill in the .ldr file if you need to keep the name of the file

  • writing the xml file

    Hello

    How can I create an xml file in a plugin? I found LrXml for the creation of it, but I don't know, how to save a file.

    Thank you

    Marco

    5.3 Lua reference manual

  • Export the sequence XML file browse for use in another project

    When I generate a browse sequence based on the table of contents by using zero for the level of the pound, rather than get A, A1, A2, B, B1, B2, I receive A, B, A1, A2, B1, B2.  The table of contents first crosses all elements of level 1, cycles backwards through all the level 2 element, then 3rd level, etc.

    My solution was to automatically create the sequence to browse at level 0 and then manipulate manually to the output depending on how my readers would actually read my book online (IE A Aa A1 A1a A1b A2 A2a A2b B B1 etc etc).

    Now that I have my sequence in the correct order for this project, I don't want to repeat these steps each time I create a new version of my HLO for the guide even after that a few minor updates have been made to the source of the FM.

    There is a file named whbrs.xml in the output folder and contains the sequence order of travel that I specified in my no workaround.

    Is it possible to export this file to another location for use in another project that references the same guide?

    This methodology is much preferred, as I work at a level of the company with several documents (some numbering in the hundreds of pages) and do not want to have to manually use my solution for each project that I update in the next few years.

    Hi Kristopher

    You probably don't want to use that particular file, because it is an output file. You'd probably have better luck using the file ProjectName.BRS as this one must be a source file.

    However, keep in mind that if (or how) it will work completely will depend on having the recipient project using the same identical structure and identical file names.

    See you soon... Rick

    Useful and practical links

    Wish to RoboHelp form/Bug report form

    Begin to learn RoboHelp HTML 7, 8 or 9 in the day!

    Adobe Certified RoboHelp HTML Training

    SorcerStone blog

    RoboHelp EBooks

  • Is there a way (yet) to save a PDF file to disk using Acrobat Reader iOS iCloud

    Any suggestions on how to save a file Acrobat Reader in iCloud drive in iOS.  It doesn't seem to be one obvious solution other than emailing myself or using Dropbox. Surprising Adobe has not yet added this feature of Acrobat Reader.

    While we do not currently provide support for the economy to iCloud Drive, iOS 10 will add this feature, and if you install the public beta version of iOS 10, you can try:

    IOS 10, when the document is opened in Acrobat Reader, press the ' share' button to the right of the toolbar at the bottom. Then select "Open in... ' and then select 'Add to iCloud Drive' in the bottom row of the icons.

    It is also interesting to note that with the latest version of Acrobat Reader (even with iOS 9), if you open a file to iCloud by car (via 'more places' in the scene selector), all changes will be saved to iCloud by car.

  • How to find quotes double in searching the Catalog Manager XML and replacement tool? Is it still possible without writing an XML file?

    I am struggling with the XML search and replace in Catalog Manager tool. I want to find a particular column, but due to generic problems, I want to find with the intact double quotes and then replace with double quotes too. For example:

    Front: "CSM_MBR_ASA_INP_EFF_DT"

    After: "Effective Member ASA entry Date"

    The problem with just the text, is that there are columns like CSM_MBR_ASA_INP_EFF_DT_NEW used in the reports that I don't want to touch.

    When I do the exact search and replace as above, I get no results.

    "

  • shipment value of the PHP variable to Flash to load an xml file

    I would like to load an XML file to the local location or on the server to ignore the name of the file. I use PHP to send the name of the Flash file.

    Here it is the PHP code:

    <? PHP

    filesInDir ('C:\Documents and Settings\457305\My Documents\shrikant\Flash Tutorials\webassist');

    function filesInDir ($tdir)

    {

    $dirs = rewinddir(3) ($tdir);

    foreach ($dirs as $file)

    {

    If (($file == '.') |) ($file == '..'))

    {

    }

    else if (is_dir ($tdir. » /'. $file))

    {

    filesInDir ($tdir. » /'. $file);

    }

    on the other

    {

    echo "fileName = $file";

    }

    }

    }

    ? >

    And here is the Actionscript code loading:

    import flash.net.URLLoader;

    import flash.net.URLRequest;

    import flash.events.Event;

    to import flash.net.URLVariables;

    Stop();

    Set the PHP file to load

    var phpFile:String = " " http://localhost/WebAssist/test.php ";

    var cons_xml:XML;

    var xmlLoader:URLLoader = new URLLoader();

    Specify the property dataFormat of the URLLoader to be "VARIABLE".

    This ensures the variables loaded into Flash with the same variable names

    xmlLoader.dataFormat = pouvez;

    xmlLoader.load (new URLRequest (phpFile));

    xmlLoader.addEventListener (Event.COMPLETE, processXML);

    function processXML(evt:Event):void

    {

    trace (evt. Target.Data.FileName);

    cons_xml = new XML (evt.target.data.fileName);

    gotoAndPlay (2);

    }

    When I trace evt.target.data it displays "fileName = mainOpenEndedXML % 2Exml" and when I trace evt.target.data.fileName the file name is correctly displayed as 'mainOpenEndedXML.xml'.

    But in the two next lines where the loading is done that it does not load the file IE does not play the SWF to an xml file.

    I've searched the Internet to find answers, but not able to find solutions.

    Loading works fine if I insert the xml file directly in the code and the SWF in the XML file plays correctly. Here it is the code for the same thing:

    import flash.net.URLLoader;

    import flash.net.URLRequest;

    import flash.events.Event;

    to import flash.net.URLVariables;

    Stop();

    var cons_xml:XML;

    var xmlLoader:URLLoader = new URLLoader();

    xmlLoader.load (new URLRequest ("mainOpenEndedXML.xml"));

    xmlLoader.addEventListener (Event.COMPLETE, processXML);

    function processXML(evt:Event):void

    {

    cons_xml = new XML (evt.target.data);

    gotoAndPlay (2);

    }

    Any help on this would be greatly appreciated


    You said you use PHP to send the name of the Flash file.  If the php file you provide only the name of the xml file that you need to load, then you will have to load the xml file in the same way that you show in your last set of code where you say that load you it directly.

  • Issue when writing xml file

    Guys,

    I read the data in table and writing to XML file and see the following error when it reached create table step.

    ODI-1228: LOAD_DATA_COMM (export) failed on target connection XML COMM_POS.

    Caused by: java.sql.SQLException: unexpected token: C$ _COMMDAILY required:)

    at org.hsqldb.jdbc.Util.sqlException (unknown Source)

    for org.hsqldb.jdbc.JDBCPreparedStatement. < init >(Unknown Source)

    at org.hsqldb.jdbc.JDBCConnection.prepareStatement (unknown Source)

    at com.sunopsis.jdbc.driver.xml.SnpsXmlConnection.prepareStatement(SnpsXmlConnection.java:1177)

    at sun.reflect.GeneratedMethodAccessor65.invoke (unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

    at java.lang.reflect.Method.invoke(Method.java:597)

    to oracle.odi.core.datasource.dwgobject.support.OnConnectOnDisconnectDataSourceAdapter$ OnDisconnectCommandExecutionHandler.invoke (OnConnectOnDisconnectDataSourceAdapter.java:200)

    to $Proxy2.prepareStatement (Unknown Source)

    at oracle.odi.runtime.agent.execution.sql.SQLCommand.doInitializeStatement(SQLCommand.java:83)

    at oracle.odi.runtime.agent.execution.sql.SQLCommand.getStatement(SQLCommand.java:117)

    The pointers will be appreciated!

    Thank you

    The problem solved by mentioning the name of correct schema in the physical schema.

  • the tag of 'mode' in the editable using getconfig() and setconfig() vhost.xml file?

    the tag of 'mode' in the editable using getconfig() and setconfig() vhost.xml file?

    Use the same code I gave before, simply replace:

    admin_nc. Call ("setConfig2", new Result1 (), "Proxy/Mode", "remote", "Adaptor:_defaultRoot_ / VHost:_defaultVHost_");

    by

    admin_nc. Call ("getConfig2", new Result1 (), "Proxy/Mode", "Adaptor:_defaultRoot_ / VHost:_defaultVHost_");

    Redefine Result1() as:

    function Result1() {}

    this.onResult = {function (info)}

    If (info.code == "NetConnection.Call.Success") {}

    for {(i in info.data)

    trace (info. Data [i]);

    }

    }

    }

    }

  • problem write/read an xml file

    Hello world

    IM using ksoap library to access my webservice, if everything is ok, my webservice returns an xml file, then I use this file to show some information in my application.

    In the Simulator, everything works perfectly (BB simulator_5.0.0.411_8900), but in a real BB does not work, the app show me a NullPointerException.

    Anyone has an idea about this?

    public void CargaDatosIniciales(){
    
        String result="";
    
        String serviceUrl = "http://myserver.com/blackberry/soap.php";
        String serviceNamespace ="http://myserver.com/blackberry/soap.php";
        String soapAction = "http://myserver.com/blackberry/soap.php?wsdl";
    
        rpc = new SoapObject(serviceNamespace,"cargarVideos");
        rpc.addProperty("Login", usr);
        rpc.addProperty("Password", password);
        rpc.addProperty("user_agent", userAgent);
    
        try{
            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            envelope.bodyOut = rpc;
            envelope.dotNet = false;
            envelope.encodingStyle = SoapSerializationEnvelope.XSD;
    
            HttpTransport ht = new HttpTransport(serviceUrl);
            ht.debug = true;
            ht.call(soapAction, envelope);
            result = (envelope.getResult()).toString();
            writeXML(result,1);
    
        }catch(Exception e){
    
        }
    
    }
    
    private void writeXML(String result,int f) {
    
        String URL = "file:///SDCard/BlackBerry/documents/";
        String filename="";
        if(f==1){
    
            filename = "datosXML.xml";
        }
    
    ....
        String fName=URL+filename;
        try {
             DataOutputStream os = null;
                FileConnection fconn = null;
                try {
                        fconn = (FileConnection) Connector.open(fName, Connector.READ_WRITE);
                        if (!fconn.exists()){
                            fconn.create();
                        }
                            fconn.delete();
                            fconn.create();
    
                        os = fconn.openDataOutputStream();
                        os.write(result.getBytes());
                } catch (IOException e) {
                        System.out.println(e.getMessage());
                } finally {
                        try {
    
                            if (null != os)
                                        os.close();
                                if (null != fconn)
                                        fconn.close();
                        } catch (IOException e) {
                                System.out.println(e.getMessage());
                        }
                }
    
        } catch ( Exception e ) {
    
        }      
    
    }
    

    PD: Sorry for my English.

    In most cases, 'deviceside = true' does not work unless it is accompanied by specific carrier APN info.

    The AFN must be defined in the parameters of TCP devcie or added to your URL.

    See the following article:

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What_Is...

    .. and this one:

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/How_To _...

  • Reading an XML file and write the content in another file xml in java

    Hello

    I'm new to xml parsing. My requirement is that I get a message (xml) using ibm MQ in the ByteArrayInputStream format. I read this xml message and write to another file.

    To do this, I create a CEP.

    First of all, I used simple reading and writing concept, but the output is "java.io.FileInputStream@3e25a5".
    Example of xml file
    -< customer >
    < > 1234 ClientId < / ClientId >
    STechnology < ClientName > < / ClientName >
    < DTU_ID > 567 < / DTU_ID >
    < ClientStatus > ACTIVE < / ClientStatus >
    -< LEAccount >
    < Customer > 678989 < / customer >
    < > 56743 LEId < / LEId >
    -< account >
    < AccountNumber > 9876543678 < / account number >
    < / account >
    < / LEAccount >
    -< Service >
    Y2Y < Cindicator > < / Cindicator >
    < PrefCode > 980 < / PrefCode >
    < BSCode > 876 < / BSCode >
    < MandatoryContent > MSP < / MandatoryContent >
    < / service >
    < / customer >

    Code:


    import java.io.ByteArrayInputStream;
    import java.io.FileInputStream;
    to import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;

    public class ByteArrayInputStreamToXml {}

    Public Shared Sub main (String [] GIS) throws IOException {}

    InputStream inputStream = new FileInputStream("C:\\soft\\test2\\sample1.xml");
    currentXMLBytes Byte = inputStream.toString () .getBytes ();
    ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream (currentXMLBytes);

    OutputStream out = new FileOutputStream("C:\\soft\\test\\data.xml");
    int read = 0;
    ubyte bytes [] = new byte [1024];

    While ((read = byteArrayInputStream.read (bytes))! = - 1) {}
    out. Write (bytes, 0, read);
    out. Write ("\n");
    }

    inputStream.close ();
    out. Flush();
    out. Close();

    System.out.println ("new file created!");

    }

    }

    Please suggest me how can I use DOM/SAX parser, I see several code on the net to read the xml file using SAX/DOM parser, but write an xml file after reading using ByteArrayInputStream I don't get. Assistance through some link examples will also be useful for me.

    Thank you
    Sumit

    Published by: user8687839 on April 30, 2012 02:37

    Published by: user8687839 on April 30, 2012 02:43

    user8687839 wrote:
    But the file is coming thanks to a queue and byte format. Must read the byte, and write to a file. So, how I tried to read the byte using the code above. Please suggest me the correct way.

    Simply write the bytes of the contents of the queue directly to a FileOutputStream. Still no need to SAX or DOM!

    Pseudo-code-

    Open a FileOutputStream .
    
    Until all the bytes of the queue have been read
        read some bytes from the queue.
        wite these bytes to the FileOutputStream.
    
    Close the FileOutputStream.
    

    Published by: sabre150 on April 30, 2012 11:30

  • XML file not load locally...

    Hello

    I created a project, and it uses an xml file that I used in the current folder in the src of the project (the project was born in D:\C Drive\Documents\SAP UX\go_green\wasl_DB\bin-debug). The path of the url I used in HTTPService is:

    "< mx:HTTPService id ="srv"url =" assets/datafile.xml"result =" srvResultHandler (event) "fault ="srvFaultHandler (event)"/ >

    It works fine when I run it through flex, IE, he gets the outcome of srvResultHandler. But when I moved the folder bin-debug on some other disk and on another folder, and when I tried to open the swf file, it fails. It is based on failure to srvFaultHandler, where I gave an alert message, "Error reading xml file.".

    Can you get it someone please let me know where mistaken? I don't want to run this in any server, I want to run 3 desktops locally always...

    Help, please...

    -Deepak

    Add a compiler argument -use-network = false in your setting of the project compiler:

    -Right click on the project (it must be open), go to properties

    -go to the section of the Flex compiler.

    -Add the argument that precedes in the additional compiler arguments (you might have -local en_US already there, put a space after it and paste top one.)

    It will be useful.

  • get XML file line cordinates

    Im trying to flash gett to draw a white object the cordinates that is in the xml file.

    IM using a javagui to set the cordinates and the XML file is waiting to be genertad by a php script.

    okej I gott to function after som clean som moving around and kglads code, I gott to function.

Maybe you are looking for