Importing xml text and menu

I am just trying to get my head around Flex by building a
simple application.
What I have at the moment is index.mxml that has an
ToggleButtonBar in it and a ViewStack that lists the three menu
options in the ToggleButtonBar. Clicking each of the buttons in the
ToggleButtonBar opens a new mxml either PageOne.mxml, PageTwo.mxml
or PageThree.mxml (by wiping up and down). This all works and I
have managed to style and position the elements as I want them and
I have activated the history on the 'pages'.
What I would like to be able to do is populate the ViewStack
data from an external xml file (e.g. menu.xml) . I would also like
to populate the sub-mxml files with data from another xml file
(e.g. content.xml) where this would hold the panel's title and a
paragraph of text into something like a textarea.
I have managed to populate xml data into a datagrid on
another test application, but I can't see how this can work with
panels.
Hopefully once I have grasped the basics on how Flex
applications import data I can teach myself how to progress things
to do other things.
Thanks in advance.

I tried writing a tiny bit of xml - something like this:
<xml id="test">
<root>
<menuitem>hello</menuitem>
</root>
</xml>
Then a script that creates a new button (which works). But I
have tried pulling in the data from the xml file to add to the
button like this:
myButton.label = test.root.menuitem;
But it doesn't work. If I put some text in quotes it does
display. The problem is the fact that I am not pulling in the data
from the xml.
Although this isn't the code I am using, how would this
snippet of Adobe's code be adapated to add text from an xml
document to poulate the button's label?
<?xml version="1.0"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
horizontalAlign="left">
<mx:Script>
<![CDATA[
import mx.controls.Button;
public function addButton():void {
var myButton:Button = new Button();
myButton.label = "New Button";
myHBox.addChild(myButton);
]]>
</mx:Script>
<mx:HBox id="myHBox">
<mx:Button label="Add Button" click="addButton();"/>
</mx:HBox>
</mx:Application>

Similar Messages

  • Importing XML Text files with Indesign friendly 'Carriage Returns'

    Hi,
    I have a question wrt importing XML into Indesign.  I have my text stored in Excel (Fig A) and intend to export as an XML file where each line will represent each page.  However, my first attempt failed to treat the 'carriage returns' as I'd envisaged:
    The 'carriage returns' used within an Excel cell (ALT-ENTER) are maintained when transforming to a CSV file (Fig B).  However, when converting to an XML file, the conversion only takes place on a line by line basis and hence the XML file becomes incomplete (Fig C).
    So, it appears I need to make sure that the CSV file contains one line per entry, while also maintaining the actual carriage returns in my source spreadsheet and for Indesign to recognise them.  In order to do this, I'll need to substitute the 'carriage returns' in my excel column to be represented by a new set of characters.  My question is how can I let Indesign know to recognise this set of characters to be converted to a carriage return, when importing text.
    For example, if this set of characters was '%%%%%%', then my new csv file would look like Figure D and the XML would be produced correctly, like Figure E.  Then importing this XML file to InDesign, the carriage returns would automatically be reinstated, hopefully.
    I hope someone can help me as I am only starting out in Indesign and feel Im running before I can walk by venturing into the XML/Indesign arena too soon.
    Best Regards
    Luke

    Hi,
    Thanks for all the responses.
    With regard to XML, it could well be an issue has crept in because I am using another utility to convert my csv's to xml and maybe there are better options out there. I will take a look for other utilities and try that (Its not possible from Excel easily, even though there is an option to save as an XML file).
    Secondly, because the XML was readable by internet explorer, I assumed it had a satisfactory standard XML format which would be accepted by any program, including InDesign.  This proved true, since the XML file i generated was actually recognised by my Indesign document and populated the tags correctly, albeit without any carriage returns. 
    When I save my excel sheet as a csv, it does actually hold the carriage returns causing multiple lines per entry, hence why I need to substitute the actual carriage returns in my excel sheet to a alternative character set so that the entry remains on one line.
    Re: Double quotes on text fields.  Im sorry, I didnt realise I had commas in my sample csv example.
    I should have corrected it, but I intend on using semi-colons as my csv delimiter and don't intend on having semi-colons in my excel sheet itself, so I possibly won't need any double-quotes.
    So, it looks like this is what I need to do ;
    i)   Add a column in Excel which substitutes all the carriage returns with a line break identifier (^n).
    ii)  Convert Excel file to a semi-colon csv holding this new column,
    iii) Convert csv file to XML using a good CSV->XML utility,
    iv)  Add the respective XML tags to my INDD document,
    v)   Add a GREP rule which does a find/replace on all instances of ^n and replace with a line break,
    vi)  Import the XML file,
    vii) Apply the find/replace GREP rule on the whole document. Carriage returns on my text fields should be consistent with my original excel sheet.
    Thanks for all your help fellas.  Will report on how I get on once Im done.
    Best Regards
    L

  • Pass parameter through standard page "import xml content and actions"

    Dear Portal experts,
    As you know, a standard portal page is configured to allow the import of XML file. It is located in the portal in the path system admin -> transport -> xml content and actions -> import
    I configured a quick link u201Cimportu201D to the page so now the link http://myserver:port/irj/portal/import allows me to access directly to this screen.
    What I would like to do now is to pass the parameter related to u201Cfile nameu201D through this screen meaning that I would like that http://myserver:port/irj/portal/ import/filename=C:\test.xml  fills automatically the fields u201CXML fileu201D with  C:\test.xml 
    Please do you know how to achieve this ?
    Thank you very much and regards

    hi,
    @Maksim :
    When user launch an URL like http://myserver:port/irj/portal/ import/*filename=C:\test.xml, he is requested to provide username and password; as this link is a shortcut for the upload xml page, there is a check of authorization and only portal admin that have authorization and permission on this page/iview will be able to upload xml file through the URL. Hope this clarify.
    @Kumar :
    thank you for your answer. What a pity to not be able to pass parameter through standard portal page/iview particularly knowing that we can pass paramater through many kinds of iviews (transactional iview, url iview, VC iview...). I explored some option on file com.sap.portal.ivs.init.par but this was unsuccessful. However, thanks to this [link bellow|http://wiki.sdn.sap.com/wiki/display/Snippets/ComponenttouploadXMLfilewithPCD+objects], I was able to upload through URL the XML file.
    The problem is that I can upload only XML file that are stored in the server not in the local user computer. My requirement is to be able to upload local XML file stored on user's computer.
    If someone could provide and idea/solution, I would be very grateful.
    Cheers

  • Import document text and subtotal lines

    Hello,
    Is it possible to import text and subtotal lines in documents with DTW?
    I can't find any template to do that.
    Thank you !
    Thibault

    Hi Thibault Romieu
    Unfortunatly you can't. The DI API does not have the facility for this. The DTW uses the DI API so it will not be able to do it. You can try making a item that is a sales and purchase item and change the description as you feel, but make sure no one writes values in the price column.
    Hope this helps

  • Import Html text and convert to InDesign tags

    Hello everybody,
    The script receives a JSON with text (html markup: headers <h1>, <b></b>, new line characters, ...).
    I have to save the converted text into a temp text file and then do .place() into a text frame. That's the only way it can recognise new tags.
    //text and contentArea are defined previously.
    var convertedText = convertTags(text);
    var convertedTextFile = new File (FILE_PATH + "/Temp/convertedTextFile.txt");
    convertedTextFile.open('wr');
    convertedTextFile.write(convertedText);
    convertedTextFile.close();
    contentArea.place(convertedTextFile);
    function convertTags(htmlTaggedText){              
         var inDesignTaggedText = "<ASCII-MAC>\n" + htmlTaggedText.replace("<h1>", "<ParaStyle:Heading 1>").replace("</h1>", "");
         return inDesignTaggedText;
    General question is, whether there is any more elegant solution to this?
    Thanks in advance

    Hello everybody,
    The script receives a JSON with text (html markup: headers <h1>, <b></b>, new line characters, ...).
    I have to save the converted text into a temp text file and then do .place() into a text frame. That's the only way it can recognise new tags.
    //text and contentArea are defined previously.
    var convertedText = convertTags(text);
    var convertedTextFile = new File (FILE_PATH + "/Temp/convertedTextFile.txt");
    convertedTextFile.open('wr');
    convertedTextFile.write(convertedText);
    convertedTextFile.close();
    contentArea.place(convertedTextFile);
    function convertTags(htmlTaggedText){              
         var inDesignTaggedText = "<ASCII-MAC>\n" + htmlTaggedText.replace("<h1>", "<ParaStyle:Heading 1>").replace("</h1>", "");
         return inDesignTaggedText;
    General question is, whether there is any more elegant solution to this?
    Thanks in advance

  • Help--XML text and Flash

    Hi,
    I'm relatively new to Flash and I (foolishly) said that I
    could add a simple link at the end of an existing Flash file. The
    link is no problem, but the movie calls all of its text from an XML
    file. While I'm awed by how this works, I'm also stumped--I can't
    get the movie to actually display the text. Here's the bit of
    actionscript that refers to the XML file in question:
    _level0.displayMode_str="loaded";
    launchFile_str="advice";
    launchFolder_str=""
    xmlFileToLoad = "advice_AM.xml";
    commonFolder_str = "./commonFiles/";
    #include "loader.as"
    I'm pretty sure that it's finding the XML file ok, as it's
    pulling one or two headings from it, but nothing else. I know this
    isn't much to go on, but you guys are my only hope. Is there
    something basic I'm missing?
    Thanks in advance!

    I figured it out--the CSS called for a missing font. When I
    swapped that for a font I actually have, everything worked.

  • Selectively ignore Problem Tags Dialog  while importing Tagged Text in CS5.5

    Hi
    My script imports tagged text and places it in selected frames. Due to the tag creation process used, I occasionally get a "Ignoring character level attribute termination tag "<cTracking:>" found without the corresponding character level attribute application tag "<cTracking:value>"
    Since it's not a problem I can ignore this specific error -- but I don't want to turn off ALL problem tag error checking because occasionally there are serious errors that I DO want to see.
    Is there a way to tell ID to ignore this specific error?
    Thanks
    Akiva

    UNfortunately the original ascii files uses a <D> code to return to the default settings -- and since that occasionally includes resetting the tracking to 0 I need to include the "<cTracking:>" tag.
    I could obviously fix it by adding a "<cTracking:0>" to all the codes -- but that seems like it could cause more problems.
    I can preprocess the ascii code to eliminate the excess codes -- but that increases processing time for something which happens only occasionally and is non-problematis in practice.
    Akiva

  • Importing XML Templates

    Hi,
    Currently I am using Adobe Framemaker to import XML templates and make tables of data. Once the data has been imported into Framemaker it is easy to manipulate (change colours/sizes of columns etc.)
    However, I am looking for a way to do this work in InDesign.
    So far, I have tried importing the XML template into InDesign successfully, but as soon as I try to change columns/delete columns, basically make any changes to the table, InDesign freezes, and I have to restart the program.
    The XML document is very large (4,089 rows in excel) and imported from Excel.
    I am using CS4 on Windows XP.
    Can anyone help ?

    Does InDesign freeze if the table is not tagged? (i.e. untag the table and perform the column changes.)

  • Import and flow the xml text in a indesign document

    pls,anyone give me a solution for import and flow the xml text in a document.
    thanks,
    screen410099

    See http://forums.adobe.com/thread/838745?tstart=0
    Would you mind waiting a bit before asking again and again and again and then again? It's possible the person who can answer you question just didn't happen to read the forums this week.

  • I'm creating an epk and I need to add a bio to the menu.  Can I import the text file or do I need to retype the bio somewhere?  What is the best way to proceed?

    I'm creating an epk and I need to add a bio to the menu.  Can I import the text file or do I need to retype the bio somewhere?  What is the best way to proceed?

    Electronic Press Kit.
    Usually in the form of video outtakes, movie trailers, cast and crew interviews. Basically, the stuff that gets bunged onto commercial DVDs as extras or ends up on late night TV "Making Of..." shows.
    To answer the OP, you want a button on the menu that leads to a still image, or series of them, set up as a slide show. You can copy/paste the text in DVD Studio and then add formatting via the Text menu. (Highlight the text and right click to access formatting controls). Or do it in a graphics application using the appropriate video image preset.

  • Import of XML file failed in portal using XML Content and Action

    Hi Friends,
    I am trying to import the simple XML file which is just creating the folder in the PORTAL_CONTENT using XML CONTENT AND ACTIONS  which is one way of creating the portal content. GO TO SYSTEM ADMINISTRATION > TRANSPORT > XML CONTENT AND ACTIONS > IMPORT.
    The reason for using this import tool is to upload the backend Business roles, which is not not working on our corporate portal. To test the import functionality I used the following xml file (I got this XML file by exporting the test folder in the portal using the same tool)
    <GenericCreator author="XML Creator" version="XML Automatic Creation" mode="clean,execute" report.level="success" createMode="1" default.locale="en" ignore="false">
    <Context name="portal_content" objectClass="com.sap.portal.pcd.gl.GlContext"></Context>     <Property name="parent1" value="pcd:portal_content"/>
         <Context name="com.dri.fldr.im" objectClass="com.sap.portal.pcd.gl.GlContext" create_as="0" parent="$">
              <Attributes>
                   <Attribute name="com.sap.portal.pcm.Description" type="text">
                        <AttributeValue value="" locale=""/>
                        <Attribute name="administration" type="string">
                             <AttributeValue value=""/>
                        </Attribute>
                        <Attribute name="Inheritance" type="string">
                             <AttributeValue value="NONFINAL"/>
                        </Attribute>
                   </Attribute>
                   <Attribute name="com.sap.portal.pcm.Title" type="text">
                        <AttributeValue value="test" locale=""/>
                        <AttributeValue value="test" locale="en"/>
                        <Attribute name="administration" type="string">
                             <AttributeValue value=""/>
                        </Attribute>
                        <Attribute name="mandatory" type="string">
                             <AttributeValue value="true"/>
                        </Attribute>
                        <Attribute name="Inheritance" type="string">
                             <AttributeValue value="NONFINAL"/>
                        </Attribute>
                   </Attribute>
              </Attributes>
         </Context>
    </GenericCreator>
    SDN BLOCKED THE XML The above XML file works fine in other portal in the landscape but not in corporate portal ( which is freshly build recently).Following error message is display when i am trying to upload the file
    Status Name Action Type Comment
    General Extracting root node E:\usr\sap\EPD\JC00\j2ee\cluster\server0\%USERPROFILE%\AppData\Local\Temp\tmp_masscontent4135391959047431276.xml Failed to extract root node
    General Extracting root node E:\usr\sap\EPD\JC00\j2ee\cluster\server0\%USERPROFILE%\AppData\Local\Temp\tmp_masscontent4135391959047431276.xml Parsing failed .
    Dont know is there a service/ configurations needs to be done to enable this feature?.
    Thanks
    Edited by: hammad on Sep 4, 2009 5:48 PM
    Edited by: hammad on Sep 4, 2009 5:49 PM

    The problem statement is not very clear.
    Try following this how to guide [https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/207a2141-c870-2910-e080-90c920b24f47&overridelayout=true|How-To]
    Best Regards,
    Prasanna K

  • Importing Arabic text from an XML file

    Importing text from an XML file to appear as text in Flash
    works in English, however if the text I want to import is in
    Arabic, when I test the movie there is no text at all.
    Is there some particular syntax to preface the Arabic text?
    I'll want to import text from XML in other languages too.
    (French)
    I'd cut and pasted some Arabic text into the XML file that
    displays pictures and text in the "slideshow.fla" (
    http://www.adobe.com/support/flash/applications/jpeg_slideshow_xml/jpeg_slideshow_xml03.ht ml)
    Substituting Arabic text for English text, editing the XML
    file with Dreamweaver.
    Any ideas as to how I might achieve my objective of importing
    Arabic text into Fash?
    I'd started developing my prototpe in Macromedia Director 7,
    and then Director MX, but I have not found a suitable Arabic font
    that I can embed that will allow me to display Arabic fonts in
    Adobe Director. I have the Arabic text in a Word document.
    I've dicovered that my Flash MX Pro and Dreamweaver both
    support Arabic fonts, but I want to import text from an XML file.
    I'd prefer using cast libraries and cast members, but I don't
    know of an equivalent in Flash to what I'm comfortable with in
    Director.

    Oh so many questions. You probably aren't going to like the
    answers. I have Flash MX04 pro (aka Flash 7) and things made a big
    jump between MX (aka 6) and MX04. If you only have MX, there might
    not be a way to do this. All my advice is based upon MX04 or
    higher.
    It is possible to do complex languages in Flash. My
    experience is with Hindi and I've helped a few folks here with
    Arabic.
    You won't be able to use text from Microsoft Word – at
    least I don't think so. The XML file will need to be saved in the
    UTF-8 format. I think Word uses its own scheme and won't work. But
    I'm not a Word expert. Something like Text Edit (Mac) or WordPad
    (PC) should be able to save a UTF-8 file.
    The next problem is you mention "suitable Arabic font that I
    can embed." AFAIK, you can't embed any of the complex scripts in
    Flash. You just have to rely on the end user having appropriate
    fonts installed and enabled. Most operating systems from 2000 on do
    have this – although some folks like to remove them to save
    space.
    Next issue will be line composing. I've found that when using
    anything above the normal Latin range that Flash suddenly forgets
    how to make a line fit into a text area. It will just break things
    in the middle of words and not even notice the spaces between
    words. I've written a little snippet of code that "composes" the
    lines. It works well with Hindi and folks here have used it with
    Arabic and not come back saying that it doesn't work. Search the
    forums (both the Flash and Actionscript) if you can't find it I'll
    dig it out when I get home.
    So here is the checklist:
    Make sure the XML is saved in UTF-8
    Import the XML file
    In Testing environment go Debug–>List variables.
    Does it show up correctly there?
    Does it show at all in a text field?
    Use the "composer" to make the lines break.

  • About the exporting and importing xml data file in the pdf form

    Hi all,
    I need help for importing xml data file in the pdf form. When I write some thing in the text field with fill color and typeface (font) and exported xml data using email button. When I imported that xml file in the same pdf file that is used for exporting the xml data then all the data are shown in the control but not color and font typeface. Anyone has suggestion for solving this problem. Please help me for solving this problem.
    Thank you
    Saroj Neupane

    Can you post a sample form and data to [email protected] and I will have a look.

  • Serious Error crashes CS and CS2 when importing XML

    Hello,
    I'm trying to import XML carrying text and images into a 130+ page brochure. I have been working on it for several weeks and have been re importing the XML successfully although something has changed.
    Now when I try to import I get an error message and InDesign closes.
    I've created new blank documents to test it and the initial import works fine. Although after items have been placed and tagged a re import causes an error message to pop up that states: Indesign has discovered a serious error and is shutting down.
    There is nothing that we can see in the code that would cause this. We were trying to overcome a formatting issue and had tweaked the XML. but even after we returned the XML back to its original form we still get an error message. even in new test documents.
    Any ised?

    I don't work with XML, but in my experience, "serious errors" are often caused by bad fonts.
    You might want to try changing the fonts in the code and see if that helps. You should also look through the error logs to see if you can isolate the module causing the problem. There should be a log in the InDesign application root folder, even if there isn't one in Event Manager.
    Peter

  • Import XML, apply XSLT and embed images

    Hi everyone. I've been looking for days now about a way to export the content of a website as XML and import it then into InDesign, involving some basic text formatting and maybe links, lists and tables. Getting a XML version of a website isn't actually the problem. But including some InDesign readable formatting structure caused me some headache.
    First of all, I used InDesign from CS2 and read a lot about INX structure, XML Namespaces and Tagged Text. None of what I did seemed to result in any acceptable or properly working import. So I've read about CS3 having a new feature of applying XSL Stylesheets when importing a XML file and finally downloaded a trial version to test this out. Problem is, I can't find any helpful documentation on how to use this feature right. Neither in the web nor in your forums.
    So how does a XSL file have to look like in order to import XML with some basic formatting?
    Let's say the XML looks like this, very simple:
    ] <?xml version="1.0" encoding="UTF-8"?>
    ] <?xsl-stylesheet type="text/xsl" href="style.xsl"?>
    ] <root>
    ] <text>
    ] <bold>This text is bold</bold> and <italic>this seems to be italic</italic>.
    ] </text>
    ] <underline>I'm under the line</underline>
    ] </root>
    How does my XSLT code in "style.xsl" have to look like in order to tell InDesign that the content of <bold> has to be bold, the one of <italic> italic and leaving <underline> underlined?
    I tried placing Tagged Tags around the content with XSL but this just resulted in errors or plain text output in InDesign. I also tried to understand the magical code structure of INX, but left it behind until I recognized how complex it is.
    Until now, only Tagged Tags do what they shall do for me. Only problem is, the file with this Tagged Tags has to be TXT, but I want XML. Isn't there any way to apply a XSL file over a XML file and replace the XML tags with some Tagged Tags, and finally import everything successful into InDesign? I tried something like that and told the XSL to output the file as Text with
    i <xsl:output method="text" />
    but InDesign replies with an error as "text" is not valid for DOM structuring.
    Moreover, another problem is with importing images without having them saved on the local machine. Meaning, how to send images embed in XML files?
    Here I also tried many things like <![CDATA[base64-code-here]]> and so on, but never happened to tell InDesign that it has to do something with this code instead of just displaying it. Using
    i <image href="data:image/jpeg;base64,base64-code-here" />
    or anything alike didn't work at all.
    In the end, I want to allow downloading a XML version of the viewed site on my website which can be imported into InDesign with all basic formatting used on the site itself. Getting the XML file prepared is just a matter of some PHP scripting. Now I only have to know what InDesign can actually read, and of course, if InDesign is even able to do anything of what I've planned.
    I hope someone can help me.
    Thank you very much in advance, Dan

    XSL will re-arrange incoming XML so that you can flow the XML into an InDesign document that may be arranged differently than the incoming XML file.  You still need to set up tags and associate those tags with styles in order to achieve what you want.  You can use Maivald's "A Designer's Guide to Adobe InDesign and XML: Harness the Power of XML to Automate your Print and Web Workflows" as a starting point, but you will need to play with the pieces to figure it out.<br /><br />For your simple example, you will need to set up tags in text frames for <bold> and <italic>, create paragaph (or object) styles of [bold] and [italic] and then associate those styles with the tags.  Only then can you import the XML file and have things work.  InDesign has no pre-defined knowledge of what any XML tag means, even when the meaning seems obvious.  You are free to define your <bold> XML tag to mean italic text, for example.<br /><br />Though I've read through the Maivald book and converted a Spanish cookbook to English (as a gift for my mom), I am not by any means overly knowledgeable here.  It could well be that there are many ways to achieve the goal and I only know one, lol.<br /><br />Hope this helps.

Maybe you are looking for