Flattening XML text

Given the following XML snippet:
<adjustments>
<adjustment>Add <bonus>10</bonus> points
if completion time less than
<completionTime>60</completionTime>
seconds.</adjustment>
<adjustment>Add <bonus>15</bonus> points
if opponent rank is higher than level
<opponentRank>5</opponentRank>.</adjustment>
<adjustment>Add <bonus>5</bonus> points if
the temperature is above <temperature>75</temperature>
degrees Fahrenheit.
</adjustments>
How would I output each adjustment as text like the
following? In other words, how can I "flatten" the XML text?
Add 10 points if completion time less than 60 seconds.
Add 15 points if opponent rank is higher than level 5.
Add 5 points if the temperature is above 75 degrees
Fahrenheit.
Thanks in advance for your help.

adjustments.text() returns an empty string, of course. And
something like adjustments.adjustment[0].text() returns just:
Add points if completion time less than seconds.
It doesn't have the text of of the child nodes.
What I need is the text of a parent node and all of the child
nodes in one string. Even if I iterate over the parent and all the
descendants, I don't see any way of properly placing the text from
the children into the text from the parent.
Any other ideas?

Similar Messages

  • Problem with tabs in xml text

    I have a problem with my XML setup here
    i use Tab key to aligh up info in the xml text for aligned
    display in the program
    hoever i tested on several computers and get different
    resolts.
    how can i fix this.
    Please view the linked Image
    http://img129.imageshack.us/img129/8394/flashtextproblemti4.jpg
    this is what happenes even thow all run xp and all run same
    latest flash version.
    Anyone got an ideer how i can solve this.
    BTW the font is verdana.
    This is my actionscript ....
    // Function to parse an address
    f_parseAddress = function () {
    // Set the text
    _root.stageholder.textfield.htmlText =
    this.firstChild.firstChild.firstChild.nodeValue;
    // Create the XML object
    XML_address = new XML();
    // Set up the XML object
    XML_address.ignoreWhite = true;
    // Add the handlers
    XML_address.onLoad = f_parseAddress;
    // Load the XML file
    XML_address.load("./Data/xml/kontakt.xml");
    This is my XML file
    <?xml version="1.0" encoding="iso-8859-1"?>
    <text>
    <address>
    <![CDATA[
    <font size="20">Company name</font>
    Company name
    address
    address
    Dir. tlf. + xx xx xx xx xx
    + xx xx xx xx xx
    Mobil + xx xx xx xx xx
    + xx xx xx xx xx
    web: <a href="
    http://www.xxxxxxxxxxxxx.xx"><b>www.xxxxxxxxxxxxx.xx</b></a>
    E-mail: <a
    href="mailto:[email protected]"><b>[email protected]</b></a>
    ]]>
    </address>
    </text>
    If anyone got a solution on how i can get my text to allign
    corect
    i would like to hear about it
    Best reguards
    Mis

    alrighty then try this xml structure.
    Note: formatting information like b, or linkage tags should
    not be part of the xml.
    The XML format is a universal format for data, if you fill it
    with style information this is not good practive (in general, there
    are of course scenarios where it makes sense, also since (x)html IS
    also XML).
    In your case you want to put the information about multiple
    companies in a xml file, but you let the flash decide how to
    display format this information.
    so if you use the sugested XMl structure you will have full
    control of the layout within flash, because you can grab every
    piece of information from the xml and place it jsut where you want
    in flash and format it within flash.
    Of course this process is more coding work than your previous
    attempt, but it pays of when you have a lot of data to process and
    when you want to have full control of the final layout.
    But maybe its overkill for your application (I don't know how
    many companies will be stored in your xml and how complex the rest
    of the app is).

  • 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.

  • Need help with XML text

    I'm trying to load in XML text. I'm looking for an efficient
    method of doing so.
    Ideally, I'd like the text to fade in and out with the image.
    Maybe adding a subtle animation/movement to the text box would be
    nice. Perhaps a MC that plays intervals of movement with a dynamic
    text box... i just don't know how to do it.
    Sample files
    CLICK HERE
    845kb

    start simple and build. check the xml class so you can see
    how to create a simple xml file, load it and parse its contents.
    then progress step-wise towards your project.

  • How to insert single colon xml text in the xml table

    Dear Sir,
    how to insert special characters like single colon text example (don't) xml text in to the xml table
    please see the following example its giving me error quoted string is not ended properly
    SQL> insert into ftr_ctl values (1,
    2 xmltype('<po:root xmlns:po="http://www.oracle.com/FC.xsd"
    3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    4 xsi:schemaLocation="http://www.oracle.com/FC.xsd
    5 http://www.oracle.com/FC.xsd">
    6 <row>
    7 <UniqueIdentifier>urn:x-gcs:def:featureType:GFDD::FT_DFDD_100565</UniqueIdentifier>
    8 <AlphaCode>ZB032</AlphaCode>
    9 <Name>Baseline Point</Name>
    10 <Status>Submitted</Status>
    11 <Definition>A location that serves as a point on, and which partially defines a segment
    of, a national boundary baseline.</Definition>
    12 <Description>May be monumented or unmonumented. A national boundary baseline is used fo
    r defining the landward edge or margin of a nation's various contiguous zones such as the 3 and 12 n
    autical mile limits and the Exclusive Economic Zone (EEZ).</Description>
    13 </row>
    14 </po:root>'));
    ERROR:
    ORA-01756: quoted string not properly terminated
    how to solve single quotation like (nation's) in xml data insertion
    please give me reply as soon as possible
    Thanks
    Kabeer

    Hi,
    Use &#x7B;code} tags to post formatted code on the forum.
    That way, your code will be more readable for everyone, and more importantly here, everyone will be able to clearly see what's bothering you :
    &apos;sThe single quote was encoded with the character entity reference "&amp;apos;".
    The conversion is not mandatory but it happens Oracle is doing it in this case.
    It shouldn't be a problem though.
    If you want to extract the value afterwards, it'll come as expected :
    SQL> create table ftr_ctl (id number, doc xmltype);
    Table created
    SQL> insert into ftr_ctl values (1,
      2  xmltype('<po:root xmlns:po="http://www.oracle.com/FC.xsd"
      3  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      4  xsi:schemaLocation="http://www.oracle.com/FC.xsd
      5  http://www.oracle.com/FC.xsd">
      6  <row>
      7  <UniqueIdentifier>urn:x-gcs:def:featureType:GFDD::FT_DFDD_100565</UniqueIdentifier>
      8  <AlphaCode>ZB032</AlphaCode>
      9  <Name>Baseline Point</Name>
    10  <Status>Submitted</Status>
    11  <Definition>A location that serves as a point on, and which partially defines a segment of, a national boundary baseline.</Definition>
    12  <Description>May be monumented or unmonumented. A national boundary baseline is used for defining the landward edge or margin of a nation''s various contiguous zones such as the 3 and 12 nautical mile limits and the Exclusive Economic Zone (EEZ).</Description>
    13  <Alias xsi:nil="true"></Alias>
    14  <SourceItemIdentifier>100565</SourceItemIdentifier>
    15  <SourceReference>DGIWG DFDD BL 2011-1.00</SourceReference>
    16  <SourceURL>https://www.dgiwg.org/FAD/fdd/view?i=100565</SourceURL>
    17  </row>
    18  </po:root>'));
    1 row inserted
    SQL> select extractvalue(doc, '/po:root/row/Description','xmlns:po="http://www.oracle.com/FC.xsd"')
      2  from ftr_ctl
      3  where id = 1
      4  ;
    EXTRACTVALUE(DOC,'/PO:ROOT/ROW/DESCRIPTION','XMLNS:PO="HTTP://WWW.ORACLE.COM/FC.
    May be monumented or unmonumented. A national boundary baseline is used for defi
    ning the landward edge or margin of a nation's various contiguous zones such as
    the 3 and 12 nautical mile limits and the Exclusive Economic Zone (EEZ).
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Save an Image object into a XML text document

    ello:
    I have a problem with saving an image. I need to encapsulate it into two XML tags:
    <Image> xxxxxx </Image>
    The "xxxx" must be a String that represents my Image object.
    In J2ME I haven't serialization, and all the examples about "manual serialization" works with primitive types :(
    I've already read that I can do .getRGB() over my Image object, and obtain an array of int, wich represent each pixel. Ok, I can transform the array into a String, and write it in my XML text document, but later: how I obtain my array from that String?
    Thak you very much

    private Image img;
    byte rgb[] = null;
    private rgbLength; // get lenth of your string
    rgb = new byte(rgbLength);
    rgb = ... //load data from string to this array
    img = createRGBImage(rgb, int width, int height, false) ;You must know length of your string and must encapsulate in to XML width and height of this image;

  • Loading an image in an XML text file

    I've gotten the DateChooser component to work very well
    loading dynamic text fields with data from an external XML file.
    Can I embed a jpeg into the XML text like I would with the
    <img> tag in an HTML text file?
    Many thanks in advance for any tips...
    George

    I assume your XML looks something like this...
    <event date='11/11/1111'>
    <PerformerName>SomeInfoHere</PerformerName>
    </event>
    You could add the image info anywhere you want in the XML.
    Perhaps an attribute of the PerformerName tag?
    <PerformerName
    image='myImage.jpg'>SomeInfoHere</PerformerName>
    or
    <PerformerName image='
    http://www.myDomain.com/images/myImage.jpg'>SomeInfoHere</PerformerName>
    When you parse the XML data and build your Array, then you
    just need to capture the additional tag attribute. Similar to how
    you got the date attribute.
    Then at that point you would add it into the textField of
    your info_txt.
    Read this page in the docs to see how to add the image.
    http://livedocs.adobe.com/flash/8/main/00001464.html

  • How to avoid empty elements in generated xml text

    I am using XMLBeans to generate xml.
    If I set text value for a tag then it displaying like
    <param name="org">Satyam</param>
    If I set empty text value for the same tag it generateing xml text like
    <param name="org"/>
    But I don't need empty elements in generated xml like this way. Even though I set empty text to a tag it has to display like
    <param name="org"></param>
    How can I do this one.
    Message was edited by Mouli at Dec 14, 2004 2:55 AM

    Hi,
    by the book these two representations are identical
    <.... />
    <....></....>
    as for the XML-parser.
    What problem are you facing with the <... /> representation?
    I will try to investigate a bit to see if the XMLBean can be forced to write the <....></....> representation.
    - Anders M.

  • Textbox shows xml text in working file but now when loaded into another SWF

    Hi all,
    I have downloaded an xml gallery (as2) as we needed one for an old as2 file. Now I mostly use as3 but thought as I only needed to tweak it there would be no probs. Of course, it rarely works out that way. The problem is, text loaded from the xml file is displayed with its corresponding image. This works fine in the file. When I load the SWF into another SWF however, it all works EXCEPT the text doesn't show at all?? Whoever made the gallery used 'device fonts' in the textbox, I don't know if this has anything to do with it. I tried changing the textbox to dynamic and embedding characters but still nothing.
    This seems the key line -
    _root.descmc.desc.htmlText = XMLdaten[number];
    I have also tried
    _root.descmc.desc.htmlText = XMLdaten[number].firstChild;
    This traces out the correct xml data when tested so it is finding it okay.
    Any help would be much appreciated.
    Thanks

    The problem might be in the use of the "_root"  You probably need to set _lockroot = true; in the loaded swf, otherwise the _root is that of the loading swf, not the loaded one.

  • Facelets - any ideas on how to output XML (text/xml)?

    Hello there,
    Instead of putting out an xhtml file I plainly wish to output an XML file.
    First of all, is it possible or even necessary to develop a special extension aside from the .xhtml for these types of files. If so then is there a common standard being used such as *.xxml or should I just make something up.
    Secondly, I simply want my client to receive the page with the content-type header of "text/xml".
    Please keep in mind, I'm looking for a very simple example or suggestion(s)/references.
    thanks in advance.

    According to the latter there is an answer in the Facelets FAQ:
    http://wiki.java.net/bin/view/Projects/FaceletsFAQ#How_do_I_change_the_response_con
    And according to the file extension question, I don't think there is any standard, why don't you use .xml extension?

  • Xml text in a dreamweaver doc?

    hi
    is there a way of linking an xml document to a html doc.
    so the user only has to update the xml doc to update the text within the web page?
    any tutorials anywhere?
    cheers guys

    Yes, but if I am understanding you correctly, this really is not the best use for XML.  XML stores data like a database but in a flat file that allows for dynamic manipulation of data (ie: see Spry data sets - http://labs.adobe.com/technologies/spry/samples/ - examples under first tab).  If you are looking to have users edit long text, it would be easier and more productive to use a database such as mySQL or MS SQL.  Also with using a database you can provide an interface to make editing easier whereas XML documents are all ugly code and if one thing is mistyped it can cause a headache for you and your customer.

  • Changing a PDF with a text box, and then flatten the text box onto the underlying PDF before sending the document out.

    I download PDF documents from municipalities, often and from numerous municipalities.
    They have a scanned image of a form that I need to fill out,
    I enter my contact info as a text box onto the form, along with other information,
    but when I save the document, there seems no way to flatten the fields so that the person I send the document to has a true PDF and cannot change the document.
    They could delete one of the text boxes or change the text in the box (by mistake),
    which could case some major complications.
    How do I flatten the document, so I can send it back to the municipalities as a PDF that cannot be changed.
    I am using Acrobat X Pro, on windows XP machine

    I doubt you could fix this. Generally a "garbled" file is considered unusable for copying, and that's that. If a PDF uses random mappings instead of standard ones it looks fine on screen, but text extraction is impossible.
    Short of converting every page to bitmap and OCRing again.

  • XML text rendered as HTML

    Hi there folks.
    I've used, for the first time, the htmlText method to render the text in my textfields as html text that is provided by a xml. So in the xml i introduce the html tags.
    Don't have experince with this so i'm asking you how can i do it properly?
    Every time i use a tag except <p> i get another extraline. For instance:
    "This is my text. <b>Starting</b> with a boldy little line."
    And i get this:
    "This is my text.
    Starting
    with a boldy little line."
    Why is this happening and how can i avoid that?
    Thank you.

    use the cdata node to load text without parsing.

  • Scrollbar for XML text area

    HI,
    A newbie here and on Flash,
    Sorry for my poor englih too, I'm French.
    My pb :
    I the attach file you will find forfaits.fla which is connected to xml/forfaits.xml. The pb is the UI Component SROLL BAR for the textarea for the img description doesn't work .
    Can you help me?
    Thx a lot

    I think you should connect it to a text area.
    Just create a multiline dynamic text area, connect the text area to the xml file and use the toXMLString();
    for example: myTxt.text = myXML.toXMLString();
    and then attach the scroll bar to the dynamic multiline text area.
    hope it helped

  • Externalized .xml text in SWF?

    Hi
    I have created a flash presentation (pretty simple), with action script that calls in the text from an XML file. This allows text edits (or translation) to occure outside of the flash environment. We simply translate the .xml file, the updated or translated text automatically populates when the .swf file is opened. This is great! However the .xml file must remain in the same file system directory as the .swf file or there will be no text when the .swf is opened. Generally this would not be a problem. But we would like to have the .swf file uploaded to the website as a standalone piece. Does anyone know how to keep the externalized text but somehow keep the .xml file as part of the .swf packedge?
    Thanks

    Well I understand you probably just want to somehow publish them together but you cant. What I don't understand is why can't you just upload the xml to the same folder as the swf on the server? Just have them located together anywhere and however your presenting them, have the user pull up the swf. Just link that to them. They don't have to open the xml or even see it at all. They definitely can't edit it, it's on your server. The only other way is to hardcode the xml instead of externally linking them like kglad mentioned. If your not getting the answer you want, then it just depends on how your presenting this to them. Do you have hosting and server space or are you trying to upload the swf on some random website. If you have server space, upload them together. and if you just don't want to upload two files, FTP it instead of their the hosts filemanager. Anyway, good luck

Maybe you are looking for

  • How to set a default value in a comboeditor of xamdatagrid .

    Hi, In WPF application i have a  medical report page , there is a xamdatagrid to represent the values like medical centres . Medical centre column in xamdatagrid i have a xamcomboeditor to popup the values from db . But i want to set one of  the valu

  • How do I edit a PDF with PDF Pack?

    how do i edit a pdf pack?

  • Macbook pro 13" service warranty

    Hello. I purchased a 13" Macbook pro from Best Buy back in December of 2012. Is my Macbook eligible for service @ my local Apple Store without any charges? I haven't yet purchased apple care. Thanks.

  • Issue While Importing Roles in SAp Authentication

    Hi Experts, I have installed BO XI 3.1 SAP Integration Kit. While Configuring SAP Authentication in CMC  i have enetered all the details of SAP system under  entitlement system. Howevere when i click on Role Import tab , i am not able to see any role

  • Issue with Load balancing for 2 Apps Node for EBS 12.1

    Hi Guys, I had been following section 2.4 of Using Load-Balancers with Oracle E-Business Suite Release 12 (Doc ID 380489.1). As per doc, I should be able to (but which is not happening in my case) [root@ebs1 etc]# nslookup ebslbr.oracle.com Server: