How to create and add an XML node at run time ?

Hello and thanks to All of You i've been learning a lot since i use this forum..
I'm having another problem, !!! i would like that my executeShape function insert a new XMLChildnode called "adverts"  to my Pages:XML via the evenListener of the execute_bt. I tryed copying the nodes and it works but it copy a blank "adverts" node in betwen each node copied. so i tryed with appendChild, but it works only once, then it say error. so i tryed with inserChildafter or inserChildbefore but this one doesnt work at all because "advert" doesnt exist. I understand why all my suggestions does'nt work (copied or append or insertchild), but i dont figure out how to get what i want . i love AS but im no advance in enought..
My XML structure that I want is quite simple : i just want that every time I press the execute_bt, a new "adverts" is added to the Pages XML
<Pages>
  <page id="Page1">
    <adverts>
      <adfile>Null</adfile>
      <adwidth>1</adwidth>
      <adheight>50</adheight>
      <adposx>514</adposx>
      <adposy>200</adposy>
    </adverts>
   <adverts>
       <adfile>Null</adfile>
       <adwidth>1</adwidth>
       <adheight>50</adheight>
       <adposx>514</adposx>
       <adposy>200</adposy>
     </adverts>
  </page>
</Pages>
Here is the code of the clip:
execute_bt.addEventListener(MouseEvent.MOUSE_UP,executeShape);
var _adWidth:uint=uint(Adwidth.text);
var _adHeight:Number=Number(Adheight.text);
var _adFileName:String=String(adFileName.text);
var _adpage:String=String(PageInstanceName.text);
var _adPosx:Number;
var _adPosy:Number;
var _adArrayID:int;
var currentColor:Number;
var i:int=0;
var element:int=0;
var Pages:XML=<Pages />;
Pages.page = <page />;
Pages.page.@id=_adpage;
var boldText:TextFormat = new TextFormat();
with (boldText) {
    font="Verdana";
    size=10;
    color=0xFFFFFF;
    bold=false;
    multiline=true;
function executeShape(evt:MouseEvent):void {
    _adArrayID=i;
    currentColor=Adcolor.selectedColor;
    var Container:MovieClip= new MovieClip();
    Container.name=adFileName.text;
    Container.id=_adArrayID;
    var gr:Graphics=Container.graphics;
    gr.lineStyle();
    gr.beginFill(Adcolor.selectedColor, 2);
    gr.drawRect(0,0,(uint(Adwidth.text)*70),Number(Adheight.text)*1.68);
    gr.endFill();
    var Lbl:TextField = new TextField();
    Lbl.x=Lbl.y=1;
    Lbl.autoSize=TextFieldAutoSize.LEFT;
    Lbl.multiline=Lbl.wordWrap=true;
    Lbl.width=(uint(Adwidth.text)*65);
    Lbl.text=String(adFileName.text);
    Lbl.setTextFormat(boldText);
    var btn:Sprite=new CreateRoundRectButton(20,20,5,0,0xFFFFFF,"X",0xFF0000);
    btn.name="delete";
    btn.x=9;
    btn.y=50;
    addChild(Container);
    Container.x=514;
    Container.y=200;
    Container.addChild(Lbl);
    Container.addChild(btn);
    index.text=String(Container.id);
    file.text=String(Container.name);
    widht.text=String(uint(Adwidth.text));
    heigth.text=String(Number(Adheight.text));
    posx.text=String(Container.x);
    posy.text=String(Container.y);   
    Pages.page.appendChild(<adverts />);
   Pages.page.adverts.appendChild(<adfile />);
    Pages.page.adverts.appendChild(<adwidth />);
    Pages.page.adverts.appendChild(<adheight />);
    Pages.page.adverts.appendChild(<adposx />);
    Pages.page.adverts.appendChild(<adposy />);
    Pages.page.adverts.adfile=String(Container.name);
    Pages.page.adverts.adwidth=String(uint(Adwidth.text));
    Pages.page.adverts.adheight=String(Number(Adheight.text));
    Pages.page.adverts.adposx= String(Container.x);
    Pages.page.adverts.adposy=String(Container.y);
   //var templist:XMLList= Pages.page.adverts.copy();
    //templist[0].adfile = String(Container.name);
    //templist[0].adwidth = String(uint(Adwidth.text));
    //templist[0].adheight = String(Number(Adheight.text));
    //templist[0].adposx = String(Container.x);
    //templist[0].adposy = String(Container.y);
    //Pages.page.appendChild(templist);
    //Pages.page.insertChildAfter(Pages.page.adverts[0], templist);
    trace(Pages);
    btn.addEventListener(MouseEvent.CLICK, deleteme, false, 0, true);
    Container.addEventListener(MouseEvent.MOUSE_DOWN,StartDrag);
    Container.addEventListener(MouseEvent.MOUSE_UP,StopDrag);
    i++;

Sorry , i Found the solution......:
var Pages:XML=<Pages />;
Pages.page = <page />;
Pages.page.@id=_adpage;
var boldText:TextFormat = new TextFormat();
with (boldText) {
    font="Verdana";
    size=10;
    color=0xFFFFFF;
    bold=false;
    multiline=true;
function executeShape(evt:MouseEvent):void {
    _adArrayID=i;
    currentColor=Adcolor.selectedColor;
    var Container:MovieClip= new MovieClip();
    Container.name=adFileName.text;
    Container.id=_adArrayID;
    var gr:Graphics=Container.graphics;
    gr.lineStyle();
    gr.beginFill(Adcolor.selectedColor, 2);
    gr.drawRect(0,0,(uint(Adwidth.text)*70),Number(Adheight.text)*1.68);
    gr.endFill();
    var Lbl:TextField = new TextField();
    Lbl.x=Lbl.y=1;
    Lbl.autoSize=TextFieldAutoSize.LEFT;
    Lbl.multiline=Lbl.wordWrap=true;
    Lbl.width=(uint(Adwidth.text)*65);
    Lbl.text=String(adFileName.text);
    Lbl.setTextFormat(boldText);
    var btn:Sprite=new CreateRoundRectButton(20,20,5,0,0xFFFFFF,"X",0xFF0000);
    btn.name="delete";
    btn.x=9;
    btn.y=50;
    addChild(Container);
    Container.x=514;
    Container.y=200;
    Container.addChild(Lbl);
    Container.addChild(btn);
    index.text=String(Container.id);
    file.text=String(Container.name);
    widht.text=String(uint(Adwidth.text));
    heigth.text=String(Number(Adheight.text));
    posx.text=String(Container.x);
    posy.text=String(Container.y);   
    var adverts:XML= new XML;
    adverts=<adverts />;
    adverts.adfile=<adfile />;
    adverts.adwidth=<adwidth />;
    adverts.adheight=<adheight />;
    adverts.adposx=<adposx />;
    adverts.adposy=<adposy />;
    adverts.adfile=String(Container.name);
    adverts.adwidth=String(uint(Adwidth.text));
    adverts.adheight=String(Number(Adheight.text));
    adverts.adposx= String(Container.x);
    adverts.adposy=String(Container.y);
    Pages.page.appendChild(adverts);
    trace(adverts);
    btn.addEventListener(MouseEvent.CLICK, deleteme, false, 0, true);
    Container.addEventListener(MouseEvent.MOUSE_DOWN,StartDrag);
    Container.addEventListener(MouseEvent.MOUSE_UP,StopDrag);
    i++;

Similar Messages

  • How to create and Pass DBLINK name at the run time

    Hi,
    Please help me out ....
    ACCEPT DB_USER PROMPT 'Enter the DB user name :'
    like this i will get the DB_USER name and i want to create one dblink with that userbame at the runtime
    and in all my .sql file i have to append that user name and dblink .. how to do this ....
    for example ,
    1.sql file contains a query like this
    select *
    from <user>.emp@<dblink>
    where ename= 'KING'
    ACCEPT DB_USER PROMPT 'Enter the DB user name :'
    user enter : SCOTT
    and the dblink should create a name like SCOTT_DBLINK
    and it should make the select clause in the .sql file as
    SELECT *
    FROM SCOTT.EMP@SCOTT_DBLINK
    WHERE ename = 'KING';

    Hi,
    Do you want to actually CREATE DATABASE LINK on the fly? - Don't there are all sorts of implications there.
    If not, go ahead and read about [SQL*Plus Substitution Variables|http://www.oracle.com/technology/support/tech/sql_plus/htdocs/sub_var.html]
    Regards
    Peter

  • How to create and add table type to a DDIC Structure in sap 3.1H

    How to create and add table type to a DDIC Structure in sap 3.1H

    How to create and add table type to a DDIC Structure in sap 3.1H

  • How to create and add a logon/logoff script to populate last user into the computer field in AD

    Hi All,
    Bit stuck here,
    Not sure what forum to put this is as it involves different subjects,
    I work in a Server 2008 RT environment and have access to Active Directory etc.
    I saw this a few weeks ago - http://ivan.dretvic.com/2012/10/automatically-generate-description-field-for-computers-in-active-directory/
    Now, I'm not particularly sure what to do here, I don't know how to create a group policy etc. How to implement it in a test environment etc. Never done this before.
    Can somebody give me a step by step guide on literally everything that would be involved in this?
    Or any links that may be able to help?
    I basically want the AD to show who was the last user that logged into a specific client when the client named is searched for in the Computers OU, and if possible being able to pull the make/model and serial number from the client aswell.
    If possible there should be a way of including this with the existing login script that we already have, how can I do this?
    I've tried a few so far and got stuck, I have domain admin priveledges also.
    Thanks,
    Regards, Max.

    Hi Max,
    Please refer to the following article to learn how to create a logon/logoff script via GPO:
    Assign User Logon Scripts
    Assign User Logoff Scripts
    As for the issues about script, this is the forum to discuss questions about driectory service, better to post your question to the forum for Script:
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=scripting
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or
    learn from your interaction with us.
    Thank you for your understanding.
    Regards,
    Lany Zhang

  • How to create a single large bitmap data at run time?

    Hi All,
    Please help me in overcoming the issue that is mentioned below.
    Requirement:   Create single very large bitmap data which contain some 30 PNG images loaded and for each image it should have some text.  Images and text are loaded dynamically (AS2 code. Images are stored in a remote server). The bitmap data display should show 8 images at a time and corresponding text. We can see rest content by scrolling (kinetic scroll is implemented). How can I go for it?
    Some questions:
    · Is there any limit for size of bitmap data ( As per link there is restriction on the height of the bitmap we can create in AS2 (max value is 2880 which is not enough for some 30 element list http://help.adobe.com/en_US/FlashLite/2.0_FlashLiteAPIReference2/WS84235ED5-9394-4a52-A098 -EED216C18A66.html ) How to overcome this limitation?
    · If we create individual bitmap data for 30 individual PNG files, we find some jerks in scroll. How can we have smooth scrolling?
    Thanks and Regards,
    Manjunath

    Thank you very much for the reply.
    The number of bitmaps are not 30 always. It can vary in real time and since all PNG files are stored in a remote server which are also vary during runtime; so we can not predefine the number of child movieclips. It could be 10 at some duration and may be 20 at some other time.
    Any help?

  • How to create sub-directory by PL/SQL in run-time?

    Hello,
    I have directory defined in Oracle DB and I need to create a sub-directory by run-time PL/SQL code and move my file into the sub-directory.
    The DB version is 10.2.0.3.0.
    How can i do it without creating a new directory in DB each time i need to create a sub-directory?
    Thanks!

    Or, as directory objects are replacable you can just change them using dynamic SQL...
    e.g.
    execute immediate 'create or replace directory my_home as ''/home''';
    execute immediate 'create or replace directory my_home as ''/home/newfiles''';
    of course this isn't going to work if the directly object is going to be used by multiple users at the same time, but if it's for a dedicated process then it would.
    (it also relies on the operating system directories having appropriate read/write permissions, but that's outside the ability of Oracle to control)
    Personally though, I'd avoid having things moving about dynamically.
    The design of my process would specify where files are going to be located and the correct number of directory objects defined and created up-front.
    Any 'incoming' files would have to be located in one of those known locations, whether that's under the control of the 'users' supplying the files, or some other process (o/s script maybe?) that receives the files and moves them to the known location.

  • How to create and modify an XML file from an Oracle Form

    I would like to build an Oracle Form to maintain a small XML file in the file system (i.e. Not in Oracle database but in the operating system).
    I would like the Form to display existing values from the XML file and the user can update and save content back to the XML file.
    Can any one tell me how this can be done? Thanks.

    Does Forms 9i provide any XML Parser Functions?
    Can I insert the XML file into a table column by inserting XML using the XSU Front End rather than using TEXT_IO to maintain the XML file directly?
    Can I use XSU PL/SQL API in Forms to retrieve and modify XML values?
    Any help is appreciated.

  • How to create and add a custom control in VS2013 Community

    Hello everyone,
    Could you please help me to create a control in visual c++, and then add it in the toolbox of a windows form application?
    I tried to create the control in that way:
    Create a class library, then add to it a CLR user control, then compile e created my .dll.
    I created a new CLR Project, added a form and all the necessary to start it, compiled and started form without problem.
    Then I add the reference of my custom control .dll (right click, add reference...)
    At this point no way to put it in Toolbox, nor with "chose item", nor in any other way.
    Could you please help me?
    Thank you

    Is the class public (“public ref class MyUserControl”) and did you open the Form Designer before checking the toolbox? The user controls should appear automatically after rebuilding the solution.

  • How to create and add a new panel(under commenting list)?

    Hi,
    I'm basically a vc++ developer and new to this acrobat X.
    My requirement is to add a new subpanel under the commenting list.(Toolpane(right hand side)-> comment->commentinglist))
    I'm unable to find the soultion.Please help me in this.
    regards
    lavanya

    Is the class public (“public ref class MyUserControl”) and did you open the Form Designer before checking the toolbox? The user controls should appear automatically after rebuilding the solution.

  • How to create Dynamic prompts for a field at run time

    HI all
    I have a table which has 2 columns name attribute1 and attribute1_meaning.
    Attribute1_meaning is the the meaning of attribute 1.
    ex if attribuite1 is 500.. attribute1_meaning tells us if its MHz. RAM or whatever.
    So IN my form I want to display the prompt of attribute1 as the value attribute1_meaning
    Is there a way to do this ?
    thanks

    It also depends on your form layout. Francois' solution works if you only display one record. If you display multiple records this won't work, since an item can only have one prompt at a time. There is no set_item_instance_property for the prompt.
    In that case you can create two fields attribute1 and attribute1_meaning. You can set the visual attribute of field attribute1_meaning to look like a normal prompt.

  • How to set Value Attribute (under valu node) at run time

    Hi,
    This is my View context.
    wbsElement (Value Attribute of Type String)
    This is my Component Controller Context.
    Project_info  (Value node)->Wbs_Info (Value Node)-WBS(Value Attribute).
    Initially I want to set some dummy values to wbsElement(view attribute),sothat I can show that in drop downby key.
    On selecting of wbsElement I want to pass the selected value to component controllers ValueAttribute - WBS (this Value attribute is under 2 nodes-see the structure I've given).
    I tried this way which is not working fine.
        IWDNodeElement element = wdContext.createWBSElement();
         wdContext.nodeWBS().addElement(element);
        wdContext.currentWBSElement().setWBS(wbsElement);
    Can anyone tell me which is the correct way to do this?
    This is very urgent.plz help me in this.Thankx in advance.
    Regards,
    Karthick

    Hi Karthick,
       try this code.
    IPublic<compcontrolllername>.IWbc_infoElement  obj  =         wdThis.wdGet<Componentcontrollername>Controller().wdGetContext().createWbc_infoeElement();
    obj.setWBS(wdcontest.currentContestElement.getwbsElement());
    wdThis.wdGet<Componentcontrollername>Controller().wdGetContext().nodeWbc_infoElement().addelement(obj);
    set the cardinality of Project_info to 1:n or 1:1
    test this one
    if you find any problem let em know
    regars
    Naidu

  • Cannot create and add a new entry to LDAP

    Hi,
    I'm pretty new at LDAP and JNDI, i've been trying to create and add a new entry to the directory but somehow it's not working.
    here is my code and I would appreciate it if someone can help.
    import java.util.Hashtable;
    import javax.naming.ldap.*;
    import javax.naming.directory.*;
    import javax.naming.*;
    import javax.net.ssl.*;
    import java.io.*;
    public class Newuser
         public static void main (String[] args)
              //LDAPEntry myEntry = new LDAPEntry();
              Hashtable<String, String> env = new Hashtable<String, String>(11);
              String adminName = "CN=ldap_admin,o=JNDITutorial,dc=img,dc=org";
              String adminPassword = "secret";
              env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
              //set security credentials, note using simple cleartext authentication
              env.put(Context.SECURITY_AUTHENTICATION,"simple");
              env.put(Context.SECURITY_PRINCIPAL,adminName);
              env.put(Context.SECURITY_CREDENTIALS,adminPassword);
              //connect to my domain controller
              env.put(Context.PROVIDER_URL, "ldap://localhost:389/o=JNDITutorial,dc=img,dc=org");
                   // Create the initial directory context
                   //JNDILDAPConnectionManager jndiManager = new JNDILDAPConnectionManagerImpl();
                  try{
                       DirContext ctx = new InitialDirContext(env);
                        System.out.println("Connection to LDAP server done" );
                       final String groupDN ="ou=people,o=JNDITutorial,dc=img,dc=org";
                      //DirContext dirCtx = jndiManager.getLDAPDirContext();
                      People people = new People("Thiru","Thiru","Thiru Ganesh","Ramalingam","ou=people","[email protected]");
                      // The Common name must be equal in Attributes common Name
                      ctx.bind("cn=Thiru," + groupDN, people);
                      System.out.println("** Entry added **");
                      //jndiManager.disConnectLDAPConnection(ctx);
                  }catch(NamingException exception){
                      System.out.println("**** Error ****");
                      exception.printStackTrace();
                      System.exit(0);
    }here is the Object class People that i'm trying to instantiate
    public class People implements DirContext {
         public People(String uid,String cn,String givenname,String sn,String ou,String mail) {
        BasicAttributes myAttrs = new BasicAttributes(true);  //Basic Attributes
        Attribute objectClass = new BasicAttribute("objectclass"); //Adding Object Classes
        objectClass.add("inetOrgPerson");
        /*objectClass.add("organizationalPerson");
        objectClass.add("person");
        objectClass.add("top");*/
        Attribute ouSet = new BasicAttribute("ou");
        ouSet.add("people");
        ouSet.add(ou);
        myAttrs.put(objectClass);
        myAttrs.put(ouSet);
        myAttrs.put("cn",cn);
        myAttrs.put("sn",sn);
        myAttrs.put("mail",mail);
    ...the message i keep getting is:
    javax.naming.directory.SchemaViolationException: [LDAP: error code 65 - entry has no objectClass attribute]
    the thing is that I can create and add a new entry in openLDAP from the console and it works.
    and here is how I proceed
    I create a text file: new.txt
    dn:cn=Hamido Saddo,ou=People,o=JNDITutorial,dc=img,dc=org
    cn:Hamido Saddo
    mail:[email protected]
    telephonenumber:3838393038703
    sn:hamdio
    objectclass:top
    objectclass:person
    objectclass:organizationalPerson
    objectclass:inetOrgPersonand i use this command to add the entry:
    ldapadd -D "cn=ldap_admin,O=JNDITutorial,dc=img,dc=org" -W -f new.txtand everything works, i get no errors.
    does anyone has a clue maybe???

    You must have an IMAP email account in order to add additional folders on the iPad mail app.
    If you go to your email account in the Mail app and look at the window where your inbox, trash folder and sent folder are - if there is an Edit button at the top of the window - tap that and then tap Add Mailbox at the bottom.
    If the Edit button is not there - you cannot create folders on the iPad. Your email account is not IMAP. Only IMAP email accounts can create folders on the iPad. Any folders that you would already have in an IMAP account would sync to the device as well.

  • How to create and deploy a simple jstl applicaton in weblogic 10.3.3

    How to create and deploy a simple jstl applicaton in weblogic 10.3.3

    1) Since JSTL libraries are provided as Web application libraries, they must be deployed before the Web application that is using JSTL functionality is deployed. The libraries can be deployed using the Administration Console or with the command-line weblogic.Deployer tool.
    Here’s an example of deploying a JSTL 1.2 library using the weblogic.Deployer command-line:
    java weblogic.Deployer -adminurl t3://localhost:7001
    -user weblogic -password weblogic
    -deploy -library
    d:/beahome/wlserver_10.3/common/deployable-libraries/jstl-1.2.war
    This command deploys the JSTL 1.2 library using the default library-name, specification-version and implementation-version defined by the MANIFEST.MF in the library.
    After a library is deployed, the extension-name, specification-version and implementation-version of the library can be found in Administration console. This information can also be found in the MANIFEST.MF file of the library WAR file.
    For more information on deploying a Web module refer below URL
    http://docs.oracle.com/cd/E15051_01/wls/docs103/deployment/deployunits.html
    2) To reference a JSF or JSTL library, a standard web application can define a <library-ref> descriptor in the application’s weblogic.xml file. Here is an example:
    <library-ref>
    <library-name>jsf</library-name>
    <specification-version>1.2</specification-version>
    <implementation-version>1.2.0</implementation-version>
    <exact-match>false</exact-match>
    </library-ref>
    For more information on referencing a Web application library refer below URL
    http://docs.oracle.com/cd/E15051_01/wls/docs103/programming/libraries.html
    3) Create a sample JSP in your application and JSP should look as shown below
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <html>
    <head>
    <title>TestJSTL</title>
    </head>
    <body>
    <c:set var="topic" value="JSTL" />     
    <c:out value="${topic}" />
    </body>
    </html>
    4) Create WAR and deploy and test.
    Edited by: Murali Veligeti on Jul 26, 2012 9:00 AM

  • How to create Inbound Idoc from XML file-Need help urgently

    Hi,
    can any one tell how to create inbound Idoc from XML file.
    we have xml file in application server Ex. /usr/INT/SMS/PAYTEXT.xml'  we want to generate inbound idoc from this file.we are successfully able to generate outbound XML file from outbound Idoc by using the XML port. But not able to generate idoc from XML file by using we19 or we16.
    Please let me know the process to trigger inbound Idoc with out using  XI and any other components.
    Thanks in advance
    Dora Reddy

    Hi .. Did either of you get a result on this?
    My question is the same really .. I am testing with WE19 and it seems SAP cannot accept an XML inbound file as standard.
    I see lots of mention of using a Function Module.
    Am I correct in saying therefore that ABAP development is required to create a program to run the FM and process the idoc?
    Or is there something tht can be done with Standard SAP?
    Thanks
    Lee

  • How to Create and Define New faults to be used inside our BPEL Process

    Hi All,
    I have created a new BPEL process but unable to add fault handling messages which I'm unable to do because I'm not having any
    experience in creating my own custom fault or runtime faults.
    Can anybody can share any URLS of how to create and where to define these things in BPEL Process.
    Expecting a reply from ASAP. very urgent for me.
    Regards,
    CH

    Hi Arik,
    I opening in JDeveloper 11.1.1.2 but it is asking for migrations but not all migrating and unable to see the project.
    By seeing at the logs it is saying that upgrade failed.
    Please can you share any other URL other than this.
    Regards,
    CH

Maybe you are looking for