Create an XML object with AS3

I want to create a basic XML object in AS3, but don't know
how to do this.
I first tried creating a string that represented my XML
elements and their values, but then I don't know how to convert
this string into an XML object.
Secondly, I believe there are other ways of creating XML
objects in AS without doing anything with strings.
Can somebody please recommend to me a way to do this?
An XML example to create with AS3 is:

I've figured out the solution to my problem. For anyone
interested, see me code below (the xml element names are different,
but the concept is the same).

Similar Messages

  • Matching JS XML object with Indd XML elements

    Hello Scripters,
    I need help ...
    I have some XML from a file read into a Javascript XML object.
    The object has the name "myXml", and contains:
        <book id="bk101">
            <author>Gambardella, Matthew</author>
            <title>XML Developer's Guide</title>
            <genre>Computer</genre>
            <imagecontainer href="C:\33415677.JPG"></imagecontainer>
            <price>44.95</price>
            <publish_date>2000-10-01</publish_date>
            <description><test>Sublevel</test>An in-depth look at creating applications with XML.</description>
        </book>
        ... and several other books
    I also have some XML in Indesign, wich in my JS is known as "myTplXmlRoot".
    myTplXmlRoot is defined as myTplXmlRoot = mySelection.associatedXMLElement;
    What would be the best approach for matching elements of the same name in the two xml structures, and where there is a match* replace the Indesign content**, with that from the object "myXml"?
    *) Match if same name, dont worry about place in hirachy
    **) content might be an image

    I've figured out the solution to my problem. For anyone
    interested, see me code below (the xml element names are different,
    but the concept is the same).

  • Creating an XML file with CFFILE on UNIX server

    I've run into a problem with creating an XML file on a UNIX
    server. I don't have access to the server and I'm trying to create
    an XML file so an outside agency can read it through the site URL.
    On a Windows machine I use GetDirectoryFromPath and
    ExpandPath to return the drive/path info, then I create the file
    with this and the query result. On the Unix web server I am only
    being returned a relative path, because of this I can't write the
    XML file to the web server. Any idea how to get around this?

    Knowing as little as I do about Unix I thought you still needed
    a drive "letter" to write the XML file to. I've been told I can get
    to the root but that it's root is "/bottomFolderName" (I was
    expecting R:\webRootPath\yourFolder\etc\XMLFileWrittenHere).
    No, that is Windows thinking. You were told right. In Linux,
    a path usually begins with the forward slash /.
    I had doubts about your code itself. Did you run your version
    of my example on Windows? If it works, then you will only have to
    replace the Windows path with something like the following. The
    rest of the code remains the same.

  • How to create a XML Form with confirmation Page

    Hi!
    I need to create a XML Form that have a confirmation page to enter de data and save it (into XML file).
    It's possible to make it with the XML Forms Builder, or I need to make it manual at xml & xsl??
    (Sorry about my poor english!)

    Hi Ernesto,
    there is currently no confirmation message available in the XMLForms EditForm. But you can use the "preview" button to show how it looks like, before you are using the "Save" button.
    Regards
    --Matthias

  • How to create a xml object dynamically

    Hi all,
    In my current project the database is returning the query result in xml string format(using oracle's DBMS-XML package).
    Now I need to use this xml string and build a xml object and transform it into XSLT and then in a servlet and then pass it to the browser and display it using xsl stylesheets.
    Can some one help me in building an xml object using a string( the xml string is in the xml format i.e in <..> format) and then transform it into xslt in the servlet and send across to the browser.
    Any hands on code or references to the code will be most favourable.
    any help regarding this issue will be most appreciated. Pls do reply as early as possible as I do not have much time to implement this.
    Thanking in advance for your kind help.
    Srinivas.

    What's an "xml object"?
    If you want to transform it using XSLT (transforming it "into" XSLT doesn't make much sense), you can transform direct from the string. Like this:try {
      TransformerFactory xformFactory  = TransformerFactory.newInstance();
      Source xsl = new StreamSource("your.xsl");
      Transformer stylesheet = xformFactory.newTransformer(xsl);
      Source request  = new StreamSource(new StringReader(yourXMLString));
      Result response = new StreamResult(out);
      stylesheet.transform(request, response);
    catch (TransformerException e) {
      System.err.println(e);
    }By the way, if you haven't seen this code before then I suggest you go and read ERH's book about XML with Java:
    http://www.cafeconleche.org/books/xmljava/chapters/index.html

  • Create a Java Object with Dynamic Variables

    Hi ,
    I am constructing a web based system which stores personal information on people. I have created a Person class with all the obvoius variables, forename, surname, address etc.. My problem is that some clients wish to make use of some of the variables, some want other variables and as i meet others they wish to add in some new variables eg
    Client 1 wishes to store; Forename, Surname and Address
    Client 2 wishes to store Forename, AltForename, Surname, AltSurname and Address ( AltForename - this is an alternative Forename in this case the Irish translation of their English name)
    Client 3 wishes to store Forename, Surname, Title, Address, Height, Weight, DOB, School, Occcupation.
    Each of the clients above need to submit these in an online form with each form looking different due to the fields they have to enter and also with different validation rules.
    At present i have a Person object handling all fields i can think of and different validation methods depending on the client, but there must be a better way of doing this as each time a new field is added by a new or existing client, i not only have to update the java and jsp but also the DB.
    This is all web based and i wish to use the same code base and data source for all clients. I also wish it to be all web based. So in theory if a client asked to add in a "middle name" field to their form and make it mandatory, i could go to an admin page which lists all the possible input element types and select the "field type" then set validation rules on it.
    All the web based and DB parts can be ignored - the main issue here is creating a Person class which can have any number of variables of varying types ( String, Int, etc)
    Regards,
    Cormac
    Edited by: cormacodonnell on Jun 27, 2008 6:33 AM

    cormacodonnell wrote:
    Hi ,
    I am constructing a web based system which stores personal information on people. I have created a Person class with all the obvoius variables, forename, surname, address etc.. My problem is that some clients wish to make use of some of the variables, some want other variables and as i meet others they wish to add in some new variables eg
    Client 1 wishes to store; Forename, Surname and Address
    Client 2 wishes to store Forename, AltForename, Surname, AltSurname and Address ( AltForename - this is an alternative Forename in this case the Irish translation of their English name)
    Client 3 wishes to store Forename, Surname, Title, Address, Height, Weight, DOB, School, Occcupation.You could extend the Person class with 3 sub classes, but that might be overkill just to store personal info.
    Each of the clients above need to submit these in an online form with each form looking different due to the fields they have to enter and also with different validation rules.
    At present i have a Person object handling all fields i can think of and different validation methods depending on the client, That's probably how I'd do it if it's not too much trouble. But to be OO you should probably go the inheritence route.
    but there must be a better way of doing this as each time a new field is added by a new or existing client, i not only have to update the java and jsp but also the DB. Welcome to software development. It's called "feature creep" or "scope creep". As soon as you get your code working right and deploy it and get ready to go on vacation, the customer always comes back with something else they "need" or "forgot". The app I'm building right now I've rewritten or changed 7 times in 3 months because nobody has a clue what they really need.

  • ODI : create an XML model with UBL  technology instead of XSD file

    Hello,
    I have several xsd files which contain UBL (Universal Business Language) and all these files are linked between them. In Oracle Data Integrator, I would like generate a XML model from these files as I use to do with the standard xsd files. Unfortunately, it doesn't work with the driver I use usually.
    Do you know if you can generate an xml model from xsd files which contain UBL and if yes, could you say me all the steps I must do to that successfully please?
    Thank you in advance.
    Olivier

    Hello All,
    What I mean is :
    when an xsd file calls an other xsd files by using the namespaces (when 2 xsd files are linked), is there a way to create an xml model matching with the contain of these 2 xsd files?
    Can someone say me if the only solution to generate a xml model is to have only one xsd file?
    Thank you in advance

  • Is it possible to create 2 Date objects with different hashcode.

    Hi,
    I want to create 2 java.util.Date objects with different hashcodes. Is it possible??
    Regards,
    Farooq

    import java.util.Date;
    import java.util.Calendar;
    public class TwoDates {
        public static void main(String[] args) {
            Calendar oneCal = Calendar.getInstance();
            oneCal.set(Calendar.YEAR, 1903);
            Calendar anotherCal = Calendar.getInstance();
            Date oneDate = oneCal.getTime();
            Date anotherDate = anotherCal.getTime();
            System.out.println(oneDate.hashCode() + " " +
                               anotherDate.hashCode());
    -14330615 -825112150

  • Non-XML slideshow with AS3?

    Hello,
    I am looking for a way to run a slideshow without using XML, but controlling the entire show with AS3. I have all of the resources and code to run a dynamic show, but I am attempting to build this on Oracle's Content Management System – Stellent. Stellent does not allow us to access our external XML files or external assets such as images, js, swf, etc.
    The best way to go about building our slideshows for use with this CMS is to make them fully integrated in themselves. The downside, obviously is a larger filesize, but does anybody know how I would go about building this into itself, instead of externally?
    I would like to keep all functionality of the XML (specifically the links and timer)
    I would also like to keep the automatic button generation.
    If anybody can help me out with this it would be greatly appreciated. I have attached a file enclosing all of my working dynamic elements.
    Thank you!!
    Nick
    I am unable to load a zip file, but within the parent directory there should be an assets folder with an images folder inside.

    there must be some way to use external data to feed applications or that wouldn't be much of a cms.
    but if you want to keep all the data in swf, just hardcode all the data in your swf.  actually, with as3, you can copy and paste the contents of an xml file into flash and assign it to an xml instance.

  • Creating a COM object with CF9 32-bit on Windows Server 2008 R2 64-bit machine

    I'm using a 32-bit version of CF9 and it's installed on a Windows Server 2008 R2 machine (64-bit).  The problem I'm running into is that it won't allow me to create a COM object - it gives me the error, "no ntvinv in java.library.path null" when I try to run,
    <cftry>
    <cfobject type="COM" action="CONNECT" name="Engine" class="JRO.JetEngine">
    <cfcatch type="Any">
        <cfobject type="COM" action="CREATE" name="Engine" class="JRO.JetEngine">
    </cfcatch>
    </cftry>
    Then when I run it a 2nd time, I get "An exception occurred when instantiating a COM object. The cause of this exception was that: java.lang.RuntimeException: Can not use native code: Initialisation failed."
    Can you help me?

    Replying for your patchset installation pre-req error:
    Use below command:
    ./runInstaller -ignoreSysPrereqs
    Review MOS note 763143.1 for more info.

  • Creating an XML file with CF

    I need to loop through a query to create an xml file. How do
    I create a file using CF? I thought maybe cffile but I don't see an
    attribute for "new", just things like append, delete, move etc...
    Am I missing something here? I've used cfheader to send content to
    the browser but just not sure how to create a file and place in on
    the server.
    Any help would be appreciated GREATLY!!!!

    See if this helps:
    http://tutorial97.easycfm.com/
    Ken Ford
    Adobe Community Expert - Dreamweaver
    Fordwebs, LLC
    http://www.fordwebs.com
    "cfcolorado" <[email protected]> wrote in
    message news:fe3poc$cvf$[email protected]..
    >I need to loop through a query to create an xml file. How
    do I create a file
    > using CF? I thought maybe cffile but I don't see an
    attribute for "new", just
    > things like append, delete, move etc... Am I missing
    something here? I've
    > used cfheader to send content to the browser but just
    not sure how to create a
    > file and place in on the server.
    >
    > Any help would be appreciated GREATLY!!!!
    >

  • How to create AD contact object with multiple proxyAddresses?

    Hello,
    I need to create AD contact with multiple proxyAddresses to be used in mail routing.
    How can I accomplish this using Java?
    I can create an AD contact with single value fine. But I don't know how to populate a multivalue attribute.
    proxyAddresses: smtp:mytestuser@Domain1
    proxyAddresses: SMTP:mytestuser@Domain2
    Also, how do I update a multivalue attribute? When first name and/or last changes, the proxyAddresses will need to be updated?
    How can I do this?
    Thanks
    Khanh

    This error is no longer coming up, it is now saying that it has an unsupported class version error. I believe this may be because the class file and library files have been complied under different versions, is there a method to check this?

  • Create a infocube object with function module

    Hi,
    Is it possible to create one infocube object via rfc call? If yes, could you pls give me an example how to do it? Many thanks.
    regards,
    Hai

    Hi Julian,
    I couldn't work out how to do this either, so I did it using the oracle.express.spl.SPLExecutor class and sending Express commands to create a program.
    Let me know if you want to see some sample code.
    Cheers,
    Mark...

  • Creating XML object with namespaces

    I'm trying to create the following XML
    <xs:schema id='MySchema' xmlns:xs='
    http://www.w3.org/2001/XMLSchema'
    xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
    <xs:element name='MySchema' msdata:IsDataSet='true'
    msdata:UseCurrentLocale='true'/>
    </xs:schema>
    Following the documentation it appears that the following
    code should do the trick
    private const xs:Namespace = new Namespace("
    http://www.w3.org/2001/XMLSchema");
    private const msdata:Namespace = new
    Namespace("urn:schemas-microsoft-com:xml-msdata");
    var testXml:XML = <schema></schema>;
    testXml.addNamespace(xs);
    testXml.addNamespace(msdata);
    testXml.@id = "MySchema";
    testXml.xs::element.@name = "MySchema";
    testXml.element.@msdata::IsDataSet = true;
    testXml.element.@msdata::UseCurrentLocale = true;
    However, this results in the following XML
    <schema id="PERSONDETAILS">
    <element name="PERSONDETAILS" xmlns="
    http://www.w3.org/2001/XMLSchema"/>
    <element IsDataSet="true" UseCurrentLocale="true"
    xmlns="urn:schemas-microsoft-com:xml-msdata"/>
    </schema>
    Can anyone tell me what I'm doing wrong? Thanks

    Got it, this seems to work...
    var testXml:XML = <xs:schema xmlns:xs='
    http://www.w3.org/2001/XMLSchema'
    xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'></xs:schema>;
    testXml.@id = "MySchema";
    testXml.xs::element.@name = "MySchema";
    testXml.element.@msdata::IsDataSet = true;
    testXml.element.@msdata::UseCurrentLocale = true;

  • How to create a ActiveX Object with custom classes

    Hi
    I am trying to create a Active X object for some of the work I have done in Java to be used with VB, but I cannot get the Active X object to generate and it always come up with the following error:
    Exception occurred during event dispatching:
    java.lang.NoClassDefFoundError: uk/co/agena/minerva/model/Model
    at java.lang.Class.getMethods0(Native Method)
    at java.lang.Class.getDeclaredMethods(Unknown Source)
    at java.beans.Introspector$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.beans.Introspector.getPublicDeclaredMethods(Unknown Source)
    at java.beans.Introspector.getTargetEventInfo(Unknown Source)
    at java.beans.Introspector.getBeanInfo(Unknown Source)
    at java.beans.Introspector.getBeanInfo(Unknown Source)
    at sun.beanbox.JarInfo.<init>(Unknown Source)
    at sun.beanbox.JarLoader.createJarInfo(Unknown Source)
    at sun.beanbox.JarLoader.loadJar(Unknown Source)
    at sun.beans.ole.Packager.loadBean(Unknown Source)
    at sun.beans.ole.Packager.generate(Unknown Source)
    at sun.beans.ole.Packager.actionPerformed(Unknown Source)
    at java.awt.Button.processActionEvent(Unknown Source)
    at java.awt.Button.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForComponent(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForComponent(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    This appears to be beacuse the class uk/co/agena/minerva/model/Model is a custom class which is based on the software I am using. Does anyone know how I can get around this issue. I have tried incluijng those class files for the custom classes within the jar file, but I continue to get the same issue?
    Any help would be gratefully received.
    Thanks
    Angie

    This error is no longer coming up, it is now saying that it has an unsupported class version error. I believe this may be because the class file and library files have been complied under different versions, is there a method to check this?

Maybe you are looking for