Path relative and methods XML

Hi, I am learning to integrate xml with JSX, I read the document "JavaScript Tools Guide CS6" breast to help him expand the menu Tool Kit, and I use one example of another thread here the community is already working... But I'm still, two questions are:

-Currently, use an absolute path (line 2 below) to search for the file on the desktop. However, I need the path relative to search for the folder the script is (my xml file will be as well as the script and not the office...)

-Online # 12 has received:

leader. Open ('r', 'TEXT', '? ');

What are these three arguments, 'r', 'TEXT' and '? ' the open() method? I have not find documentation on the open(), read() and close() methods, know where I can find?

If anyone can help me I would be very grateful, thank you. Here is my code.

//
var file = new File("~/Desktop/bookstore.xml");
readXMLFile(file);
//
function readXMLFile(file) {
        if (!file.exists) {
                throw "Dont find: " + deodeURI(file.absoluteURI);
        }
        file.encoding = "UTF8";
        file.lineFeed = "unix";
        //
        file.open("r", "TEXT", "????");
        var bookXmlStr = file.read();
        file.close();
        return bookstoreXML = new XML(bookXmlStr);
};
//
writeXMLFile(file,bookstoreXML)
//
function writeXMLFile(file, xml) {
        if (!(xml instanceof XML)) {
                throw "Bad XML parameter";
        }
        file.encoding = "UTF8";
        file.open("w", "TEXT", "????");
        // unicode signature, this is UTF16 but will convert to UTF8 "EF BB BF"
        file.write("\uFEFF");
        file.lineFeed = "unix";
        file.write(xml.toXMLString());
        file.close();
};
//

You can get the current script to help file

Folder (File($.fileName).parent) .fullName

or

Folder (app.activeScript.parent) .fullName

I think that may not work when launching a script in the Scripts panel. I always use the former because I don't run my scripts in this way, and I've never had problems.

With regard to file.open, if you use ExtendScript Toolkit you can read about it by opening the object model viewer and selecting Classes the core of JavaScript in the browser. Open takes three arguments. The first is the mode (read, write, modify, add), the second and third are Mac only values that describe type and Creator.

If you do not use the Toolbox, you can read about the core JavaScript stuff that implements ExtendScript here: Adobe InDesign CS6 (8,0) object model JS: Table of contents, some Classes of basic JavaScript (there are other versions for other versions of the object model if you need something different).

Tags: InDesign

Similar Questions

  • Paths related to the links in Adobe Muse

    Is it possible to create paths relating to objects placed outside the Assets folder in Adobe Muse?

    Thank you!

    If you are wondering if there is a way to have the Muse to transfer a file to one location other than the current folder and offer a choice of link for it in the drop-down list of hyperlinks, the answer is no.

    If you're wondering how to create a relative link, you can simply it enter into the editing area of hyperlinks (for example type "mystuff/theassetfile.doc"), but it is up to you to download the file "assetfile.doc" in a folder 'mystuff' at the root of your site using a FTP software.

  • Path relative to the parent document is ignored by the server web - classic ASP, the include files.

    About 5 years ago I started what was to be my last site ASP/VBScript/Windows. I obtained through the administration of the database with MS Access ADP files, the DW server behaviors and some third-party extensions. GoDaddy recently told us they were retiring the old hosting and database servers and migrate to new Windows with Plesk accounts. The database has now been MSSQL 12 and using a file ADP was released. So, I took a course accelerated in SQL Server Management Studio to migrate the database. If anyone needs help with SSMS let me know, but it's not where my problems are.

    I see two troublesome problems on this new hosting server.

    1. pages with an include file, include it where is a level or above of the page does not work. A specific example - there is a page in a folder that contains a Recordset. It refers to the connections in the site root folder, using the "... / connections / ' relative path of the document. I checked this by copying the folder connections at the same level, and by changing the include as a result path.

    2. everything I had was the internal server error, even if I use a web configuration file to display detailed error messages.

    3. in the server behaviors panel, the recordset does not appear as such - it shows as a command and therefore not launch the Recordset Wizard

    4. I removed the connection and scripts and then Redid the connection. He have not successfully tests unless I chose to use the local driver. I've never had to do before.

    5. I always use the remote server as the test server, but DW doesn't seem to see it. This new account has a web root of httpdocs, but which should not be part of the URL test serer. For now, I use a subdomain to access the site.

    Questions: Someone has all heard a server ignoring the "... / ' in a path relative to the document, Windows or other? This occurs only with files include ASP - CSS @import links seem to work well.

    All of this have to do with the use of a subdomain?

    Why don't my recordsets appear in the Panel of SB? (Too bad the WebAssist Extensions - they used to work, but are totally broken now.) (I don't use anyway - CC compatible versions, but they tend to work most of the time)

    Last question - is it possible to get an earlier version of the CC DW? I'm sure that my problems are both because of the current version as well as the new server platform and configuration.

    Log-in to Creative Cloud Desktop app and select filters & releases > previous Version.

    You should see CS6 in the drop-down list.  See screenshot.

    Your new server using classic ASP or ASP.net?  They are different.

    Includes: equivalent ASP.NET Server - Stack Overflow

    Nancy O.

  • learning SQL and pssql, xml, forms and report

    I learned sql and plsql I donot Xml and forms and reports learn by own by easy method

    by sql and psql we learned basic on the rise, things of time ranging from online book (another way to practice and understand the concepts)

    repo, xml, sql, forms and pssql of learning javascript:; rt learning SQL and pssql, xml, forms and reportfor beginners

  • Tried to reinstall XP on my laptop after installation of windows 7 and xp disks had missing files: cmnicfg.xml, ipcfgxml, osinfo.xml, potscfg.xml and pppcfg.xml. What should I do now?

    I installed Windows 7 on my laptop and it terribly slow. I used the XP disc and tried to reinstall it. Came in halfway through the messages that he was missing the following files: cmnicfg.xm, ipcfg.xml, osinfo.xml, potscfg.xml and pppcfg.xml. Now, it does nothing. Help!

    Hi SharonPittman,

    (a) you suggest to clean the Windows XP installation CD with a piece of cloth & then try to install windows XP.

    For more information, see these links.

    How to install or upgrade to Windows XP

    Reference: Install, reinstall, or uninstall Windows

    (b) if the problem persists, there is possibility that the Windows XP CD is damaged.

    I recommend buying a Microsoft Store installation disc.

    You can contact Microsoft Store at the link given below.

    http://www.microsoftstore.com/store/msstore/cat/CategoryID.37286600

    Hope the helps of information.
    Please post back and we do know.

  • list - restrictive entry visibility and external xml file in the drop-down list

    The question applies to the OPA 10.1, but if a solution requires a version more recent OPA (e.g., 12.1) we can update so please let me know what version your answer applies to.

    I have a series of tabs of a spreadsheet Excel that map different categories on each other and I want to implement this OPA so that there are six screens with drop-down lists and visible elements two on-screen menu will depend on the selected item in the display 1. list to display 3 items will depend on the selected item in the screen 2, which depends on the item selected on the screen 1, etc..

    For example,.

    1 screen can be States:

    Maryland

    Virginia

    New York City

    Georgia

    ...

    2 screen could then be counties: assuming that Virginia has been selected...

    Accomack

    Albemarle

    Alleghany

    ...

    3 screen could be cities: assuming that Accomack is selected...

    Exmore

    Parksley

    ...

    Basically I have large spreadsheet list of lists with items (one list a 2040 pieces) and so I can't manually enter easily list items.  I would like to 'specify the name of the list' and have the OPA to use an xml list (easily created my spreadsheet), but the OPA Help menu says "NOTE: this implementation of the xml list does not support default values or visibility...» "So it seems that I won't be able to make invisible inapplicable list items.  So, to use the fictitious example above, if I chose the State of Maryland, I will not applicable to Virginia or any other State counties, but Maryland is visible; Yet, all counties in the country should be included in the list in the first place.

    If someone knows a solution or another solution to this problem (other than creating custom functions) so please let me know.

    "Out of the box' for 10.1 you can try the following:

    Have simply a separate list for each of the sub-components. He can do even a little painful, but you have not at least custom functions or custom controls.

    On the first screen you have the attribute collection the State using the list of States (provided via xml).

    On the second screen you have the County collection attribute - but repeated 50 times - and then use visibility to show/hide the template you want (which then has the correct xml for the counties in the State).

    On the third screen you have your attribute for the city (once again the same attribute for each list) but isn't there it gets a little mean to 50 times counties in the State.

    In terms of writing that required visibility rules that you can probably leverage Excel to do much of the building of the rule for you to lists (remembering that the compiler takes that you as the user see in Excel, not the function that sees Excel)- so there is not a lot of extra work in the perspective of rules.

    The sticking point will simply put all of these attributes and binds the attribute visibility for the right control (and right xml).

    Proceed with caution (extreme!), but... If you're already Automation to create the XML lists from Excel, then you might want to automate the creation of xml screen. But be very careful. I've seen some projects that have used automatically generated screens and they did the job of the ok - but certainly a warning any time major health you do not use OPM to generate a component of OPM.

    Then... it is possible to do it manually - but you probably want to get involved some automation.

  • Migration of OAF - Pages and regions - xml files

    Hi all

    Can someone explain to me the answer to the following questions

    (1) why tradition expanded Page and the files of the region should not exist under $JAVA_TOP?

    (2) why page Standard and region files exist under respective $XXXX_TOPs/SDM... of the directory

    As the definition of page files are not used when running and are only for reference and the backup object, we can follow any structure of directory for storing these files.

    However, other files such as AMImpl, the controller class and VO.xml must be there to $JAVA_TOP...

  • Can a Xquery return a concatenated string and an XML element

    Hello

    My Xquery fucntion is illustrated below:

    It accepts parameters of Channel 4 and a XML element i.e., $Message which is a component of XML (application to come to the service) and I need to connect all this information in a log file.

    I use the below fucntion concat to get a concatenated string of all parameters, but for $Message I m not able to get the XML load. How to achieve the same in the XQuery?

    *$Message is the below XML file:*

    payload of <>
    < aa > a < /aa >
    < bb > two < /bb >
    < cc > 3 < /cc >
    < / payload >

    My Xquery function is:

    declare function xf:XformLog($Name_as_xs:string,)
    $id as XS: String.
    $Context as XS: String.
    $Annotation as XS: String.
    $Message as element (*))
    as XS: String {}
    Concat ("name = ', $Name, ','," Id = ", $id,", ","Message = ", $Context,","context", Annotation = ", $Annotation,","," event Message = ', data ($Message/@*, $Message / node ()) "" "")
    };


    I am trying to achieve the following log:

    Name = xyz, Id = 111, Message Contact is abc, Annotation = ggg, the event Message = < payload >
    < aa > a < /aa >
    < bb > two < /bb >
    < cc > 3 < /cc >
    < / payload >


    How can I achieve the same. Please suggest.

    Thanks in advance.

    Published by: user9223904 on March 18, 2013 03:16

    Hello

    You must use a serialization function to convert a string of the instance of the element.
    This type of functionality is not included in the XQuery standard, but many directors provide an extension to do this.

    For example, in OSB, you can use fn - bea: serialize().

    What is your environment and XQuery engine?

  • How to Append and update XML in flex

    I need help... I am developing a desktop using Flex and Air application.

    I would like to add and update the xml code by using this application. How can I add and update XML data?

    If the user gives input is recorded in an XML file. can someone tell me how to do this?


    Thanks in advance,

    Verhasselt

    You may need to set some variables outside the functions so that they are "global".

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

  • StageWebView and paths related CBC

    Hello

    How can I get it works please on an iOS device:

    stageWebView=new StageWebView();
    stageWebView.stage=this.stage;
    stageWebView.viewPort=new Rectangle(0,0,800,600);
    stageWebView.loadString('<img src="images/some_image.gif"/>');
    

    If I use an absolute as path: http://mysite.com/images/some_image.gif , it loads the image.

    I want to have them stored locally.

    Thank you.

    Hello

    I can't test on the device, but here:

    http://help.Adobe.com/en_US/AS3/dev/WS901d38e593cd1bac3ef1d28412ac57b094b-8000.html#WS901d 38e593cd1bac-5a0b8b512ac674f48f-8000

    in the section "Content", which is explicitly stated that if the html string is loaded via the loadString method it cannot load local content (this could lead to exploit otherwise: user provides a few links Tags which realized the extraction contents of sandbox application - fixed (static) page so it had to be used to load local content) ", I think),

    Kind regards

    Peter

  • Transformation to define the schema and user on Tables in relational and physical

    I imported my Designer SDDM 4.0.1.836 deposit.  Now, I want to APP_SYS of subviews allows to define the schema on the tables in the relational model and the user on the physical model.  Our application in designer systems are 90% based scheme.  Here's what I have so far based on the example of OE and HR plans that I imported, built logical, then back to relational.  At this point, I have the tables by subview...  Line 24 is obviously incorrect.  Can someone give me a step by step approach to understand what I need to set the schema of the table and the user?  I looked through the read me file, xml files, the index and searched the known universe and am still confused.

    importPackage(javax.swing);
    // variable to keep a status message for later
    
    var message="";
    var schema="";
    
    // Get all subviews for Relational
        subviews = model.getListOfSubviews().toArray();
    for (var isub = 0; isub<subviews.length;isub++){
        subview = subviews[isub];
        message = message + '\n'+isub+" "+ subviews[isub];
        if(subviews[isub]!=null){
              if(subview == "HR_ERD"){
                 shema = "HR";
                }else if(subview == "OE_ERD"){
                 schema = "OE";
                }
             tables = model.getTableSet().toArray();
             for (var t = 0; t<tables.length;t++){
                 table = tables[t];
                 //check for presentation in subview
                 tv = table.getFirstViewForDPV(subviews[isub]);
                 if(tv!=null){
                     table.setSchemaObject(schema);  
                      message = message + '\n    '+ t +" " +shema+"."+ tables[t] ;
                }
            }
        }
    }  
    
    JOptionPane.showMessageDialog(null, message);
    //Packages.oracle.dbtools.crest.swingui.ApplicationView.log(message);
    

    Hi Marcus,

    First of all, you must make sure that the schema already exists in your relational model.

    You can use the method

    public void setSchema (String schemaName)

    to associate your Table with this scheme.

    (This method is defined on ObjetConteneur, so it can also be used to make and index).

    If you already have a user of your physical model that implements your schema, it is not normally necessary to create a user on the TableProxyOracle in the physical model.

    However if you do not want to set, then the method to use is

    public void setUser (user UserOracle)

    David

  • Error 80004005 code update to Vista (KB972036) and Microsoft XML Core Services 4.0 Service Pack 2 (KB973688) 643 error code.

    The first update (KB972036):

    During the restart process, after the message "do not turn off your computer", the following message (Please note that I use the Slovak version of Windows Vista, so I tried to translate the message to my knowledge):

    "Update has not been configured correctly, cancelling the changes.

    I tried to install it manually, I downloaded "Windows6. 0-KB972036-v2-x 86.msu", but the result is exactly the same.

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

    The other (KB973688) update:

    When installing it via windows update, there seems to be no problem, but it is not settled.

    So I checked c:\windows\system32\msxml4.dll and he says it's MS XML 4.0 SP2, version 4.20.9876.0

    I tried to install it manually as well, I downloaded "msxml4-KB973688 - enu.exe", but when I try to install, it comes up with the error message (screenshot below).

    http://img20.imageshack.us/img20/3381/msxml4error.jpg

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

    Here's what I'm running:

    Windows Vista Edition Home Premium SP2 32-bit

    I'm just having trouble installing these two updates, everything else is pretty much installs ok, but whenever I update via windows update, I have to leave out both for the aforementioned reasons.

    I created my updates so that the system warns me of new updates are available, but I decide to download them and install them.

    I tried to change this setting to a State, where Windows automatically downloads and installs the updates by itself, but there was no difference and these two updates are always a pain in my virtual neck.

    Help, please! Thank you

    Hi ozziebabyxxx,


    Check the following services and ensure that they are running.
    1. Click Start , Type "services" in the search box
     
    Background Intelligent Transfer Service
    Cryptographic services
    Windows Update
     
     
    error code 643

    Follow the methods below to solve the problem:
     
    Method 1:
     
    This problem occurs when Windows Setup encounters an error. Error code 0 x 643 is provided by Windows Installer. These error codes are generic errors that basically indicate that an error has been detected by the Windows Installer.
     
    Check out the link for more details below:
     
    You receive error code 80070643 0 x or 0 x 643, code error when you use the Windows Update or Microsoft Update Web sites to install updates
     
    Method 2:
     
    Microsoft has released a new "Fix it" solution that should automatically solve your problems with Windows Update. Click on the link below and follow the instructions.
     
    How to reset the Windows Update components?
     
     
    Method 3:
     
    Follow the instructions in the link below to rename software c:\windows\system32\catroot and distribution records and try to install the service pack.
     
    You cannot install some programs or updates

    After you perform the methods stated above, you can download the standalone package for Microsoft XML Core Services 4.0 Service Pack 2 (KB973688) from the link below.
     
     

    Aziz Nadeem - Microsoft Support
  • Submit form HTML5 Java JSP and get XML of InputStream ask

    I have developed a complex program to submit PDF/XFA program ASP.NET server side.

    I now need to do the same thing using Java-side server program.

    The I'm following way is to break the long and complex form into smaller sections. Each section will be a separate XDP form to the HTML5 format, and it will have the following common buttons:

    -Next

    -Previous

    -Section break

    -Save

    -Complete

    I am looking for a simple example to explain how to submit a HTML5 form to a server-side Java (JSP or Servlet) program and how to retrieve the submitted XML or form fields and values.

    I made a few efforts, but still need help. Please download the base HTML5 XDP form from here. See the pictures below for more details. The code at present is under the 'Save' button, click event:

        var theBtnSubmit = cmdSubmitForm.resolveNode("#event").submit;
        var theTarget = form_config.server_url.rawValue + "?" + "action=save" + "&form_id=" + form_config.form_id.rawValue + "&section_id=" + form_config.section_id.rawValue;
        theBtnSubmit.target = theTarget;
        cmdSubmitForm.execEvent("click");
    

    The JSP is very simple. You can download here. I used the following lines of code to get the InputStream and convert to a string:

    ServletInputStream ris = request.getInputStream();
    String theString = IOUtils.toString(ris); 
    

    I developed a simple program to Java using JSP in a dynamic Web project.

    The problem:

    On the server, I am unable to retrieve form fields and values in XML format. What I get is the concatenated values of the fields which are filled.

    Tarek

    The submit button hidden' cmdSubmitForm:

    Finally, it worked. In fact, the above method works very well. The only problem was that the string must be escaped for XML.

    I add the following code, and I can now see the XML file:

    <%@page import="org.apache.commons.lang3.StringEscapeUtils" %>
    ...
    String theString = IOUtils.toString(ris, Charset.forName("UTF-8"));
    theString = StringEscapeUtils.escapeXml10(theString);
    out.print("input stream in string format : " + theString + "
    ");

    Tarek

  • Load and read XML file size more than 4 GB

    Hi all

    My environment is Oracle 10.2.0.4 on Solaris and I process to work with the XML file as below the detail of PL/SQL

    1. I read the XML file on the HTTP port in the XMLTYPE column to table.

    2. I read value n ° 1 of the table and extract of y to insert another table

    On test db, everything is working but I got below error when I use the XML production

    ORA-31186: Document contains too many nodes

    Current XML size about 100 MB, but the procedure must take over the size of XML file over 4 GB in the future.

    Below are some of my code for your info.

    1. reading XML by line in variable and inserting into table

    LOOP
    Utl_http.READ_TEXT (http_resp, v_resptext, 32767);
    DBMS_LOB. WriteAppend (v_clob, LENGTH (v_resptext), v_resptext);

    END LOOP;

    INSERT INTO XMLTAB VALUES (XMLTYPE (v_clob));

    2. read the value of the cell in the XML column and extract to insert into another table

    DECLARE
    CURSOR c_xml IS
    (SELECT trim (y.cvalue)
    FROM XMLTAB xt.
    XMLTable ('/ Table, rows, cells, cell ' PASSAGE xt.) XMLDoc
    COLUMNS
    cvalueVARCHAR (50)PATH ' / ');

    :

    :

    BEGIN

    :

    :

    OPEN c_xml;
    SEEK c_xml INTO v_TempValue;
    < generate the insert statement in another table >
    OUTPUT WHEN c_xml % NOTFOUND;
    NARROW C_xml;

    :

    END

    And another problem is performance problem when the XML file is great, first step to XML content loading to XMLTYPE column slowly.

    Could you please suggest any solution to read large XML file and improve performance?

    Thank you in advance.

    Hiko

    Finally, change us source file to XML, CSV format and instead load the XML using SQL Loader.

  • construction method and method of selection of the face under the router tool are not active

    Dear professional Illustrator,

    Anyone know how to activate the mode of construction and the method of selection of the face under the shaper tool?

    work environment:

    my system is Windows 7 Professional

    Illustrator CC

    I tried to search for the related topic, but I couldn't find an answer, thanks for your advice.

    Masako

    Masako Ku,

    You can read about them here:

    Illustrator help | New forms of building with Shaper tools and a generator of form

Maybe you are looking for

  • I dropped my iPhone 5 c now it has different colored vertical lines

    I dropped it once and the screen cracked, then I dropped it a second time now, the screen is different colored vertical lines this will be under "other repairs" or "screen fix" Please help asap thank you! I can touch the screen and open something, bu

  • Skype crashes on startup

    When I start Skype, I can log in and everything, but it crashes immediately when the main window appears. I run dxdiag and it hangs on DirectShow (step 1).I tried to update my drivers, but they are up to date. Here is my dxdiag file. Can anyone help?

  • Re: Graphics obsolete driver for Satellite C660 - 11K

    The current driver available on the main site is severely outdated, and I now have two programs that crash at the start because of problems with the driver aticfx32.dll library. This is a known issue with some drivers from intel and was set with thos

  • Chess Titans Problems

    Remember - this is a public forum so never post private information such as numbers of mail or telephone

  • How to find the different languages of an indd Document?

    Dear friends,I use multi-language books. How to find the language in the following list (just I want find option only).English: UKGerman: The old rulesIt is possible to find/replace option. Please suggest a friendThanks in advance