Remove line breaks within a xml element

Hi,
I have a xml element that contains a long text string with multiple line breaks. something like this:
text
text
text text
text
text text text
text
How can I remove all line breks except one, i e I still want a line brek after each text line:
text
text
text text
text
text text text
text
Thanks for you help!
Magnus

This is a media object (BLOB) in a JDE report. But we have now modified the report to get the xml file correct from start instead.
/Magnus

Similar Messages

  • SAP PI 7.3.1 XML line break within node

    Good Morning All,
    I've an issue with link breaks in XML. Basically, the scenario is IDoc (SAP) to File (XML 3rd Party System).
    I've mapped a text field from the IDoc to the XML node (<comments>) .  The text data comes across with a delimiter !$! to indicate where a line break should occur within the <comment>  node in the XML
    For example the text line comes across in the IDoc as  line 1!$!This is Line 2!$! this one is line 3!$!  and within the xml file I need to the <comment> node to look like  <comment>line 1
                                       This is line 2
                                       this one is line 3</comment>
    We need this for formatting in the 3rd party system. I've tried various replaces etc. but the new line never seems to get recognized. 
    Any help with this would be very much appreciated.
    Thanks
    G

    Use OS specific new line character by using System.getProperty("line.separator"):
    Here is complete code:
    UDF with Context option
    Parameters:String var[], ResultList result)
    String temp[] = var[0].split("!$!");
    for(int i = 0; i < temp.length; i++)
         result.addValue(temp[i] + System.getProperty("line.separator"));
    Check it should work, I have not tested...
    --Divyesh

  • Inserting line break within label

    Hey guys,
    i've run into a small problem with the coding. right now im
    creating image viewer within a horizontal list. at first, i had
    each object coded inside the horizontal list but then i decided to
    place everything in an xml file to make changes easier. since i've
    switched, i have not been able to figure out how to insert a line
    break for each label. this is what the code looked like when i was
    naming each object.
    <mx:HorizontalList id="PosterSelect" height="352"
    columnCount="3" columnWidth="200" width="580"
    rollOverColor="#ff3344" themeColor="#DC240B"
    itemClick="itemClicked(event)">
    <mx:dataProvider>
    <mx:Array>
    <mx:Object id="object1" label="March 12, 2008&
    #13;Chicago, IL" data="events"/>
    <mx:Object id="object2" label="March 12, 2008&
    #13;Chicago, IL" data="events"/>
    <mx:Object label="March 12, 2008& #13;Chicago, IL"
    icon="{event3}" data="events"/>
    <mx:Object label="March 12, 2008& #13;Chicago, IL"
    icon="{event4}" data="events"/>
    <mx:Object label="March 12, 2008& #13;Chicago, IL"
    icon="{event5}" data="events"/>
    </mx:Array>
    </mx:dataProvider>
    </mx:HorizontalList>
    within the label property, i used the & #13; character to
    insert a line break. now im using an item renderer to call the
    information from my xml file. the problem is... i cannot figure out
    how to insert a line break like i did previously. from what i
    understand... the text in the label field of the xml file is
    already parsed when it comes into flex. so using the & #13; or
    \n characters will not work. i also tried hitting enter to insert a
    new line in the xml file but that did not work either. does anyone
    know how i could work around this?? below is my current code and
    xml
    <eventinfo>
    <events>
    <label>March 12, 2008#13;Chicago, IL</label>
    <group>group name</group>
    <location>Detroit, MI</location>
    <icon>posters/event1.png</icon>
    <fullsize>posters/event1.png</fullsize>
    </events>
    <events>
    <label>March 12, 2008#13;Chicago, IL</label>
    <group>group name</group>
    <location>Detroit, MI</location>
    <icon>posters/event4.png</icon>
    <fullsize>posters/event1.png</fullsize>
    </events>
    </eventinfo>
    <mx:HorizontalList id="HorizontalCanvas" height="337"
    columnWidth="180" width="672"
    rollOverColor="#ff3344" themeColor="#DC240B"
    itemClick="callJavaScript()" x="10" y="33" borderStyle="solid"
    dataProvider="{eventinfo.events}" borderColor="#000000">
    <mx:itemRenderer>
    <mx:Component>
    <mx:VBox width="100%" height="350"
    horizontalAlign="center">
    <mx:Image source="{data.icon}"/>
    <mx:Label text="{data.label}"/>
    </mx:VBox>
    </mx:Component>
    </mx:itemRenderer>
    </mx:HorizontalList>

    hey atta,
    sry, i was using the &#13; character but for some reason
    when i posted the character it turned into a space so i added the
    space inbetween the & and the #13;
    but yea i think it was the height... changed it to 40 and it
    worked.. i cant believe i didnt notice that lol... oh well... thx
    for the help!!!

  • VSTO: How to set line break in Ribbon Xml?

    Hi All,
    I have a button in Ribbon.xml. it looks like:
            <group label="myLabel" id="View">
              <checkBox id="cbView" label="ViewViewviewviewview" getPressed="cbView_Pressed"/>
            </group>
    The result is shown as:
    The checkbox is too long. My question is : How to set line break in checkbox's label.
    Thanks a lot,
    By the way, in Ribbon Xml. How to add RadioButton?

    Hello Ricky,
    The Fluent UI (aka Ribbon UI) doesn't provide any attribute or callback for that. You can try to use an escape sequence "\n\r", but I am not sure whether it helps. Also you may consider placing a text block below the check box control.
    You can read more about the Ribbon UI in the following series of articles:
    Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
    Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
    Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)

  • Handling Line breaks in Oracle XML Publisher

    Hi,
    I’m developing a XML Publisher report.The data definition file has a tag which contains line breaks(\n- new line).
    How to handle this logic in RTF template?
    For Example:
    XML tag:
    <CF_LONG_TEXT>Final Adjusted Total Costs: $0.00 \n Less: Initial Billing Amount - $(1.65) - Invoice # 100000 \n \n Final Billing Amount: $0.88 \n \n Computation: \n a) Adjusted Number of Full-Time Students: 2,877 </CF_LONG_TEXT>
    Desired Output:
    Final Adjusted Total Costs: $0.00
    Less: Initial Billing Amount - $(1.65) - Invoice # 100000
    Final Billing Amount: $0.88
    Computation:
    a) Adjusted Number of Full-Time Students: 2,877
    Thanks,
    Sri.

    Hi,
    Please try giving this:
    <xs:attribute name="space" default="preserve">
                          <xs:simpleType>
                              <xs:restriction base="xs:NCName">
                                 <xs:enumeration value="default"/>
                                 <xs:enumeration value="preserve"/>
                               </xs:restriction>
                          </xs:simpleType>
                    </xs:attribute>
    Regards
    Suraj

  • Line breaks within contents of floating fields

    Hello everyone,
    I have the following question regarding the usage of floating fields and line breaks:
    I have a text that incorporates a companies name using a floating field.
    If the name of the company is too large, a line break is forced automatically. In some cases the companies name is like "Company 123 N.V.". When the line break is forced on this company, its shows "Company 123 N." on the first line and "V." on the second line.
    How can i prevent the line break at "N."? I suppose the break is because of the "." in the text. But I want it only to be a line break if the "." is followed by a space, not if there is more text to it.
    The same sort of issue we face with floating fields containing for example telephone numbers ( format: "+31 (0) 20 - 123 456 1", line break at the "+", "(" or the spaces) and e-mail addresses ( [email protected], line break at the "@" or the ".") .
    Thanks for any reply on this.
    Regards,
    Joris

    I have the same problem. Does anyone have an answer for this one, please?
    Thanks,
    Vanessa

  • Preventing line breaks within field

    Hi,
    Some of my fields contain phrases that should stay together rather than break over a line. For example, one of my fields is a date field (e.g. 27 October 2009) and I'd liike the whole date field to stay together on one line. Is there any way to control this?
    Thanks a lot for any help provided!

    IS that within a table cell or free text?
    In free text it should stay together unless the field is right at the end of a line e.g.
    +This piece of text was written on 1st January
    2009 and has broken across a line.+
    Not much you can do for that except ensure that there is plenty of space.
    If its in a cell/column of a table - you need to give it enough width to handle the string in the word table. If you want to handle it programmatically you can but its going to squash other columns to make enough room. You are better to 'hardcode' the table column widths to handle the expected data.
    Regards
    tim

  • Detecting line-breaks within a column of an uploaded tab-delimited file.

    Suppose you upload a tab-delimited file from your laptop and split each row of the file into some structure that you append to an itab.
    Is there a way inside ABAP to detect that a field of the uploaded file has a CR or CRLF in it?  And if so, where it is ?
    Thanks in advance ...

    You can use any of the following for those char.
    DATA:   head_crnl(1)   TYPE c VALUE cl_abap_char_utilities=>cr_lf,
              top_crnl(1)    TYPE c VALUE cl_abap_char_utilities=>cr_lf,
              end_crnl(1)    TYPE c VALUE cl_abap_char_utilities=>cr_lf,
              blank_crnl(1)  TYPE c VALUE cl_abap_char_utilities=>cr_lf,
              final_crnl(1)  TYPE c VALUE cl_abap_char_utilities=>cr_lf,
              first_pgbr(1)  TYPE c VALUE cl_abap_char_utilities=>form_feed.
    Declare the above variables and check if they occur in the file. Hope this helps.

  • Line Break in XML?

    When I use "<br>" within my XML database, I get this
    error:
    "Expected end of tag 'br'(9,43)"
    I have tried <br>, </br>, <br></br>
    and searched... but haven't yet found a solution.
    Should I be using some kind of hex code?
    Thanks in advance for the assistance!
    Dan

    I spent a whole bloody day trying to solve this one!  Thanks for the advice here guys....
    Here's the "How to..." instructions I made for myself (I will need this later as a function of age)....
    Inserting <br /> line breaks in XML content:
    It's necessary to add a line of code directly after the dataset at the top of the (spry) htm page that sets the columnType:
    var dsRegInfoElem = new Spry.Data.XMLDataSet("regisinfo.xml", "sites/level1/site",{distinctOnLoad:true});
    dsRegInfoElem.setColumnType('datetime','html');<!--This line is necessary for the line breaks in the xml CDATA sections to work-->
    Make sure the xml tag that will contain the CDATA wrap is identified (here it's the <datetime> tag).
    Then, in the XML file, add the CDATA wrap just inside the tag like this:
    <datetime><![CDATA[texttexttexttext]]></datetime>
    Now just insert the <br /> where I need it!
    <datetime><![CDATA[texttext<br />texttext]]></datetime>

  • Carriage Returns and Tabs in XML element

    I have a number of carriage returns and tabs within an xml element. When I take that element I would like it to transform to html in which I am then displaying within a JEditorPane. However, when I do this it is one long string. I have tried the xml:space="preserve" within that element and this still is not working.
    Here is part of the xml with the carriage return line feeds. The element that I am talking about is called pseudocode. You can see it is displayed correctly below.
    Design Document XML : <?xml version="1.0" encoding="ISO-8859-1"?><design-doc><title-page><title>Testing Document</title><class-prepared-for>Lloyd</class-prepared-for><authors>Ben Garbers</authors><date-created>September 23, 2004</date-created></title-page><introduction text="This is the introduction. This is the introduction."/><class-definitions><class-definition class-name="ClassOne" visibility="public" class-complexity="not complex"><global-variables><variable visibility="public" name="VariableOne" object="String" comments="This is a String."/><variable visibility="public" name="VariableTwo" object="Integer" comments="This is an Integer."/></global-variables><methods><method name="MethodOne" synopsis="This will do some things." purpose="public" visibility="public"><input-parms><variable visibility="null" name="firstName" object="String" comments="null"/></input-parms><output-parms><variable visibility="null" name="lastName" object="String" comments="null"/></output-parms><local-variables><variable visibility="null" name="age" object="int" comments="null"/></local-variables><pseudocode xml:space="preserve">/* Ensure that player name exist in the system*/
    if (player =null)
         NullPlayerException;
              if (NOT (isPlayerNameExist(player)))
                   throw PlayerNameNotExistException;
              /* Ensure player name exist in the team already*/
              i ? 1;
              while (i <= length(mPlayers)) {
                   if (mPlayers.mPlayerName != playerName)
                        throw PlayerNameNotExistInTeamException;
    this.mPlayers ? this.mPlayers - player;</pseudocode>
    However, when I do the transformation I get the following with the pseudocode:
    /* Ensure that player name exist in the system*/if (player =null)     NullPlayerException;          if (NOT (isPlayerNameExist(player)))               throw PlayerNameNotExistException;          /* Ensure player name exist in the team already*/          i ? 1;          while (i <= length(mPlayers)) {               if (mPlayers[i].mPlayerName != playerName)                    throw PlayerNameNotExistInTeamException;}this.mPlayers ? this.mPlayers - player;
    It looks like it adds some spaces but no carriage returns or line feeds.
    My transformation code is the following:
         public ParseFile(String xmlString) {
              try {
              //Here we will load the correct style sheet for the message
              //that will be formatted.
              String urlString = "DesignDocument.xsl";
              URL url = this.getClass().getResource(urlString);
              System.out.println("URL to style sheet = " + url.toString());
              String styleSheetName = url.getFile();
              System.out.println("Style sheet name : " + styleSheetName);
              InputStream styleSheetInputStream = this.getClass().getResourceAsStream(urlString);
              //We will than load our SAXParerFactory and parse the message.
              SAXParserFactory SPFactory = SAXParserFactory.newInstance();
              SPFactory.setValidating(true);
              SAXParser sp = SPFactory.newSAXParser();
              XMLReader sax2parser = sp.getXMLReader();
              //NO Validation done on for this because we do NOT have a DTD.
              sax2parser.setFeature(
                   "http://xml.org/sax/features/validation",
                   false);
              sax2parser.setContentHandler(new FileContentHandler());
              //we create a character array of the length of the xml message String
              char[] messageCharacterArray =
                   new char[xmlString.length()];
              // we then put the xml string into the character array.
              messageCharacterArray = xmlString.toCharArray();
              // after this ew end up creating a CharArrayReader that will be used by the Sax
              // parser to parse the xml.
              CharArrayReader xmlCharArrayReader =
                   new CharArrayReader(messageCharacterArray);
              // we put the xml character array within the Input Source which will then be parsed
              // by the Sax2 parser.
              InputSource in = new InputSource(xmlCharArrayReader);
              // Use a Transformer for outputting the message into our formatted xml using
              // the stylesheet defined up in a messages own sxl stylesheet file.
              TransformerFactory tFactory = TransformerFactory.newInstance();
              tFactory.setURIResolver(new BasicURIResolver());
              StreamSource stylesource = new StreamSource(styleSheetInputStream);
              Transformer transformer = tFactory.newTransformer(stylesource);
    //          transformer.setOutputProperty(OutputKeys.INDENT, "yes");
    //          transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
    //          Properties properties = new Properties();
    //          properties.setProperty("indent", "yes");
    //          properties.setProperty("{http://xml.apache.org/xslt}indent-amount", "2");
    //          transformer.setOutputProperties(properties);
              // We will use a ByteArrayOutputStream to put our transformed xml.
              ByteArrayOutputStream bos = new ByteArrayOutputStream();
              StreamResult result = new StreamResult(bos);
              SAXSource source = new SAXSource(in);
              transformer.transform(source, result);
              String s = bos.toString();
              StringBuffer sb = new StringBuffer();
              //This will make sure the Version Line is not shown.
              BufferedReader br = new BufferedReader(new StringReader(s));
              String line = "";
              while ((line = br.readLine()) != null) {
                        sb.append(line);
              bos.close();
              br.close();
              formattedXmlString = sb.toString();
              System.out.println("--------------------------------");
              System.out.println(formattedXmlString);
              System.out.println("--------------------------------");
              } catch (Exception e) {
                   e.printStackTrace();
    I have been searching and trying to figure this out forever. Any help would be greatly appreciated. Bottom line is that I want carriage returns and tabs to work when transferring from the xml to xsl.

    I get the following line when adding the <pre> tags.
    /* Ensure that player name exist in the system*/if (player =null)     NullPlayerException;          if (NOT (isPlayerNameExist(player)))               throw PlayerNameNotExistException;          /* Ensure player name exist in the team already*/          i ? 1;          while (i <= length(mPlayers)) {               if (mPlayers[i].mPlayerName != playerName)                    throw PlayerNameNotExistInTeamException;}this.mPlayers ? this.mPlayers - player;
    On the screen this is shown on 1 line. It looks like the tabs are working correctly. However, the carriage return, line feeds do not seem to be working. The xml that is pushed into the transformation has the carriage returns and line feeds and is formatted correctly. There has to be something happening when the xsl takes the xml String. When I add <BR></BR> within the xml that doesn't seem to work either.
    I am really sumpted. If you could help DrClap I would really be appreciated.

  • How to protect a text from line break in smartforms

    Hi Gurus,
    How to protect line break in a text element of smartforms. Text in that line is printing exactly 70 characters. I want the text to be printed fully till the size of the window.  How to stop this automatic line break.
    Regards,
    Rithika.

    What I have done may be helpful, so here are the details:
    I had a table of text values, so I converted this to a string with concatenate, then string to a long character field, then used RKD_WORD_WRAP to put into table of 132 characters.  Then I constructed a table of type tline by looping at my RKD_WORD_WRAP output,  and utilized SAVE_TEXT to temporarily store a TEXT entry, like you would save with SO10, saving my desired paragraph format into TDFORMAT field and inserting any necessary character format commands into the text. 
    In my SmartForm, I then have dynamic text processing pointing to the internal table fieldnames containing tdname, tdid, tdobject, tdspras of what I saved.  This allows SmartForms to utilize the full width of the window and optimize text output, based on window width, font, scale, paragraph format, character format, etc.  These text identifier values are passed as part of my internal table via the SmartForms interface.
    At the end of SmartForms processing, I loop at my internal table and utilize DELETE_TEXT to remove the temporary texts that I created for this set of output.
    To avoid page breaks in my text, I put my output for a "block" of data into a folder (see the SmartForms folder feature).  I have page protection on the folder...that way, SmartForms examines the length of the folder content and decides whether a page break should occur before any output for my block of data begins.  My block of data contains a few data elements over 5 rows of output followed by two separate dynamic texts of various lengths.  If the entire block won't fit on the remaining part of a page, page-break occurs first.

  • How to get a line break

    Hi All,
    How do I get a line break within a particular field?
    My DB structure is that I have 4 columns address_line_1, address_line_2 and so on. I cannot select them as different fields because all of them can be null, in which case i pick it from internal_address_line column.
    I use:
    SELECT DECODE(address_line_1, NULL, internal_address_line, address_line_1 || ', ' || Address_Line_2) as ADDRESS
    But instead of th comma separating the 2 address lines I want a line break so that 2 address lines come in 2 separate lines in the output.
    It doesn't allow me to use chr(10) as a line break and gives an error
    I'm using Reports 2.5
    TIA
    Naveen

    Yes, true.
    How about setting up the sections as:
    Section 1 Introduction ('Section num space introduction' in this example - tab may be better)
    Then generate the Contents.
    Then do a GREP find/change on the document after the contents:
    This will add a forced line break and tab after each section number... You might want to specify a para style in the Find Format box too, so that references to Section xx in body text are not altered.
    If you update Contents after this, you will get the line break and tab in the Contents too.

  • Missing line breaks with Excel

    Hello,
      Am downloading certain into Excel using BSP. I am changing response mime type to "application/vnd.ms-excel" and am sending tab-demilited string as data.
      Some of the columns should contain line break within the cell( Mean the Alt-Enter in Excel cell ). I tried using the character code 10 and also 13 for the break. But it did not work.
      How do I cause a line-break in the Excel cell? Any work-arounds??
    Thanks.
    Srinivas.

    Hi Srinivas,
    I think you don't have the possibility to add line breaks into a tab seperated file. You rearly had to create an excel file. Unfortenately AFAIK this is not possible in ABAP. I've done this in PHP using the <a href="http://pear.php.net/package/Spreadsheet_Excel_Writer">Spreadsheet_Excel_Writer</a>.
    Regards
    Gregor

  • ICal 5.0 inserting a line break (Lion)

    With iCal v4 (Snow Leopard 10.6) one could insert a line break within an event by typing ALT+return.
    This functionality seems to have disappeared with iCal 5.
    Has anyone else noticed this? Is there a workaround?
    Many thanks!

    I'm considering 'busycal' although I feel like a shill paying $50 for it. Please do update this if you find a solution or try another app that works well for you.  Cheers, J

  • Strange line breaks in Apple Mail

    OK, first of all, I'm not talking about quoted text (f=f or format=flowed), at least I don't "think* I am.
    I keep encountering strange, unpredictable extra line breaks - or at other times the lack thereof - when composing email. I can't see a pattern to it, very frustrating, so I think the problem only occurs when I reply to or forward someone else's email, not starting fresh.
    When I reply to an email - and even if I Select All text and remove all quoting (Option-Command-' as many times as necessary), I often see linespacing too tall between some lines. Even if I concatenate the two sentences and enter my own carriage return, there still is too much space between the lines. Then after I send the email and look at the message from my Sent box, there is no line break whatsoever where I thought I forced one. Or other times there are multiple linebreaks. Aaarrgghh!
    So my workaround has been to copy & paste my bodytext into Apple TextEdit, then turn right around and copy it from there and paste it into a brand new email message. (If I delete all the text from my original email reply and paste it there, sometimes the weird line breaks still occur.)
    It doesn't seem to matter whether I change my offending email reply or forward message from Rich Text to Plain Text; the problem still occurs.
    Is there some Mail preference setting I can change to avoid this convoluted and infuriating procedure?

    Bump.
    Are these phantom extra line breaks and vanishing line breaks not occurring to anyone else?
    In Mail Preferences > Composing > Responding > Quote the text of the original message
    ...I tried disabling (unchecking) it, but it doesn't make much difference. Again, the problems occur in the body of a
    Message > Reply
    ...not a newly-created message. I've even pasted the body text into TextWrangler and done a "Zap Gremlins" and "Remove Line Breaks," but after I paste it back into Mail and reset my line breaks like I want, I still get extra and/or removed line endings when I review my sent message.

Maybe you are looking for

  • Is there a way to create a list in a new sheet based on a value within an entry on the first sheet?

    I have a list of DVDs in one sheet which are categorised etc. as well as having true/false checkboxes to mark whether they have been watched. Is there a way of populating a second sheet only with the rows that are marked "FALSE" in the "Watched" colu

  • Finding then combining content from several indesign documents in one document

    Hi everyone, I wonder if someone can help... I'm trying to write scripts for indesign server which I want to: a) search for, b) pick out, then c) put together content from one or many indesign documents into a template on the server starting at a pre

  • MRN PRINTOUT PROBLEM

    HI GURUS CAN ANY ONE TELL ME WHILE WE CREATING MRN WITH REFERENCE TO ASSET PO AND TAKING PRINTOUT OF MRN USING TCODE MB90 WE SEE THAT THERE IS ADDITIONAL AMOUNT FIELD AND SYSTEM ARE SHOWING SOME VALUE IN THAT FIELD WHICH IS NEGATIVE CAN ANY ONE HELP

  • Lvwutil32 & TS4.x with LV8.5 RTE

    Hi, I am trying to complete a TS4.0.1 + LV8.5.1 RTE deployment that uses functionality within the lvwutil32 utilities. Everything if OK with LV8.5.1 development environment but TS+LV crash out when I change over to the RTE. I believe this is because

  • Library assests missing in Encore CS5

    The whole Library section is coming up empty, any suggestions as to where I could find the files to attempt a reinstall? The main problem I have is that everything has to be installed through our IT department and they seem to be baffled by anything