whitespace

Is it "bad practice" to be sensitive to linebreaks in XML documents?

I'm generating some XML documents and when it comes to the address part I have fragments that look like this: <Address>15 Sample St Example Bay Some Country</Address> The XSLT that I have for converting this to XHTML has some funky recursive template to convert newline characters within strings to <br/> tags. This is all working fine...

ant build.xml windows white space in path

I'm using Windows and I'm trying to get ANT to work. When I do an ant build from the command line, I get: C:\dev\Projects\springapp\${%ANT_HOME%}\lib not found. I look into the build.xml file and I find: appserver.home=${user.home}/apache-tomcat-6.0.14 (which I just copied and pasted straight from a tutorial) I changed it to: appserve...

lining up function parameter lists with vim

When defining or calling functions with enough arguments to span multiple lines, I want vim to line them up. For example, def myfunction(arg1, arg2, arg, ... argsN-1, argN) The idea is for argsN-1 to have its 'a' lined up with args1. Does anyone have a way to have this happen automatically in vim? I've seen the align p...

How well does Python's whitespace dependency interact with source control with regards to merging?

I'm wondering if the need to alter the indentation of code to adjust the nesting has any adverse effects on merging changes in a system like SVN. This is a really open ended question. I'm sort of fishing for information/anecdotes here. Edit: Thanks all! I'd accept an answer but which one? I up moded them all. ...

Painless way to trim leading/trailing whitespace in C?

Is there a clean, preferably standard method of trimming leading and trailing whitespace from a string in C? I'd roll my own, but I would think this is a common problem with an equally common solution. ...

How To Removing Trailing Whitespace Of All Files Recursively?

How can you remove all of the trailing whitespace of an entire project? Starting at a root directory, and removing the trailing whitespace from all files in all folders. Also, I want to to be able to modify the file directly, and not just print everything to stdout. ...

Converting XML to plain text using XSLT -- how should I ignore/handle whitespace in the XSLT?

I'm trying to convert an XML file into the markup used by dokuwiki, using XSLT. This actually works to some degree, but the indentation in the XSL file is getting inserted into the results. At the moment, I have two choices: abandon this XSLT thing entirely, and find another way to convert from XML to dokuwiki markup, or delete about 9...

Is there a Perl-compatible regular expression to trim whitespace from both sides of a string?

Is there a way to do this in one line? $x =~ s/^\s+//; $x =~ s/\s+$//; In other words, remove all leading and trailing whitespace from a string. ...

Interpreting newlines with XSLT xsl:text?

I have an XSL stylesheet with content in an xsl:text node like this: <xsl:text> foo bar baz </xsl:text> The stylesheet itself is a text file with "unix-style" newline line terminators. I invoke this stylesheet on Windows as well as unix-like platforms. It would be nice to have the output conform to the conventions of the platform on w...

Can CVS and Subversion be set to ignore whitespace in merging?

CVS and Subversion both have a handy merge feature so that when you update a source file that you have modified, it merges in changes that others have made on the same file. However, if your changes and the other ones are incompatible - generally if you have both changed the same parts of the code - it will create a conflict. Both stret...

Preserve white space in string with XmlTextWriter.WriteString

I am writing an XML document in C#. I have something like this... string output = "REAPP DUE NO OF M CASE NBR APPL NBR DATE GRPS M CASE NBR APPL NBR DATE GRPS _ _ _"; and I do this... objXmlTextWriter.WriteStartElement("Case"); ...

Strip whitespace from jsp output

How can I strip out extra whitespace from jsp pages' output? Is there a switch I can flip on my web.xml? Is there a Tomcat specific setting? ...

Javascript Removing Whitespace When It Shouldn't?

I have a HTML file that has code similar to the following. <table> <tr> <td id="MyCell">Hello World</td> </tr> </table> I am using javascript like the following to get the value document.getElementById(cell2.Element.id).innerText This returns the text "Hello World" with only 1 space between hello and world. I MUST kee...

How do I split a string with any whitespace chars as delimiters?

What regex pattern would need to pass to the java.lang.String.split() method to split a string with all whitespace characters (' ', '\t', '\n', etc.) as delimiters? ...

How to ignore whitespace while reading a file to produce an XML DOM

Hello, I'm trying to read a file to produce a DOM Document, but the file has whitespace and newlines and I'm trying to ignore them, but I couldn't: DocumentBuilderFactory docfactory=DocumentBuilderFactory.newInstance(); docfactory.setIgnoringElementContentWhitespace(true); I see in Javadoc that setIgnoringElementContentWhitespace meth...

How do I make JSP tag files NOT ignore all whitespace?

I'm really stumped on this one. I want to output a list and have the tag file take care of commas, singular versus plural, etc. but when I display the list it completely ignores whitespace so everythingrunstogetherlikethis. I tried using the HTML entities "thinsp", "ensp" and "emsp" (I can't use "nbsp", these have to be breaking), but th...

Preserving attribute whitespace in XSLT

Disclaimer: the following is a sin against XML. That's why I'm trying to change it with XSLT :) My XML currently looks like this: <root> <object name="blarg" property1="shablarg" property2="werg".../> <object name="yetanotherobject" .../> </root> Yes, I'm putting all the textual data in attributes. I'm hoping XSLT can save ...

Inconsistent Whitespace Text Nodes in Internet Explorer

The following source code alerts the following results: Internet Explorer 7: 29 Firefox 3.0.3: 37 (correct) Safari 3.0.4 (523.12.9): 38 Google Chrome 0.3.154.9: 38 Please ignore the following facts: Webkit (Safari/Chrome) browsers insert an extra text node at the end of the body tag Internet Explorer doesn't have new lines in the...

How do I make Emacs show blank spaces?

How can I make Emacs show blank spaces (like a space, a tab, a line-jump, etc). Many other editors like Kate and Eclipse have this feature and I find it very useful to see when code is indent-broken because of mix of spaces and tabs (particularly Python). ...

Display string with whitespace in ASP.NET?

I need to display a string which has a white space on a asp.net page. **Here is what I am doing:** cell = New TableCell cell.Text = value (lets assume value is <" test with whitespace "> row.Cells.Add(cell) and it gets rendered as " test with whitespace " whitespaces within single quotes are not displayed. I want thi...