How to remove the empty lines in the generated XML?

Hi, XML/JDOM experts,
I used JDOM to generate an XML file in my exercise of comparing two xml files.
I used a lot of times addContent()...
The resuting xml is fine for its contents.
But I don't like so many empty lines (or carriage return).
Would you help to refine the result?
Best regards,
AG
Sample results:
<li delta:property="Modified">
<code delta:property="Modified">
<delta:NewValue>foreignObject</delta:NewValue>
<delta:OldValue>text</delta:OldValue>
</code>
<svg xmlns="http://www.w3.org/2000/svg" width="6cm" height="45px" delta:property="Removed">
<rect y="0" x="27px" width="110px" height="45px" style="fill: #C1FFFF" />
<foreignObject width="120px" y="0" x="20px">
<div xmlns="http://www.w3.org/1999/xhtml">
<ul>
<li>First item</li>
<li>Second item</li>
</ul>
</div>
</foreignObject>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="9.5cm" height="1.2cm" delta:property="Added">
<text y="33px" x="13px" style="font-family: helvetica; font-size: 14pt; fill: #FFAA00">A simple
text in SVG
</text>
</svg>
</li>

The solution is to add
outputter.setTrimAllWhite(true);
Below is the sample code.
     FileOutputStream out = new FileOutputStream("delta.xml");
     XMLOutputter outputter = new XMLOutputter(" ", true, "UTF-8");
     outputter.setTrimAllWhite(true);
     outputter.output(doc1, out);
     out.close();

Similar Messages

  • How to show an empty line at the end of a ParagraphView

    Hi everybody,
    I wonder if anyone knows how to extend ParagraphView to show an empty line at the end of every paragraph?
    Thanks in advance,
    mrai

    I tried to use that class and couldn't get it to work.
    JTextField field = new JTextField();
    field.setText("blah blah");
    CompisiteView view = new ParagraphView(field.getDocument().getRootElement());
    int views = view.getViewCount() //always zero...

  • How to remove the blank lines at the end of the JTextArea .

    Hi,
    I need to remove the blank lines in the JTextArea at the end. Suppose i am giving 'A' in the first line and press the enter key two times, after i am giving the 'B' in the third line and press enter key for two times. I need to remove, the last two lines of JTextAreae, . How i can remove these lines?

    String#trim() removes all whitespace from both ends of the String.
    The requirement was to remove line breaks from the end of the String only.
    String#replaceAll with a suitable regex would do the trick. Untested regex for this:text.replaceAll("[\\n\\r]+$", "")db

  • Removing the empty line during Receiver FCC!

    Hi, Guys,
    I used file content conversion in receive FCC. My data type is like this:
    <TextFromSAP_DT>
    <FileName>
      <FileName>abc.txt</FileName>
    </FileName>
    <Record>
      <TEXT>dasfafaf</TEXT>
    </Record>
    <Record>
      <TEXT>qqqqqqqq</TEXT>
    </Record>
    <Record>
      <TEXT>fgfffff</TEXT>
    </Record>
    </TextFromSAP_DT>
    I need to get file name from <FileName> and output a flat file with the value in <TEXT>. But I always got an empty line at the file beginning. And I tried to move <FileName> to the end. And I got an empty line at the file end. My custom said they are having trouble to read the file with the empty line no matter it is in the beginning or end.
    I followed sample as link below but does not work. 
    https://wiki.sdn.sap.com/wiki/display/profile/2007/07/30/Removing%20the%20empty%20line%20during%20Receiver%20FCC!
    Does any body can give a help?
    Thanks a lot!
    Meiying
    Edited by: Meiying Yang on Aug 14, 2009 11:16 PM

    Hi Yang,
    You create the value udf GetFileName with one input value say a. Add this code:
    Imports: java.*;
    Add this code:
       //write your code here
    DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http:" + "/" + "/" + "sap.com/xi/XI/System/File", "FileName");
    conf.put(key, a);
    return "";
    Map like this:
    FileName --> GetFileName(udf) --> target_mt
    Map other fields like:
    Record --> Record
    TEXT ---> TEXT
    Save it and activate it. When you test in mapping you will get an error so dont worry. I go the error like:
    RuntimeException in Message-Mapping transformation: Runtime exception during processing target field mapping /ns0:Target_MT. The message is: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._TestFileName_ method file1$[abc.txt, com.sap.aii.mappingtool.tf3.rt.Context@32dcebf1]
    Dont worry about this activate and do the rest of the configuration.
    In your receiver communication channel for file name put as FileName and check the file name in adapter specific message attributes. Then test it and it should work and you will get the file with file name abc.txt. I tested the whole end to end scenario and I am getting the file name abc.txt and the output what you want. If you still could not get it send me a m ail to my i d from my business card. I will send you the screen shots.
    Regards,
    ---Satish

  • Remove the dotted line in the image map

    dear all, i would want to know how to remove the dotted line
    of the image map, for my case, i cannot see the dotted line in IE
    but can see the line in firefox, (in my boss computer, he can see
    the dotted line in both IE and firefox)
    i have try some method such as using the component of
    Remove
    IE Link Scrubber by PVII. while i find it is not work. could
    any one give some suggestion for me to remove the dotted link of
    the image map or give me some ways that other than using map.
    thx a lot !!!!!!!!

    i have find a way to solve the problem of the dotted line in
    the image map
    e.g. <map name="123" >
    <area style="cursor: hand" shape="circle"
    coords="223,261,76"
    onClick="checkit('m_strategic/m_strategic.cfm')"></map>
    the checkit() method is just to redirect the page into other
    page only.
    however another problem is face, the cursor will not change
    to hand when i point to the image map, i have try adding
    onMouseMove="this.style.cursor=hand" on the <area> tag
    however it don;t work, it only work when i put into the <img>
    tag. can any one tell me how to change the mouse cursor in this
    situtation??
    thx a lot

  • When capturing video; how do I get rid of the green lines at the bottom of the frame?

    When capturing video; How do I get rid of the green lines at the bottom of the frame?

    s.haider
    You have Canon ZR950 mini DV Camcorder, why not make a firewire connection and do DV data capture into the Premiere Elements 8.0/8.0.1 Capture Window?
    Do you have any reference for what you are attempting to do or is this a creation of your own? Could you confirm what you describe as "just capturing video".
    a. From your information, you are doing Get Media/Webcam or WDM Device with the Capture Window showing the Capturing Device as "Dazzle DVD 100 Video Device". What type of connection are you making between the Canon ZR950 and the Dazzle DVD 100 and the computer?
    b. What exactly do you expect to be putting on the Premiere Elements 8.0/8.0.1 Timeline from this capture...DV AVI or something else?
    Coming from the perspective of Premiere Elements 8.0/8.0.1 known issues, I would ask you to consider:
    a. Remove the check mark next to AutoAnalyzer in the Capture window. Even if you were doing this Capture the "usual way", that is highly recommended.
    b. Go to Edit Menu/Preferences/General, and compare your results with and without a check mark next to enable GPU playback. As a cross reference, please go to Edit Header/Effects/Video Effects and detemine if there is a category of Effects named GPU Effects. Do the same thing for Edit Header/Transitions/Video Transitions and determine if there is a category of Transitions named GPU Transitions.
    And, the general drill for all users of Premiere Elements 8.0
    a. Are you working with the automatic Background Rendering and AutoAnalzyer Features turned Off?
    See Premiere Elements workspace Edit Menu/Preferences/General for background rendering option and Elements Organizer workspace Edit Menu/Preferences/AutoAnalzyer Options for AutoAnalzyer options.
    b. Are you working from the 8.0.1 Update version of the program?
    Please consider.
    We will be watching for the outcome.
    Thank you.
    ATR

  • Unable to remove the "blank" line at the end of the file

    Hi Experts,
    My requirement is to send data in 'Binary' form as an attachement to a mail address. I have followed as below.
    Converted data into Binary form using the FM 'SCMS_TEXT_TO_BINARY'
    Call FM SO_NEW_DOCUMENT_ATT_SEND_API1 to send mail.
    Until this point, all works fine and I receive a text file as well. Howvever, a blank line gets appended at the end (after last line) of the file. Please let me know, how I would get rid-off this empty line. Please refer attachment.
    Thanks in advance !

    Thanks Manish.
    I have resoved the issue, following steps have been incorporated.
    1. Find the output length of the file from the exporting parameter(output_length) of the Function module 'SCMS_TEXT_TO_BINARY'
    2. Pass the output length to DOC_SIZE component to the second line of the itab packing_list of function module 'SO_NEW_DOCUMENT_ATT_SEND_API1'.
    3. Pass the output length to DOC_SIZE component to document_data of function module 'SO_NEW_DOCUMENT_ATT_SEND_API1'.
    So there it is, the blank line is gone....
    Regards,
    Umar Ali

  • How to remove my credit card from the App Store

    How to remove my credit card from the App Store

    I used a pre-loaded credit card so when it ran out i had problems, primarily because it wont let me download or update anything until the "billing problem with the last transaction" was resolved. I dont really care if the purchase goes through but i want to be able to update stuff again and it wont give me the option to select 'none' under payment type. do i have to put another card on there just so i can "resolve the billing problem" and then i have  to take it off again or is there a way around this or is it a never ending cycle?

  • How can I print the "number lines" with the code in Visual Studio?

    How can I print the "number lines" with the code in Visual Studio?

    Hi BillionaireMan,
    What about your issue now?
    If you have resolved it, you can share the solution here, which will be beneficial for other members with the same issue.
    If you did not, please tell us more information,we will try my best to help you.
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to get rid of the reference lines on the front panel

    I forgot how I created a couple of horizontal and vertical reference lines on the front panel. It looks like the origin lines on the front panel. When I move my program to another monitor with different resolution, all the layout is messed up because of the reference lines can not change with the resolution. Did anybody meet this before? How to get rid of them?
    Attached are the 2 creen shot of front panels.
    Thanks in advanced.
    Solved!
    Go to Solution.
    Attachments:
    front panel.png ‏63 KB
    front panel2.png ‏42 KB

    You will have to click on the top menu and choose options see below
    when you do this window will pop up and you scroll down until you get to the front panel options. See below
    Tim
    Johnson Controls
    Holland Michigan

  • How do I convert a .pub file into a PDF, 2 page spread without the dotted line down the center?  I can select 2 page view and cover page in 2 page view, but the dotted line shows up.  Thank you!!

    How do I convert a .pub file into a PDF, 2 page spread without the dotted line down the center?  I can select 2 page view and cover page in 2 page view, but the dotted line shows up.  Thank you!!

    Hi skt102711,
    I would like to inform you that acrobat doesn't support .epub to .pdf format conversion. Please browse this Link for more information : Supported file formats | Acrobat, Reader
    Regards,
    Rahul

  • How to only read the last line in the text file by using BufferedReader ?

    Dear all,
    Hello, I am new to Java. Do anybody know how to read the last line (this is the last record) in the text file.The method I am now using is reading from the first line until I reach the last line in the text file. Thank you!!
    BufferedReader br = new BufferedReader(new FileReader("c:\\sdk1.4.1\\bin\\dbExport.txt"));
    DataInputStream in = new DataInputStream(new FileInputStream("c:\\sdk1.4.1\\bin\\dbExport.txt"));
    String input;
    String firstinput;
    String secondinput;
    int count=90;
    int year=1955;
    while ((input = br.readLine()) != null) {
    firstinput = input.substring(0, 10);
    secondinput = input.substring(10);
    String insertStore1 = ("INSERT INTO AUTHORS " +
    "VALUES ('" + count + "', '" + firstinput + "', '" + secondinput + "', 1955)");
    System.out.println(insertStore1);
    int result = stmt.executeUpdate(insertStore1);

    I suppose you could use a java.io.RandomAccessFile.

  • Empty lines at the end of the payload generated in FTP server

    Hi All,
    I am facing an issue in one of the use cases that I am trying to implement.
    I am getting a purchase order from one of the trading partners through Oracle B2B.
    B2B forwards this B2BM (B2B message ) to AIAB2BInterface. From AIAB2BInterface my BPEL process gets invoked, which in turn invokes the AdapterComposite which has a FTP adapter that writes the purchase order to a FTP server. PFB the end to end flow.
    PurchaseOrder from ABC trading pertner--> Oracle B2B --> AIAB2BInterface --> TestInputProvABCS --> TestInputAdapter -> Host trading partner picks up the file from FTP location
    In the ProvABCS I retrieve the actual payload from the B2BM and convert it into a string using ora:getContentasString. I am then invoking the adapter composite and sending the string as the input to FTP adapter. At the adapter composite I use a simple native schema (for validation of the input string) which has only one element PO_Info of the type string. But when the file gets generated in the FTP server there are empty lines and junk characters at the end of the file.
    Need some advice on this. Why are the empty lines coming in the end of the file? Please help!
    Thanks

    OK, I cannot figure out a way to modify the JTable (in an extended class) directly.
    So, what I did was to add a wrapper around the TreeTableModel which shows an empty row at the end.
    For those of you who are in a similar situation, the methods that I had to modify are
    public boolean isCellEditable(Object node, int column);
    public int getIndexOfChild(Object parent, Object child);
    public int getChildCount(Object node);
    public Object getChild(Object node, int i);
    These other methods are required if you are using a TreeTable instead of just a table (see http://java.sun.com/products/jfc/tsc/articles/treetable2/index.html)
    public Object getValueAt(Object node, int row, int column);
    public Object getValueAt(Object node, int row, String columnName);
    public void setValueAt(Object node, int row, int column, Object newValue);
    public void setValueAt(Object node, int row, String columnName, Object newValue);
    The signature of above methods is slightly different than the ones at: http://java.sun.com/products/jfc/tsc/articles/treetable2/src/TreeTableModel.java
    This is due to the fact that, if you want to display the serial no. (as in row number), then getValue() can just return the row number. IndexedTreeTableModel is another wrapper around the TreeTableModel which can add an extra column to display the serial number.

  • Empty line at the end of  SAP Java instance profile

    I saw this today in help.sap.com, which says that an Java instance profile must have an empty line at the end of the file, would anyone know what is it for ?
    The instance profile (/usr/sap/<SID>/SYS/profile/<SID>_<instance name>_<hostname>) u2013 this file contains settings that apply to the instance as a whole. For a Java-only installation, the file can be edited with any text editor (beware that the file must have an empty line at the end.);
    http://help.sap.com/saphelp_nw04s/helpdata/en/2e/611724f410254ca12a3f396ec5ae85/frameset.htm
    thank you
    Jonu Joy

    I have heard many "explanations" for this, but never really any solid answers.
    From experience, however, I can tell you that the SAP profiles (both ABAP and Java) will miss the last parameter if it is located on the bottom line of the file.  I have always put in two or three blank spaces at the bottom of the profiles in order to avoid this.

  • How can I put a "esc" character in the command line of the Iinstrument I/O Assistant?

    Hello
    I'm trying to prepare a VI for a device (Ultrasonic detector) connected to my RS-232 serial port, and which requires commands and enquires in the format
    The problem is very simple....since is a non printable character, how can I put it in the command line of the Instrument I/O Assistant???
    Best regards
    Massimiliano

    Hello Massimiliano,
    Thanks for contacting National Instruments.
    To answer you question, the best way to do what you are looking to do is to use the instrument I/O Assistant to generate whatever you want the code to do without the non-displayable characters, then once the Instrument I/O Assistant block is on the block diagram, then right click on the Assistant block and select to open the front panel. You will want to choose to convert it to a standard VI, which will allow you to change the code that has been auto generated. In order to add non-displayable characters to this code you follow the knowledgebase link below.
    http://digital.ni.com/public.nsf/websearch/77c8f61d36f5a23086256634005acb38
    Hope this helps!
    Regards,
    Steven B.
    Applications
    Engineering
    National Instruments

Maybe you are looking for

  • Will my HP all-in-one printer work?

    Before I drop my hard earned savings on a new 17" intel iMac, I wanted to know how I can find out if my printer will work now, or if I need to wait for drivers. I have an HP PSC-2210 all-in-one printer. It worked fine on my G3 iBook, and I have no re

  • DvD Studio Pro recently updated, not working properly

    Sometime it seems it just doesn't pay to update software. I Recently updated my OS to Tiger and along with it I updated to the latest FCP and DVD Studio pro. Now in DVD Studio Pro it will not properly read existing projects and when I build a project

  • [SOLVED] Arch Linux Guest Virtual Box OSE problem

    So I am installing my Arch Linux as a Guest in my Ubuntu partition, through Virtual Box OSE (3.2.8). I followed the wiki ( https://wiki.archlinux.org/index.php/Ar - lBox_Guest ) but still have an issue: sudo pacman -S kernel26-headers xorg gcc make s

  • Students Using iPads

    I am a Network Manager in a school.  With the recent news of textbooks being available on iPad's, we are currently looking at how feasible it would be to introduce iPads in school to replace textbooks. As our current budget would not allow the purcha

  • Opening LOVS using the keyboard

    I am trying to open a 9i LOV just using the keyboard. I have a text item with an LOV attached to it. When I tab to the item the new symbol appears (...). Is there a way of opening the LOV without clicking the mouse on this area? Many thanks. Mike