How to read an XML string that is not an XML file?

I have a script I'm trying to setup that communicates via a socket to retrieve the different directions of a custom Java program.  The Java program listening to requests from the Adobe scripting engine (in my case it is a Photoshop script) on a socket and respond immediately with the next set of directions.  These directions are currently in XML format.  The question I have, is that I can not parse XML data because he entered a new XML object from a string rather than be read from a file.  Even without the socket code, you can see the problem as follows:

var xml = new XML("<test><data>hey!</data></test>");
alert(xml.test.data);
alert(xml);

The first alert "must" return "Hey!" (without the quotes, of course), but it doesn't, while the second warning refers to what you would expect it to:

<test>
    <data>hey!</data>
</test>

It works very well if read from an XML file, but from a string, as indicated above, it is just an empty box when attempting to access 'xml.test.data '.  Any ideas on how to solve this problem?  Can it be fixed?  Has it been fixed in more recent versions (I am currently using CS4)?

Thanks in advance for any help!

Duh... found my mistake... I was trying to access the data by making reference to the created element 'root '.  Given that is the first tag of the element, it is the installer as the root element, which you don't need to reference.  Change alert to alert (xml.data); fixed.

Now I feel stupid, lol...

Tags: Photoshop

Similar Questions

  • OSB: How to read the xml file, which is in OSB project

    Hello

    We have a generic proxy (PG1) reporting and deals alerts, this proxy is called in the pipelines of proxies anothers (P1... PN) in several projects. Each client proxy (P1... PN) PN) before call proxy PG1, configures a variable with syntactic alert or report.

    We thought it would be a good idea to store the specifications for all the proxies of a project as an xml file, so that the proxy PG could read the xml file. This file will be in the OSB project.

    The questions are:
    -proxy can read a xml file that is in the OSB project?
    S ' Please, are all the documentation for this?

    Thank you

    Kind regards

    You can always do customization to work with the properties defined in a XML xquery. The key to this is to use the customization of reference instead of find and replace the customization, similar to the service account customizations.
    Keep your real estate to as properties_dev of env xquery specific xmls, properties_sit etc then apply customization of service proxy xquery reference reference specific correct env.

  • How reference/read an XML file?

    Instead of the inline XML content, pls see code below, thank you.

    <? XML version = "1.0"? >
    <!-dpcontrols / DataGridSimple.mxml->
    "< mx:Application xmlns:mx = ' http://www.adobe.com/2006/mxml" > "
    <!--
    < mx:XMLList id = "employees" >
    < employee >
    < name > Christina Coenraets < / name >
    555-219-2270 < phone > < / phone >
    < email > [email protected] < / email >
    true < current > < / current >
    < notes >
    Christina is a hot chic.
    < / notes >
    < / employee >
    < employee >
    < name > Joanne Wall < / name >
    555-219-2012 < phone > < / phone >
    < email > [email protected] < / email >
    true < current > < / current >
    < notes >
    What a and b!
    < / notes >
    < / employee >
    < employee >
    < name > Maurice Smith < / name >
    555-219-2012 < phone > < / phone >
    < email > [email protected] < / email >
    < active > false < / current >
    < notes >
    Just a pimp.
    < / notes >
    < / employee >
    < employee >
    < name > Mary Jones < / name >
    555-219-2000 < phone > < / phone >
    < email > [email protected] < / email >
    true < current > < / current >
    < notes >
    Mary, Mary, Mary
    < / notes >
    < / employee >
    < / mx:XMLList >
    ->
    < mx:Panel title = "DataGrid Control Example" height = "100%" width = "100%".
    paddingTop = "10" paddingLeft = "10" paddingRight = "10" >

    < mx:Label width = '100% ', color = 'blue '.
    Text = "Select a row in the DataGrid control" / >

    <!-old reference inline, dataProvider = {employees}->
    {< mx:DataGrid id = "dg" width = "100%" height = "100%" rowCount = "5" dataProvider="{C:\ColdFusion8\wwwroot\Flex\employees.xml}" > "
    <!-this above dataProvider reference will not work, how? ->
    < mx:columns >
    < mx:DataGridColumn dataField = "name" headerText = "Name" / >
    < mx:DataGridColumn dataField = "phone" headerText = "Phone" / >
    < mx:DataGridColumn dataField = "email" headerText = "Email" / >
    < / mx:columns >
    < / mx:DataGrid >

    < mx:Form width = '100 percent"height ="100% ">
    < mx:FormItem label = "Name" >
    < mx:Label text="{dg.selectedItem.name}"/ >
    < / mx:FormItem >
    < mx:FormItem label = "Email" >
    < mx:Label text="{dg.selectedItem.email}"/ >
    < / mx:FormItem >
    < mx:FormItem label = 'Phone' >
    < mx:Label text="{dg.selectedItem.phone}"/ >
    < / mx:FormItem >
    < mx:FormItem label = 'Notes' >
    < mx:Label text="{dg.selectedItem.notes}"/ >
    < / mx:FormItem >
    < / mx:Form >

    < / mx:Panel >

    < / mx:Application >

    in DataGrid dataProvider attribute does not point to a file. He uses (I think) E4X to set a path to a data provider (i.e. HTTPService). You need to access the XML file using a provider of data first and then use this reference to access the data of the element in the document through the dataProvider.

    Hope that helps a little.

  • How to read report .xml to a printer?

    How to read the .xml report that is sent by e-mail?  You open the file with something?

    Use the player to open the file. The report should be readable on the side of keft.

  • How to read the xml and save the contents of the ITA in .txt format

    Hello

    Is it possible to read an xml file and save it in the .txt format. Please let me know if there is a way to do it.

    Thank you

    Ankit G

    That read the function is only for xml files written using the LabVIEW diagram, so if you have something else, you need the functions in the range of xml parser.

  • How to read an XML in Jet?

    I'm reading an xml file and then display the content in a table, I almost work, but something is wrong with the timing of the process (it seems to me read that xml will take place no later then the binding).

    Any help will be much appreciated. The xml I want to read can be downloaded here.

    HTML code:

    <! DOCTYPE html >

    < the table id = "table2" summary = "Album list" aria-label = "Table of the Album."

    link data = "ojComponent: {component:"ojTable"}"

    data: data source,.

    columnsDefault: {sortable: 'none'},

    columns: [{headerText: 'Id'}]

    {field: 'id'},

    {headerText: "Artist",}

    {field: 'artist'},

    {headerText: 'Title',}

    {[{scope: 'title'}]} ">"

    < /table >

    JavaScript code:

    deptArray = new Array();

    require ([' OJ/ojcore', 'knockout', 'jquery', ' OJ/ojknockout', 'promise', ' OJ/ojtable'],)

    function (JO, ko, $)

    {

    function viewModel()

    {

    loadXMLDoc();

    Alert('test:'+deptArray.Length);

    var self = this;

    deptArray = [{id: 1, artist: 'a', title: 'b'}];

    deptArray.push ({id: 2, artist: "c", title: "d"});

    Alert('test:'+deptArray[0].) Artist);

    Self.DataSource = new JO. ArrayTableDataSource (deptArray, {idAttribute: 'id'});

    }

    var vm = New viewModel;

    $(document) .ready

    (

    function()

    {

    Alert ('start');

    ko.cleanNode ($('#table2') [0]);

    ko.applyBindings (vm, document.getElementById ('table2'));

    Alert ('end');

    }

    );

    });

    function {} loadXMLDoc()

    var XMLHTTP = new XMLHttpRequest();

    XMLHTTP.onreadystatechange = function() {}

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

    myFunction (xmlhttp);

    }

    };

    XMLHTTP. Open ("GET", "cd_catalog.xml", true);

    XMLHTTP. Send();

    Alert('loadxmldoc:'+deptArray.Length);

    }

    Function myFunction (xml) {}

    var i;

    var xmlDoc = xml.responseXML;

    var l_artist;

    var l_title;

    var x = xmlDoc.getElementsByTagName ("CD");

    for (i = 0; i < x.length; i ++) {}

    l_artist = x [i] .getElementsByTagName ("ARTIST") [0] Sublst.ChildNodes(1).ChildNodes(0) [0] .nodeValue;

    l_title = x [i] .getElementsByTagName ("TITLE") [0] Sublst.ChildNodes(1).ChildNodes(0) [0] .nodeValue;

    If (I = 0) {}

    deptArray = [{id: i, artist: l_artist, title: l_title}];

    } else {}

    deptArray.push ({id: i, artist: l_artist, title: l_title});

    }

    }

    Alert('myFunction:'+deptArray.Length);

    }

    I hope this helps you: https://blogs.oracle.com/geertjan/entry/reading_xml_in_oracle_jet

  • How to avoid the ASSERT message "PMString::SetKey - call SetKey with a string that is not a translation?

    Getting below to ASSERT the message when you try to store a value in the PMString object.

    PMString::SetKey - call SetKey with a string that is not a translation

    No idea how can I avoid this message? Y at - it any changes required in the .fr file?

    Try using a Widestring instead, because you don't need translation. If you do not, try SetTranslated()

  • How to open an XML file in Adobe Reader on a form created in LiveCycle ES2

    I need help to conversion or reading an XML file, I had sent me a form I created in Adobe LiveCycle ES2 without using Office Suite complete Adobe (I think that if I have any other programs, I wouldn't have to have additional permissions to see what I could create, don't you think?).  I'm looking to display the form in Reader or Acrobat or even in LiveCycle itself, and the course of my research I've just been hitting brick walls.  Any help out there?

    If it is Acrobat X or more later, click on tools and go to the forms section. Perhaps more Options - form data management - Import.

  • 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

  • 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

  • How can we create a promotion that is not out of the box?

    Hello
    How can we create a promotion that is not out of the box?

    Hello

    You can create a new descriptor from point to point in atg/commerce/pricing/pricingModels.xml.

    ~ Abdelali

  • How to analyze an XML file in illustrator plugin?

    My current task is this: Open the file system xml file (later it is a remote service), parse the xml code, display the contents of an XML to the user. After that, there are other measures, but I'm stuck at the first step itself. What Illustrator plugin sdk API let me parse xml and create a dom out of it? Thanks in advance.

    Version: Illustrator CS 5.1

    Are not XML parsing API in the SDK of Illustrator. They have a suite of XML - ish, but it's for the management of metadata of a document, which - at least through the API - looks & feels like XML.

    If you want to analyze & read an XML file, there are many other libraries, that you can use to do. We use Xerces, which is one of the most widely used XML libraries.

  • Need help to read the xml file and place it in a table.

    Nice day!

    Here is the configuration. I have a xml file from another source which will call a stored procedure in my database (which I am supposed to create). This is a first for me, I've never done development pl/sql or worked with xml. :(

    That's what I hoped to accomplish, if there is a better way, that I am open to him.
    In short, to have a stored procedure that takes the xml file (transmitted by third parties via the call, no url must be a file), creates a temporary table and populates the two columns needed. Then, the SP will make a select join with the temporary table and other data available in another schema. Once the completed table selection will be truncated and dropped. SP farm.

    Details:
    DB: Oracle 11.2.0.1 RAC.
    Charset: AL32UTF8
    Example of XML: (nearly 10,000 lines like this in production)
    "< MerchantID report =" "#" name = 'Conversion detail report' ReportStartDate = '2011-09-27 12:00:00GMT' ReportEndDate = '2011-09-27 21:38:13GMT"Version ="1.1"> < Conversion = '1234567891234567 D' MerchantReferenceNumber Convertingdate =" 2011-09-27 13:39:02 "RequestID ="1234567891234567891234"> < OriginalDecision > REVIEW < / OriginalDecision > < NewDecision > ACCEPT < / NewDecision > < Reviewer > testusr < / examiner > < ReviewerComments > no reason to reject. < / ReviewerComments > < Notes > < Note Date = "2011-09-27 13:39:02" AddedBy = "testusr" comment = "Took possession" / > < / Notes > < queue > Digital Review < / queue > < profile > Digital orders QA < / profile > < / Conversion > "
    ...
    < / report >

    What I tried.
    I found a tutorial: http://it.toolbox.com/blogs/oracle-guide/oracle-and-xml-in-action-a-real-world-example-5319 I tried and was able to make it work. But I could not duplicate the results with my xml file. So I looked away and have had no success. :( I'm not a developer, so I'm really bad...

    I found a note of support: (how to load an XML file into a Database Table using DBMS_XMLSave unaided Bfile [227476.1 ID]) and couldn't make it work.

    I found some online then Odie son xml and tried these but slipped and couldn't get my versions of these great answers to work for me.

    Then... I'm here now and hoping that someone could walk me through this.


    I tinkered this SP (it doesn't have to be that way, the suggestions are greatly appreciated)

    create or replace procedure xml_to_table (call_1 call_2) as

    Start
    run immediately "CREATE GLOBAL TEMPORARY TABLE XMLType IMRPT
    --(clé primaire contrainte-imrpt_pk (MerchantReferenceNumber))
    XmlType store as xml binary basicfile
    -(high compression)
    virtual columns
    (MerchantReferenceNumber as (xmlcast (xmlquery ('/ Conversion/MerchantReferenceNumber ' from object_value content back) as VARCHAR2 (32))))
    , NewDecision as (xmlcast (xmlquery ('/ Conversion/NewDecision ' from object_value content back) as VARCHAR2 (10)))
    )
    -ON COMMIT PRESERVE ROWS

    run immediately 'save xml as a file on the local system?'

    insert into IMRPT (MerchantReferenceNumber, NewDecision)

    run immediately "join select statement.
    run immediately 'truncate table IMRPT.
    run immediately "drop table IMRTP.

    end;
    /

    On my last test, I tried to select just in the xml file using this:

    DECLARE
    indomdoc DBMS_XMLDOM. DOMDocument;
    innode DBMS_XMLDOM. DOMNode;
    myParser DBMS_XMLPARSER.parser;
    buf VARCHAR2 (2000);
    BEGIN
    myParser: = DBMS_XMLPARSER.newParser;

    DBMS_XMLPARSER.setBaseDir (myparser, 'XML_DIR');
    DBMS_XMLPARSER. Parse (myParser, "test.xml");

    indomdoc: = DBMS_XMLPARSER.getDocument (myParser);

    -just to test content
    innode: = DBMS_XMLDOM.makeNode (indomdoc);
    DBMS_XMLDOM.writeToBuffer (innode, buf);
    Dbms_output.put_line (BUF);

    dbms_xmldom.freeDocument (indomdoc);
    dbms_xmlparser.freeParser (myParser);
    END;
    /

    It was another accident and burn.

    Any help would be appreciated.

    Thank you

    Like I said:

    Here is an example using a REF CURSOR variable ( you will need to declare a plus for your actual procedure )

    Your procedure has two parameters, you must declare two variables to hold the two REF CURSOR ;)

    DECLARE
    
      v_filename      VARCHAR2(50) := 'DMReport.xml';
      v_rc1            SYS_REFCURSOR;
      v_rc2            SYS_REFCURSOR;
    
      v_order_name       VARCHAR2(100);
      v_reason_text      VARCHAR2(100);
    
    BEGIN
    
      xml2table(v_filename, v_rc1, v_rc2);
    
      commit;
    
      loop
        fetch v_rc1 into v_order_name;
        exit when v_rc1%notfound;
        dbms_output.put_line('ORDER_NAME='||v_order_name);
      end loop;
    
      close v_rc1;
    
      loop
        fetch v_rc2 into v_order_name, v_reason_text;
        exit when v_rc2%notfound;
        dbms_output.put_line('ORDER_NAME='||v_order_name||', REASON_TEXT='||v_reason_text);
      end loop;
    
      close v_rc2;
    
    END;
    /
    

    If you test this in SQL * Plus, do not forget to SET SERVEROUTPUT ON to see the result.

  • How to import the XML file into an oracle table using a BPEL process

    Hi friends

    How can I import XML file in the db oracle table using a BPEL process

    (1) I have generated an XML file in my local system with a field
    (2) I created a temporary table in my oracledb with the same field in the XML file
    (3) that I want to import these XML files which is the local host to my db oracle using a BPEL process
    (4) for that what steps should I me fallow please suggest me if there is no document for this?

    Thanks in advance
    AT

    Hi to

    Here you go...

    http://blogs.Oracle.com/ajaysharma/2011/03/using_file_adapter_database_adapter_and_mediator_component_in_soa_11g.html

    I hope that helps!

    Thank you
    AJ

  • Reading an xml file

    Hi all

    I want to read an xml file and add that a large number of boxes with the names specified in xml.

    Can someone please share a working code example please

    Thank you

    Lima

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

    Greg Lafrance - Flex 2 and 3 certified ACE

    www.ChikaraDev.com

    Flex / development, training, AIR and Support Services

    
    
      
      
      
        
      
    
    
    
    
      check1
    
      check2
    
      check3
    
    
    
  • How do you get older emails that have not been deleted?

    How do you get older emails that have not been deleted?

    You have not really us given enough to go. According to the application or device, you may be able to change the settings to display a larger number of messages, or those received over a long period of time.

    TT2

Maybe you are looking for

  • I get "PAGE not FOUND" when you try to download the drivers for my Laserjet 1320N

    I am trying to download a driver for the HP Laserjet 1320N printer The link to my driver download page is here: http://h20000.www2.HP.com/bizsupport/TechSupport/SoftwareDescription.jsp?lang=en & CC = US & prodTypeId = 18... But when I go here and cli

  • DST short failed. the information of failure has been given

    My PC turns on but when the desktop icons should appear that the screen turns off on the keyboard, the internet light will not show that it is online, nor how depressed he will change. I ran a test that ended by a short power outage starting DST. The

  • Fail gracefully with missing dll

    Hello again all you lovers forum useful! The Situation: I have an application that includes a few subVIs that call the two DLLs via call library function Node live.  After generating the application and put the executable file and the two DLLs on ano

  • Smart phone BlackBerry Z10 stolen

    10 times id try BB Blackberry Office delete my account. Now my phone is stolen. Same Email I create a new blackberry account. But now when sign in Show me The Massage the Protection feature is enabled. How to solve it. Please tell me any solution. En

  • Hearts

    I have recently upgraded to Windows 7 on both of my computers and the game of "Hearts" is available on the Home Premium version, it is not present on (the professional version in).Could you please tell me how I can make this game available on my main