Masses of white space, how to get rid of it?

Hi every body.
Im reading in an XMl file, changing a few values then printing it back to the same file. But everytime I read it in and print it back, its putting a blank line after every other line. So if I read in a file that looked like this:::
<record>
     <lesson_id>01</lesson_id>
     <lesson_title>title 0</lesson_title>
     <max_time_allowed>000:000</max_time_allowed>
     <time_limit_action>tla</time_limit_action>
     <launch_data>this is the launch data</launch_data>
     <description>d</description>
     <mastery_score>2003</mastery_score>
     <file_href>here</file_href>
</record>
After I cange some values and print it back it would look like this::::
<record>
     <lesson_id>01</lesson_id>
     <lesson_title>title 0</lesson_title>
     <max_time_allowed>000:000</max_time_allowed>
     <time_limit_action>tla</time_limit_action>
     <launch_data>this is the launch data</launch_data>
     <description>d</description>
     <mastery_score>2003</mastery_score>
     <file_href>here</file_href>
</record>
Then after I read it in again and printed it back it would then look like this::::
<record>
     <lesson_id>01</lesson_id>
     <lesson_title>title 0</lesson_title>
     <max_time_allowed>000:000</max_time_allowed>
     <time_limit_action>tla</time_limit_action>
     <launch_data>this is the launch data</launch_data>
     <description>d</description>
     <mastery_score>2003</mastery_score>
     <file_href>here</file_href>
</record>
The more time I read it in the more spaces are inserted. How can I stop this from happening?
I read it in like this....
java.io.File file = new java.io.File(profileFileName);
XmlDocument doc = null;
doc = XmlDocument.createXmlDocument(file.toURL().toString(), false);
NodeList list = doc.getElementsByTagName("table");
And print it back like this.....
doc.normalize();
doc.write(new java.io.FileWriter(profileFileName),"ISO-8859-1");
All help appreciated.
Thanks

Hi ok I found this some where on http://www.javaalmanac.com
try {
// Prepare the DOM document for writing
Source source = new DOMSource(doc);
// Prepare the output file
File outPutFile = new File(FileName);
Result result = new StreamResult(outPutFile);
// Write the DOM document to the file
Transformer xformer = TransformerFactory.newInstance().newTransformer();
xformer.transform(source, result);
} catch (TransformerConfigurationException e) {
} catch (TransformerException e) {
It prints to the file ok even though it print it like this <tag><anotherTag></anotherTag></tag>
rather than
<tag>
<anotherTag>
</anotherTag>
</tag>
But that doesnt matter as it saves file space.
BUT
now I have another problem ...
After about 10 records have been added the program slows dowm and its gets slower and slower and slower. Obviously its coz the fiels getting bigger and bigger. At which point does it get slower and why. Is it the printing bit that gets slower or the reading in. Are there faster ways to parse a document, which is the fastest parser?
Sorry for all the questions, im not being lazy. I tried to tackle these problems long time ago but ended up using a database, now I want to try again but Im restricted by time.
Anyways cheers all.
G

Similar Messages

  • Scatch on macbook white. HOw to get rid?

    My macbook gets scatched very easily. A week,and it got like 15 scatch marks, its easy to see it when you are next to light. So is there any way to get rid of it?

    you might wanna try this...
    take a dry, soft piece of cloth (note: DO NOT USE TISSUE PAPER, YOU'LL END UP WITH MORE SCRATCHES) and squeeze some toothpaste on it, yes, toothpaste. just regular ones will do.
    start polishing on your macbook cover in a circular motion. polish about 5-10 minutes or even longer if you wish.
    the reason for using toothpaste is that it is a mild abrasive, and it would get the minor scratches out. the deeper ones you gotta try something else.
    hope this helps! i've used this method to polish my iPod and my MacBook as well. works like a charm, and really cheap compared to iDrops!

  • IPhone needs space / how to get rid of other

    There is too much "other" on my iPhone. In the past I've done a reset (at least I think that's what it was called). It was not too hard but a bit nerve racking. Is there an easier way to clear out other?
    Thanks.         

    Check out this great User Tip from Kappy:
    What is “Other” and What Can I Do About It?

  • How to get rid of white space in EPS embedded in Word for letterhead template?

    Does anyone know how to get rid of the white band in the bottom of this letterhead?
    I embedded the EPS image (done via Illustrator) as a watermark in the header section of MS-Word.
    It looks fine in the Word version, but as soon as I try to print the document - either via Word or via a PDF - that white
    band on either side of the footer and underneath it keeps showing up. I can't get rid of it. I tried this on a PC and a Mac
    and those white bands won't go away.
    If anyone could let me know how to resolve this problem, I would be eternally grateful!
    Thank you.
    NZB

    If you want this to bleed, then you will have to print on oversize paper and trim or find a printer that will print borderless.

  • Printing Docs - how to get rid of 3 inch wasted space on right side of page

    I tried to print out : Communicating With Objects
    http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaFunda mentals/CommunicatingWithObjects/CommunicateWithObjects.html
    After trying several different settings and printed only the first page until I got the print more or less the way I wanted it, however...
    I have a standard HP Color Laserjet 2600n, looked at all the printing preferences, and all four margins are set at (.25 inch), yet when the pages print out there are about 2.5 inches of wasted space on the left side. The space is there for the Table of Contents, but there is nothing printed there, the space is blank.
    So I clicked on the Table of Contents header, so the TOC became hidden and the window only contained the text and images, then when I tried to print, I found that now there were about 3 inches of white space on each page on the right hand side. This is somewhere around a 40% waste in paper, trees, etc.
    One would think that expensive as printing is, there would be a way to save paper by optimizing coverage on each page as much as possible.
    Another curious thing is that the size of the text on the screen is easy to read at Safari normal (default) settings, yet when the first page is printed the text is really small.
    In order to get the size of the print on the paper to be easily readable, I had to click on the large [a][A] at the top of the Safari window twice (+ 2 sizes). The text on the window was fairly large, but the print became easy to read. There was still an excessive amount of wasted space, which just goes against the grain...
    Does anybody have a clue how to get rid of all the wasted space on each page ? There has to a simple way, this is 2010 and we've been doing this for 25+ years now.
    I am sure it is something simple that I am overlooking ? I'd be grateful for any help.
    Thank You,
    Bill Hernandez
    Plano, Texas

    What browser are you using? Try downloading a PDF if one is available, or try printing from XCode's Deveoper Documentation window.

  • On iTunes when i plug my iphone in, the bar at the bottom with contains the information about the capacity of my iphone, it has a bar called 'other' which has 4GB. I don't know what is taking up that space or how to get rid of it. please help :)

    On iTunes when i plug my iphone in, the bar at the bottom with contains the information about the capacity of my iphone, it has a bar called 'other' which has 4GB. I don't know what is taking up that space or how to get rid of it. please help

    You can reduce the size to normal, which is about 1GB, by restoring the phone.
    Backing Up, updating, and restoring your iPhone and iPod touch software
    The size of this part can increase when something goes wrong during a sync, or some files can't be read anymore by iTunes.

  • Having 200+ GB of "Other" Space in HD.. How to get Rid of it?

    So I have 200 GB of other in my storage and Ive tried OmniDisk to get rid of stuff but nothing is making it have more space. Anyone have any other ideas to how to get rid of all this other space?

    Freeing Up Space on The Hard Drive
      1. See Lion/Mountain Lion's Storage Display.
      2. You can remove data from your Home folder except for the /Home/Library/ folder.
      3. Visit The XLab FAQs and read the FAQ on freeing up space on your hard drive.
      4. Also see Freeing space on your Mac OS X startup disk.
      5. See Where did my Disk Space go?.
      6. See The Storage Display.
    You must Empty the Trash in order to recover the space they occupied on the hard drive.
    You should consider replacing the drive with a larger one. Check out OWC for drives, tutorials, and toolkits.
    Try using OmniDiskSweeper 1.8 or GrandPerspective to search your drive for large files and where they are located.
    What is "Other" and What Can I Do About It?- Apple Support Communities

  • My iPad air has 32 gb, but I am down to about 3 gb.  What should (and how) I get rid of to free up space?

    My iPad air has 32 gb, but I am down to about 3 gb.  What should (and how) I get rid of to free up space?

    Are there apps you don't need or use? Delete them.
    Is there content you've downloaded from iTunes that you can delete (as long as it's available in iTUnes, you can redownload any previously purchased content)
    Do you have any large e-mails in your mailbox? Such as mails with photos.
    Do you have photos that you don't want or need anymore?
    Settings, general, usage can tell you how much space apps are taking up and that can help you choose what needs to go, what's part of the problem, etc.

  • How to Get Rid of White Stripe At Top of Firefox Browser

    I have the current version of Firefox installed. Recently, perhaps with the most recent install, I'm not exactly sure, a white stripe appeared at the top of the browser, right under the search and URL boxes at the top of where websites would normally show, a white stripe about a 1/2 inch thick has appeared. Not on every single site, google.com works fine, but for example, it blocks out the home, connect, discover and me tabs on Twitter. Or if you go to mozilla.com, the tabs at the top of the mozilla site briefly show, then are blocked by the white bar. You can't click on any of them, even if you have your mouse pointed at the right spot. You can refresh the screen and they'll briefly show again, but not long enough for you to click on anything.
    I've run a number of search engine queries trying to find out how to get rid of this problem, but I'm only finding resolutions for webmasters, not for end users who have to deal with this problem on the other end of the browser.
    Anyone know how to get rid of this nuisance? I'm about ready to uninstall Firefox because its useless on many sites with buttons and tabs on top.

    I shut down all but one of the extensions, and that seems to have resolved the problem. Thank you!
    Now to figure out which extensions I need, and which I don't, because I don't have a clue. I don't remember installing most of these, I only recall one or two (nothing looks spammy like funmoods, but still don't remember when or why these were added...)

  • My 2nd generation Nano indicates that about half of the space is 'other'. Anyone know what that means and how I get rid of it? All I've ever downloaded is music.

    My 2nd generation Nano indicates that about half the space is 'other'. Anyone know what that means and how I get rid of it? All I've ever downloaded is music.

    gomeznoles wrote:
    My 2nd generation Nano indicates that about half the space is 'other'. Anyone know what that means and how I get rid of it? All I've ever downloaded is music.
    The Other data on your iPod is album art, file allocation structures, your main library file, and any other data that the iPod uses to read its songs. 
    You can have it removed by going to your itunes and plugging your ipod back into it.   Click the device then click the music tab then uncheck box that says include album artwork.. then sync again.. this time the OTHER stuff will now be removed.

  • Just upgraded iPhone 3GS to IOS5. Now there's 21GB of Others.  How to get rid of it?  It's taken up all the space on the phone.

    Just upgraded iPhone 3GS to IOS5. Now in itunes I can see there's 21GB of Others.  I have no idea what is that.  I didnt have that before the upgrade. How to get rid of it?  It's taken up all the space on the phone.

    I posted a fix for this temporary issue earlier but here it is in short:
    The memory "hog" that is "others" seems to be the OS as it's installing. It seems to want more than 12GB and you may get stuck at the point where iTunes tries to load everything back on and the iPhone has run out of space. What you need to to is un-check the "sync" box at the apps, music, podcasts and other sections, then click the button to sync iTunes with iPhone. This will result in iTunes deleting all the data it restored, but you'll put it back later. Once you caused the deletion of most of the data, iOS5 will resume installing and then "magically" shrink to less than 1GB. Then you can place check marks back in the boxes and re-sync all your apps and other data. You will have plenty or memory left.
    I followed the above procedure and my iPhone works perfectly.
    Hope this helps.

  • White line appears on jpeg export in indesign CS6? How to get rid of the same?

    White line appears on jpeg export in indesign CS6? How to get rid of the same?

    Please find attached actual jpeg and the screen shot of settings at which the jpeg is exported.

  • Can anyone tell me how to get rid of the white stripe?

    There is a narrow white stripe just above the container on this site and I can't figure out how to get rid of it. Do you know? http://lowellforte.com/
    It doesn't appear above the right sidebar which is yellow right now. Thank you.

    You could also try positioning the image using a code like this:
    body {
        background-image: url('http://lowellforte.com/images/1264xindex.jpg');
        background-position: 1264px 963px;
    Change the dimensions to suit your style.  963px is chosen here because the stripe is about 5px give or take 1px either side.

  • How to get ride of a black space box on screen

    how to get ride of a black floating text box from the computer.

    Turn off VoiceOver in the Universal Access or Accessibility pane of System Preferences.
    (88073)

  • How to get rid of 'other' data

    I have masses and masses of 'other' data on my iphone. I have stripped it of all music (500 songs) and it has made no difference. I understand the data is most likely old apps etc not deleted properly, like a ghost trail. I have deleted all unnecessary texts, voicemails, calls, photos, internet history, etc. I have nothing left to delete data-wise. Does anyone know how to get rid of this 'other' data? It was literally taking 6.8gb of my 8gb phone, i have halved that by checking and unchecking 'automatically sync' in itunes, but still can't shift the rest. Really slowing my phone down

    Most of the "other data" on my phone is the forced IOS 7 upgrade from Apple.
    They push the upgrade(around 850 mb) and also reserve another huge chunk of space on the phone  to do a backup and install on the phone (mine is about 2.5 gigs after some manipulation).
    If you do not want the upgrade, it just sits there on the phone.
    You can not remove it.
    Apple will not sign and allow you to restore IOS 6 to your IOS 6 phone.
    If you ever need to do a restore of the OS, you will be forced into IOS 7.
    When a new upgrade is pushed to your phone, the amount of confiscated storage will accumulate with each subsequent release.
    Apple can't be bothered to delete the older/outdated upgrade file being replaced by the new, hence the "other data" just grows over time. I have seen mine get to almost  6 gigs.
    You can use Itunes on your computer to "download only/ not install" the newest update, then do a restore of your data and a sync. This appears to remove all the outdated updates from the phone.
    You will however, still have about 2 gigs of your storage space still hijacked by Apple to store the most recent forced upgrade.
    I am still on IOS 6 and plan on sticking with it simply for personal preference and vision reasons, as that is my prerogative.
    It does perplex me why Apple refuses to make IOS 7 optional for users that have always had IOS 6. I can fully understand insisting that new devices run IOS 7, and obviously many IOS 6 users would have jumped anyway.
    Apple needs to add an asterisk to word *adoption rate of IOS 7 in their corporate guidance statements.
    They knowingly mislead given the current reality that ultimately no one can opt not to adopt it.
    Hotel Cupertino, "You can check out, but you may never leave"

Maybe you are looking for

  • Apple loop not responding to tempo changes

    apple loops that have been created from an audio file in the arrange window do not respond to tempo changes. when i had logic 7 there would be a change in the audio file from an audio to an apple loop icon. this is not happening w/ logic 8 although i

  • Gettin error in msg monitoring --webservice to idoc

    Hi all, While sending the data from webservice to Idoc I am gettin error like this. <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> - <!--  Call Adapter   --> - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schema

  • Hi Need Urgent

    Hi Guru's, I have a table T1 with fields A,B,C,D,E,F.  A and B are key fields.I have table maintanace for this through which I can change values of C,D,E,F. Requirement.. I do not want to use the table maintanace instead i need to pass A,B in selecti

  • Syntax error on token "class", invalid Expression

    Hai, i am new to java beans and i have written the following code which gives an error Code jsp: <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Tra

  • Where to download Acrobat 9 Standard? [was: Is there a support person for adobe out there?]

    Is there a support person for adobe acrobat out there? I don't understand this community idea?