[InD. CS5 Server][JS] XML-Import, how to receive data?

Hello everybody!
I tried to import an simple XML with the ExtendScript Toolkit on InDesign CS5 Server with the following script:
var myXmlFile = new File("../path/blubb.xml");
var myContent;
myXmlFile.open("r", undefined, undefined);
while(!myXmlFile.eof){     myContent = myXmlFile.read();     var xml_value = myContent.childNodes[0].getElementsByTagName('ROOT').nodeValue;     //var xml_value = myContent.getElementsByTagName('ROOT').item(0).firstChild.nodeValue;      alert(xml_value);
the XML-FIle is this:
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
     <TEST>blubb</TEST>
     <TEST2>bla</TEST2>
</ROOT>
If i alert myContent, there is the whole XML in the terminal output in one line. And the console of the ExtendScript Toolkit says "Execution finished. Ergebnis: undefined". (why is the result: unfinished?)
Now i tried to get some nodeValues in different ways (from different tutorials) but sometimes theres an error "myContent.getElementsByTagName is not a function". So i tried different ways, without this functions but if i tried to access the nodes like this:
var xml_value = myContent.item[0];
or some other compositions with "firstChild", "item[x]" and "nodeValue", there is the error message "undefined is not an object".
Could anyone please give me a hint, how to read the xml-data in a loop? I need to parse some XML-FIles from InDesign-CS2-Documents and create new InDesign-CS5-Documents, but stucked already at the first step...
Thanks for your reponses!
Greetings
Sybriz

InDesign needs to know that it's actually XML, so make sure to use an XML object.
Use something like this:
myXMLFile =  File ('path+ filename + '.xml');
    myXMLFile.open('r');
    var currentXML = new XML(myXMLFile.read());
There's more documentation on E4X here: Use E4X. There's a tutorial here: https://developer.mozilla.org/en/E4X_Tutorial

Similar Messages

  • How generate a XML file & how to save data in that file?

    hi,
    How to generate an xml file & how to add data in that xml file? is there anyone who can help me about this? Firstly i need to open a xml file and after that i need to save user data in that file? how i will do it? What will be the solution of this? please give me solution........
    with regards
    Bina

    With an API like Xerces you can parse an XML document into a DOM tree. You can do modifications on that tree manually and then write it back out as XML data.
    http://xerces.apache.org/xerces2-j/

  • Newbie - XML File - How to load data and populate tables

    Hi,
    I'm newbie to XML data handling.
    I have a file that is provided in XML format with data from an external system.
    I need to load data from that file and populate some field in one or more tables.
    I have two options:
    1. Load the XML file directly from OS and populate the tables directly (I'm not sure if this is possible or not)
    2. Load the entire XML file from OS into a CLOB or a BLOB(?) and the select the data form the CLOB and populate my tables.
    I need some guidance about what is possible and how to do it.
    My preferred approach if possible is to load the data directly from OS and populate the target tables without loading into the database previously.
    Thanks for the help.
    Tech Info:
    OS : Unix / Windows
    DB Version: 11.2 or 11.1
    JF

    forum has many examples
    use search
    as example see
    Re: Load xml data in Oracle table
    Re: Load an XML file into table(s)
    Re: load a file

  • How to receive data from my broken iMac?

    My iMac G5 broke down for good recently. An electric spike burned it down. Now its power supply and possibly even logic board are broken (it won't even make a beep, no life what so ever). Is it still possible to obtain the data that's stored on its hard drive? If it is possible, how do i do this, or do I have to take it to a service shop.. which by the way is terribly expensive here where i live. I'm not planning to repair my iMac due to huge costs. It's an old mac and not worth all that trouble. The data inside though is important. Thanks a lot!

    Do as Jan suggested, put it in another external Firewire enclosure, then connect it to a working Mac and you should be able to see the data. If not, then the drive was fried at the same time the rest of the computer was.

  • How to receive data from an external application

    In one of our requirements we would have to make use of the resume/suspend plug in Web Dynpro Abap. Would anyone happen to have any other information on this topic. Is there a sample program available which demonstrates the same?
    The requirement is that, I have to call an external window (output screen) from my present screen (input screen). While this external window is active, the calling window (input screen) should be disabled. When the external window (output screen) is closed the input screen should be enabled again. The external window returns a parameter list and this needs to be received by my application. I have read that suspend/resume plugs can be used for this. However, I have not been able to figure out how to use them.
    Additionally, is there any other approach for achieving the above functionality.

    Hello Hari,
    Refer these links for understanding the usage of suspend/resume plugs.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/68/3aee42c4257176e10000000a1550b0/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/68/3aee42c4257176e10000000a1550b0/frameset.htm
    Bala

  • How to receive date type of oracle in webdynpro?

    Hi
    Experts
       I am trying to receive a date from a table.
       but getting error.
    <b><i>java.sql.SQLException: ORA-00904: "TODATE": invalid identifier </i></b>
      code is given below.
    try
         Statement stmt=wdContext.currentContextElement().getStmt();
         ResultSet rs=stmt.executeQuery("select boss_comment,emp_comment,city,empname,designation,fromdate,todate,no_of_persons from grequest r,g_temp e where status='n' and r.empid=e.empid "); // select statment
         wdComponentAPI.getMessageManager().reportException("After Rs execution",false);
         while(rs.next())
              IPrivateRequestTable.IRequestElement req=wdContext.createRequestElement();
              req.setBossComment(rs.getString("boss_comment"));
              req.setEmpComment(rs.getString("emp_comment"));
              req.setCity(rs.getString("city"));
              req.setEmployee(rs.getString("empname"));
              req.setDesignation(rs.getString("Designation"));
              req.setFromDate(rs.getDate("FromDate"));
              req.setToDate(rs.getDate("ToDate"));
              req.setNoOfPersons(rs.getInt("no_of_persons"));
              wdContext.nodeRequest().addElement(req);
         catch(Exception ex)
         wdComponentAPI.getMessageManager().reportException(ex.toString(),false);
         System.out.println("Error");
    Please Reply.....

    Hi,
    TODATE is a keyword in Oracle. Pl try to avoid the usage of any keywords as column names.
    Regards
    Ayyapparaj

  • How to receive the datas?

    Look:
    the first I create socket sk:
    sk=socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
    and I fill data into Ip Head and Icmp Head,
    then I sendto the packet,but I don't receive
    any datas:
    lenrecv=recvfrom(sk,buf,100,0,(struct sockaddr*)&addr,&rlen);
    my codes run at the function recvfrom,but it
    couldn't return variable lenrecv,and it look like down,
    I want to know why?how to receive the data?
    (I couldn't creat socket like this:
    sk=socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
    I want to know when I creat socket like this
    sk=socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
    How to receive datas?)

    Last edited by joseperezc (2012-08-14 18:58:22)

  • XML import issues in CS5.5, but not CS5...

    Hi guys,
    I'm currently using the Production Premium CS5.5, and have been trying to import an XML from Final Cut Pro 7 into Premiere.  The issue is that none of my audio tracks appear in the sequence, nor any video tracks aside from my 2 main tracks.
    This isn't a problem in the previous version (CS5), as I can import the same XML and all my audio tracks, etc. show up in the sequence.
    Since I just started playing with CS5.5, I'm wondering if there's something I don't have set up properly?  Is there a conflict w/ having CS5 and 5.5 installed?  Has anyone else encountered a similar issue?
    Thanks for the response, if you got it.  I really really appreciate it. 

    So, I started figuring out what the issue is, but not how to fix it:
    I had some overlay graphics (Quicktimes w/ Alphas) that were placed over my main video track, which I suppose Premiere doesn't like.
    The thing I can't figure out, is why I could still bring in the rest of the project with CS5, but not CS5.5.....

  • How to write data to an XML file present under application server

    frnds: can ne one tell me, how to write data in to a file, which is present under a application server
    Ex: i want to write a string data in to a file test.txt which is present under "http://localhost:8080/<some_webapp>/test.txt"
    Note:i have deploted a service<some_webapp> under Tomcat/webapps dir

    Very simple. A servlet can writes to that file if it has the good rights.
    In the servlet get (or post) method, use a code like this:
    import java.io.*;
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
    try {
    String filePath = this.getServletContext().getRealPath("/text.txt");//See http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/ServletContext.html#getRealPath(java.lang.String)
             PrintWriter writer = new PrintWriter (filePath);
            //or BufferedWriter out = new BufferedWriter(new FileWriter(filePath));
            writer .println("aString");
           writer.flush();
            writer .close();
        } catch (Exception e) {
           e.printStackTrace();
    }Hope That Helps

  • How to Place a file on application server in XML format

    Hi,
    Our requirement is to place  a file from SAP to a folder on  application server in XML and vice-versa.
    please suggest.
    Thanks
    Narendra

    Hi,
    1. convert your internal table data to XML format using function module SAP_CONVERT_TO_XML_FORMAT.
    2. Convert the XML data into Xstring format using Function module SCMS_BINARY_TO_XSTRING. pass the file size got from the step 1 in importing parameter.
    3. loop on the internal table got from the step 2 and use OPEN DATASET, TRANSFER AND CLOSE DATASET

  • I cannot reactivate my e-reader with my existing Adobe ID and password which are both correct. I alwayss get the message "activation server error, Code: E_AUTH_NOT_READY" What kind of problem is this and what is most important, how can I solve it quickly.

    I cannot reactivate my e-reader with my existing Adobe ID and password which are both correct. I alwayss get the message "activation server error, Code: E_AUTH_NOT_READY" What kind of problem is this and what is most important, how can I solve it quickly. I am on holiday and want to read. Thanks for speedy reply.

    Yes, actually I talk about Digital editions. Do you know how to solve the problem as described in my first mail for Digital Editions? Thanks for your  kind assistance.

  • How to transfer internal table data to Applicatiion Server in XML fromat.

    how to transfer internal table data to Applicatiion Server in XML fromat.

    Hi if u want to transfer from to application server using xml in
    do like this,
    v_xml_table is u r internal table,
    and define li_xml_table as line of u r internal table
    OPEN DATASET g_file FOR OUTPUT IN BINARY  MODE .
        LOOP AT v_xml_table INTO  li_xml_table.
          TRANSFER li_xml_table TO g_file .
        ENDLOOP.
        CLOSE DATASET g_file.
      ENDIF.
    <removed_by_moderator>
    Regards,
    Prasad.
    Edited by: Julius Bussche on Jul 16, 2008 2:43 PM

  • How can we transfer huge amount of data from database server to xml format

    hi guru
    how can we transfer huge amount of data from database server to xml format.
    regards
    subhasis.

    Create ABAP coding
    At first we create the internal table TYPES and DATA definition, we want to fill with the XML data. I have declared the table "it_airplus" like the structure from XML file definition for a better overview, because it is a long XML Definition (see the XSD file in the sample ZIP container by airplus.com)
    *the declaration
    TYPES: BEGIN OF t_sum_vat_sum,
              a_rate(5),
              net_value(15),
              vat_value(15),
             END OF t_sum_vat_sum.
    TYPES: BEGIN OF t_sum_total_sale,
            a_currency(3),
            net_total(15),
            vat_total(15),
            vat_sum TYPE REF TO t_sum_vat_sum,
           END OF t_sum_total_sale.
    TYPES: BEGIN OF t_sum_total_bill,
            net_total(15),
            vat_total(15),
            vat_sum TYPE t_sum_vat_sum,
            add_ins_val(15),
            total_bill_amount(15),
           END OF t_sum_total_bill.TYPES: BEGIN OF t_ap_summary,
            a_num_inv_det(5),
            total_sale_values TYPE t_sum_total_sale,
            total_bill_values TYPE t_sum_total_bill,
           END OF t_ap_summary.TYPES: BEGIN OF t_ap,
            head    TYPE t_ap_head,
            details TYPE t_ap_details,
            summary TYPE t_ap_summary,
           END OF t_ap.DATA: it_airplus TYPE STANDARD TABLE OF t_ap
    *call the transformation
    CALL TRANSFORMATION ZFI_AIRPLUS
         SOURCE xml l_xml_x1
         RESULT xml_output = it_airplus
         .see the complete report: Read data from XML file via XSLT program
    Create XSLT program
    There are two options to create a XSLT program:
    Tcode: SE80 -> create/choose packet -> right click on it | Create -> Others -> XSL Transformation
    Tcode: XSLT_TOOL
    For a quick overview you can watch at the SXSLTDEMO* programs.
    In this example we already use the three XSLT options explained later.
    As you can see we define a XSL and ASX (ABAP) tags to handle the ABAP and XML variables/tags. After "

  • How to delete empty tags after xml-import

    Hello collegues,
    I'm totally new in this forum so excuse me if I make a mistake, but I've a little question.
    I've imported text and images with a xml-import but sometimes empty tags (the colored invisible blocks) are in my text, with the result that I can't Find/Change on double-returns.
    Does anybody know an awnser to this matter? I would love to write an apple-script that will find/change this so i don't have to look after all my pages.
    Thank you very much in advance.

    ThePictureCreator wrote:
    ...I can't Find/Change on double-returns.
    What's your search query? I think you should be able to, with either a grep find of "\r+" or a normal text find of "^p^p". InDesign pretends like the tag-holding characters aren't there for the purpose of search. But you will lose the empty elements along with the extra returns. Maybe that is the problem?
    Jeff

  • FCP XML Import on Premiere CS4.0.1 Windows

    Great work on implementing FCP XML import on CS4.0.1. <br /><br />We have all our media mounted on a network share. On the Mac exporting a sequence from FCP and then importing into Premiere on the Mac works no problems. On Windows this is a problem, Premiere prompts for each of the media items, which is pretty painful to re-link again. <br /><br />Looking at the FCP XML this appears to be down to the <pathurl> area of the XML. These are typically file://server/Volumes..... etc... which doesn't translate to any of the file mountings on Windows, which are D: E: F: etc... mounted drives. Is there any way to help us? We can write a script to manually modify the XML. Can you explain how Premiere Windows likes to read these Mac URLs?

    Thank you all for your help. It still leaves a bit of a workflow problem. <br /><br />Basically we have some people ingesting / organizing content and maintaining on a network share. Duplicating the media is slow and moving it all into one volume is not too good either as it breaks all the relationships for others. Re-linking is good, but doesn't work if the material is spread across subdirectories and giving a key to link all the media together looses some of the benefit of having the export from FCP in the first place, it's just as easy to re-make the edit.<br /><br />We are only using cut edits, so this is quite simple. For users on the Mac using FCP and handing off to Premier it works fine, the problem is we want to hand off to Windows Premier. It's ok to run a script over the files to change the XML naming of the <pathurl> which seems to be causing the problem, but how to describe this in the Windows world?<br /><br />Thanks for all the help.... anyone from Adobe with any ideas?<br /><br />The problem as I see it is how to identify Mac OS mounts to a Windows version of Premier on XML import.

Maybe you are looking for

  • Cannot install CS3 on my new computer

    hi, i cannot install CS3 on my new computer due to the fact that i did not deactivate is on my old laptop. to which i dont have acces any more.. can anyone help finding a solution?

  • Failed Acrobat Pro 9 5x, including "serial" fix download

    Windows Vista SP2 32 Bit. Adobe Acrobat 9 Pro Student License version Hi, I purchased Adobe Acrobat 9 Pro (student license) a week or so back and have been unable to install. I installed, uninstalled, and installed / uninstalled TWO times. I then fou

  • Encode Failed message during transcode attempts

    Hey guys, I've got a 45 minute video shot at 1920x1080i on a Everio GZ-HD7-B camera that's due for a review in only a couple of days. I've got the project to a near-final draft in Adobe Premiere Pro CS4, and have been working on authoring a DVD in Ad

  • Secure OSB Service with LDAP

    Hi Friends, Greetings! Is there a way to secure an OSB service so that user will be able to access it only if they pass their AD/LDAP userid and password? Note: I know I can add servie accounts. However I want to avoid adding a guge number of users/s

  • I Clicked Icon On Desktop But Will Not Open Firefox!! 4.0

    I Have Uninstalled And Installed 4.0 Several Times But Will Not Do Anything When I Click Icon In Desk Top!