JS - Can XML Question - I add attributes using Javascript?

I want to add an attribute to an element tag, but I don't see how to do it programmatically. Is this possible? Also, is it possible to appoint a tag element dynamically? For example:

How to add a child element is to use the appendChild as follows:

XMLObject.appendChild(<childElement/>);
XMLObject.childElement= "something";

or just add it like this:

XMLObject.childElement = "something";

Right? (Side Question: is there a difference between these two methods?).

What I want to do, is to add a dynamic attribute to a child named statically, or to create a child named dynamically.

I could not understand this. Any ideas?

Maybe take a look at Mozilla's E4X tutorial: https://developer.mozilla.org/en/E4X_Tutorial/

There is no need eval() here. (There are usually not.) Use:

XMLObject.appendChild(<{nameReference}/>);

To add an attribute, you can use:

XMLObject.@new_att = "the value";

Jeff

Tags: InDesign

Similar Questions

  • How we can filter the members of attributes using MDX ASO

    How can we filter the members of attributes using MDX ASO?

    SELECT {Descendants ([1_Account], LEVELS([1_Account],0))}

    ON COLUMNS,

    {Filter (different 1_Cost [Online], 1_Cost [Online]. CurrentMember = [1_AllocAccountR]. [85151010])} on the LINES

    OF Alloc1R.Alloc1R

    WHERE ([DC], [GenealogyAllocation], [Bill], [FY14],

    2_Cost [Online]. [Impact], [3_Cost online]. [Impact], [4_Cost online]. [Impact], [5_Cost Center_intra]. [Impact], [2_Project]. [Impact], [1_Project]. [Impact]

    )

    The code marked in yellow, is suppose to filter and to provide an output only the cost that has 85151010 attribute tag - Center but it generates all cost centers


    Thank you

    Vishal

    How about using attribute or WithAttr

    Concerning

    Celvin Kattookaran

  • Can you create Destinations named by using JavaScript?

    I am creating a menu option in Adobe Acrobat that uses JavaScript to parse through a large pdf document and create named destinations by using the titles in the document.

    The titles all follow the same format unique, so I am able to identify them using regex. Once I found a title, I identify also the page it's on--and I store several times the title and the page in a table.

    My plan was to create named destinations using the information stored in the array. However, I did have a lot of chance to find how to create destinations named with JavaScript.

    Any input would be appreciated.

    Not possible with Acrobat Javascript.

  • Can I still sync/add devices using FireFox 30 (including iCHOOSE to use...) and, if so, how/where can I do so (because by clicking 'Sync' @toolbar does NOTHING)?

    Hey guys, can I still add/sync the devices by using FireFox 30 (including iCHOOSE to use...) and, if so, how/where can I do so (because by clicking the sub-title of the menu "Synchronize" FireFox both the toolbar of the browser "icon to sync" icon NOTHING [other that cause the icon toolbar synchronization annoyingly turn for a fraction of a second before you do anything else...])?

    Wow - my computer's clock is very well so I was personally puzzled by the sudden 2033 journal dates too but yes, I will simply record punctually (speaking of that thanks for your) and export my bookmarks to Safari so that iCan go via my iPhone - Bye mozilla. @P_C_T

  • Can I still sync/add devices using FireFox 30 and, if so, how/where?

    Can I still add/sync devices using FireFox 30 and, if so, how/where can I do then?

    Everything is fine on my end, but FireFox issues I discovered leave me no other choice than to save on time (speaking of that thanks for your) and place you in Safari so that iCan access Favorites via my iPhone - Bye mozilla. @P_C_T

  • Question of dynamic title using javascript


    http://apex.Oracle.com/pls/apex/f?p=20866:1 workspace: SVK user: demo password: demo

    I'm trying to update the title of the region whenever the selection list changes. The title of region should start by empno of the employee in the query (i.e. ' 7900 TEST REPORT NAME').

    I use js:
    $("#dynreg div.rc-title").text("&P1_SELECT_LIST. TEST REPORT NAME");
    where http://www.ESRI.ie/research/research_areas/international_economics/dynreg is the static id for my region. This works sometimes, but then stops or not at all.

    Hello

    I have change your dynamic action and place points of region attribute of report Page elements.
    I think that your sample now works

    Kind regards
    Jari
    -----
    My Blog: http://dbswh.webhop.net/dbswh/f?p=BLOG:HOME:0
    Twitter: http://www.twitter.com/jariolai

  • Scripting inDesign: How can I move an element placed using Javascript?

    Hey all,.

    I tried to write a script that puts an object slug from an indesign library to a document and then put in my area of slug. Everything seems to work except the command move. I think the problem is that I did not choose my asset placed correctly.

    Help, please!

    That's what I have so far:

    Create new document

    var doc = app.documents.add ();

    Get the values of page size

    var l = doc.documentPreferences.pageWidth;

    var h = doc.documentPreferences.pageHeight;

    Create the layer called SLUG

    var slugLayer = doc.layers.add({name:"SLUG"});)

    Definition of document slug greatness of space

    doc.documentPreferences.documentSlugUniformSize = false;

    doc.documentPreferences.slugBottomOffset = "20 mm";

    Open the InDesign file to the library that contains the file of slug

    var slugLibrary = app.open(File("/Users/Shared/Slug.indl"));

    Place the slug script go here

    var myPlacedAsset = slugLibrary.assets.item ("Slug");

    var mySlug = myPlacedAsset.placeAsset (doc);

    Close the library of slug

    slugLibrary.close ();

    Move the object of slug to the slug area

    mySlug.move([0,0]);

    Layer of locking SLUG

    slugLayer.locked = true;

    placeAsset is an array, then this line: mySlug.move([0,0]);

    Replace: mySlug [0].move([0,0]);

  • A few questions about the use of a XML file to add text in a component defined in HTML TextArea

    I use AS2 in Flash CS3.

    I have a TextArea component in the scene that load its XML text and I was able to use the ul and li tags to create lists. However, when I try to include a nested list, he inserts just a line break between the nested list and the main list rather than he dash away. Is there a solution for this problem?

    Otherwise, how would I be able to add spaces nonbreaking in the XML so that they will be inside the TextArea element? I tried and & #160; without success. I've been searching the net for some help with this and find information about the change of the incorporation of xml file with a new entry for the non-breaking space of police and that has not worked either, which leaves me a bit confused.

    Flash does not support nested lists (as you know).  You can work around this limitation by using css and create your own styles of dash.  CSS have a property marginLeft, that you can use.

  • How can I add attributes to all images in a stack?

    It is absurd that you can not add attributes to all elements in a pile without developing the battery (therefore defeat the purpose). Does anyone found a workaround for this?

    Workaround: If you shift - click on the badge of the stack in the upper left corner of a cell, extend it with all its selected photos.  While you add metadata, it will be added to each of them.

    You can use the Syncomatic plugin to copy the metadata and/or develop settings from the top of chimneys for the other photos in the batteries.

    Others have requested an option to control this behavior.  Please add your vote and opinion on this in the Adobe official feedback forum: Lightroom: when you select a stack collapsed, provide opportunity to apply the changes to all the photos in the stack

  • Beginner XML questions

    Hello

    First post on the forums in a long time and the first here altogether. I hope it's okay jump in.

    I have a little experience of FM not structured for several years ago and use Ventura (13 years) to my company's books (long directories - 3 000 + / volume). I made some scripts in Ventura have so little experience in programming.

    We are looking to switch to XML rather than text files tagged Ventura can import because of its lack of support, problems, perhaps due to Win7, and the effort required to maintain files to import. I downloaded the trial FM 11 and have been experimenting a bit with XML back and forth and also import what we already have in XML. If a bit I'm sure very simple questions. and thanks in advance:

    I was going through the tutorials from Adobe and everything I can find online. It seem not to be well reviewed books on Amazon that deal with structured FM 9-11. Some that look promising for XML are about 10 years old - I think not that our needs are sharp, so should I get something this old, or stay with most recent although we complain? Any recommendations? If I can get the hang of it with something that is not specific FM will be really difficult to adapt this knowledge to the FM band?

    I find EDD, DTD and schema to be rather confusing. Someone explain the difference in simple terms or direct me to a video, etc.? Assuming that I start with an XML file that is created in one other purpose, not meant to be FM, need more than one of them? Do you do first?

    Ventura if I want to have two separate data elements (off the coast of the database) on the same line, say a left-aligned with the other right aligned, programmers put both with a tab, and that is controlled by a tag paragraph in Ventura with a tab on the right. With XML, if I understand it correctly, you wouldn't do that in the XML file - I'm probably not ready to understand the method, I just want to know if this is possible without doing something like having paragraph of second properties point to have no line breaks. If so, where that would be appropriate, ESD, DTD, etc.?

    XML in FM can include inline graphics? What about an Excel chart?

    Thank you

    Gary

    Hi Gary,.

    a lot of questions, he

    But lets start with the first things first.

    For your general understanding: XML separates basically content layout. You can add metadata to the content by adding attributes to some semantic purposes or to include information for your page layout process (or any information that you feel should be here).

    XML is essentially made up of elements, attributes and entities. Those that are defined in a DTD or a schema. ESD does the same for the management of content structured in FM. To stuff FM back and forth into XML and vice versa, you will need both a DSP for handling in FM and the DTD or schema of XML processing. Basically the two similar at first, but ESD will be also some layout information included as well as routines to facilitate the production of structured content (so called context rules).

    The translation between XML and FM requires also some reading/writing-rules governing the specific elements of the FM and values to create "correct" XML files

    Your layout (-> master pages), styles of paragraph and character, etc. pre-set styles of paintings, graphics and so on, are stored in a template file, which is used when you import an XML file to the FM band.

    These are the basics that you are handling.

    Everything that affects page layout will be on the side of the FM of things (if you use it to publish stuff).

    Everything that affects the structure is mainly done on the DTD and the reading/writing-rules side (but has an equivalent in ESD).

    So, for your search:

    XML books who have 10 years maybe not the best choice, because they will probably have a lot of references to SGML, which doesn't help much. But some who are about 5 years old will do just fine - not much changed on the side of XML (unless you decide to use the XML schema).

    For FM11, it is preferable to use guides for FM9 (those are the most comprehensive) and use this forum.

    If you insured the most, I would say to book some consultant for training on the creation of ESD. This will help avoid a lot of frustration later and pays really fast off the coast.

    It can also provide answers to specific questions such as the ones you posted above (Yes, graphics work).

    Once your done with that, you need to do a search, if one of the XML flavors already established already meet your needs in general (I'm talking about DITA, DocBook, S1000D and others) or if you want to develop your own structure (which needs a mayor of brainstorming, but could better meet your needs).

    Soon Alex

  • Is it possible to add or use my old account e-mail (SMTP format) on a Windows 7 computer.

    Original title:

    e-mail question

    Is it possible to add or use my old account e-mail (SMTP format) on a Windows 7 computer. I have limited knowledge, so I can not have described the format of the account properly, but hope that someone will know what I mean. Currently I have an outlook e-mail account, but would like to be able to access my old account since I've had it for many years and have so many contacts. I also use it for information of connection on the accounts I have used for a long time. Thanks for any help

    (Moved to programs)

    Hello

    You should be able to add your minerbroadband account to Outlook email

    http://Windows.Microsoft.com/en-us/Outlook/Gmail

    If you do not know the SMTP settings > contact your ISP.

  • Newly inserted row in Table not visible until scroll us - question of ease of use

    Hello

    JDeveloper 11.1.1.5

    I have a table in a page and an Add button which will add a new row in the table.
    I just add the line before the current line.
    After you have added the line, I put new line on the current line in the View object.

    When there are a number of lines in the table and we have a scroll bar on the table to display the rows preceding and following, the question of ease of use, I am facing.

    Steps to follow:
    -Select the first row in the table
    -Scroll downwards several times so that the first line is not visible in the table
    -Added a new line

    This will add the line before the first line, but the problem is we cannot see it as the selected active line and is not ready for data entry.
    Users need to scroll upwards or downwards to find where the row is inserted.

    Is there a way we can set the focus on a particular point on the new line in the table?
    Or is there a way that we can make the new line to shown during creation, regardless of the current visibility of the rows in the table?
    Or can we get handle for the current line or any component of the current line so that we can try to set the focus?

    I observed the same behavior in the ADF components demo
    http://jdevadf.Oracle.com/ADF-richclient-demo/faces/components/table/updateableTable.JSPX

    Thanks for any help
    Concerning
    Sameer

    >
    Or is there a way that we can make the new line to shown during creation, regardless of the current visibility of the rows in the table?
    >
    try to set the property DisplayRow of the selected table

  • RH8 can be installed by the admin using his own account?

    Excuse this basic yes/no question, I couldn't find info on RH8. In versions, it was once recommended to install RoboHelp using the account of the USER who would later use the program (not the admin). To do this, the admin rights should be attributed to the user during installation, and again subsequently removed.

    This procedure is still required for RH8 or RoboHelp can now be installed by admin using his own account?

    The options are the user account with admin rights attached or the account admin who will have these rights by default.

    See www.grainge.org for creating tips and RoboHelp

    @petergrainge

  • Can simple Question - I do the colors change in tabular form

    Can simple Question - I do the colors change in tabular form.
    How can I change the colors, green, white alternating on tables?

    Doug,

    Here's some javascript that I use for tables/reports of Ray...
    Don't forget to replace "t15" with your model references.

    
    
    
    
    Also, if you go edit the report template > Column Templates > Column Template 1 > You can set the condition to even/odd rows and then add in your own html/css..
    
    
    #COLUMN_VALUE#
    
     -Chris
    
  • Can you guys please add "slide to unlock" iOS 10

    Can you guys please add "slide to unlock" iOS 10, I use a mini ipad 2 and its got no contact ID.

    It is very annoying to press home to unlock.

    Please Apple, my mini 2 still works and I don't want to change your ipad with touch ID now.

    I will buy another if my mini 2 cant function more. But please, add slide to unlock to ios 10 so that I can still enjoy my mini 2

    Apple will probably not bring the 'slide to unlock' feature back since it has been deleted just today. You don't need to have an iPad with Touch ID to unlock but. Pressing the Home button will do exactly the same thing that slide to unlock did, just without swiping.

Maybe you are looking for