whitespace

Span with white-space style in IE (7) applied _past_ end of span

We've got an application where users can enter "notes" into a rich edit control (Telerik's RedEditor, but that doesn't matter here). We had a user enter notes from w/in Safari that had a <span></span> in the middle of the note, and that span had a style on it specifying white-space:pre The HTML of the note was in the form of: <div> This...

XmlSchema Whitespace collapse: What happens to multiple whitespaces?

I use the following XmlSchema: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.test.com/XmlValidation" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:m="http://www.test.com/XmlValidation"&gt; <xs:element name="test"> <xs:com...

Specifying Tab-Width?

Is it possible to define the tab-width when whitespace is displayed (say within a <pre> tag or something)? I can't find anything to do this with CSS, but this seems like it would be a pretty common thing to want to do. In my case, the tab width is so wide that it causes some of my code snippets on a page to be too wide. If I could someh...

Preserving "whitespace" inside tags

Is it possible to preserve whitespace inside tags? I am accessing XML nodes (containing XHTML content) in an XPathDocument using a XPathNodeIterator. Some of the tags in the nodes are not "strict" XHTML (and this is allowed in the final output of the tool). Some nodes contain image tags without the trailing space. <img src="filename.p...

How can I differentiate between 0 and whitespace in Perl?

Hello, I have the following piece of code in my program: $val = chr(someFunction()); if($val == " ") { #do something } elsif($val == 0) { #do something else } But whenever 0 is passed to $val, the if part executes instead of the elsif which I expect to get executed. How can I fix this? Thank You. ...

Remove excessive line returns

I am looking for something like trim() but for within the bounds of a string. Users sometimes put 2, 3, 4, or more line returns after they type, I need to sanitize this input. Sample input i like cats my cat is happy i love my cat hope you have a nice day Desired output i like cats my cat is happy i love my cat hope you have...

How do I get Visual Studio 2008 to ignore trailing whitespace when I press END?

It's annoying in VS2008 when I press the END key, and my cursor jumps out to way beyond the end of the line of code, because I have trailing whitespace from a copy+paste or reformat. I would like the END key to ignore whitespace. How can I best do this? I thought of using AutoHotkey to catch END keypresses, and replace them with "CTRL+...

Will string.Trim() ever remove *valid* characters from a filename?

I'm creating a class to store a filename. To do so, I need to know exactly which characters are invalid and exactly which characters are invalid as leading/trailing characters. Windows Explorer trims leading and trailing white-space characters automatically when naming a file, so I need to trim the same characters when constructing a f...

Indentation with DOMDocument in PHP

I'm using DOMDocument to generate a new XML file and I would like for the output of the file to be indented nicely so that it's easy to follow for a human reader. For example, when DOMDocument outputs this data: <?xml version="1.0"?> <this attr="that"><foo>lkjalksjdlakjdlkasd</foo><foo>lkjlkasjlkajklajslk</foo></this> I want the XML ...

Strip out all whitespace?

Hi, What's the best way to strip out all whitespace from a .Net website? I found this site Whitespace removal - 4Wall Art Site If you look at the source it's clearly a .net site but all unwanted tabs and spaces are removed. Now I've searched around it seems a regular expression on the page render is the best method but does anyone have...

XSL transformation spacing

Hi, I'm using Xsl transformation to display an Xml data as Html. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ms="urn:schemas-microsoft-com:xslt" xmlns:util="urn:the-xml-files:xslt"> <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" encoding="utf-8"/> <xsl:template match=...

Why doesn't ORACLE allow consecutive newline characters in commands?

I write: :CREATE TABLE Person ( :name CHAR(10), : :ssn INTEGER); and save it to a file "a.sql" (colon represents beginning of line, is not in actual code.) If I then run it by typing "@a" in the mysql command prompt, it will tell me that the line starting with "ssn" is not recognized as a command, and is ignored. From what I gathe...

leading and trailing whitespace stripped from content of a text node when loading an XML file

In actionscript 3, when trying to load an XML file like <Element><Property> a </Property></Element> the value in the node "property" will be just "a", trailing and leading whitespaces are removed. I did what http://bugs.adobe.com/jira/browse/ASC-3125 recomends, with no success. Any ideas? ...

Is #define supposed to add spaces around macros?

I was looking at the program at http://www0.us.ioccc.org/1988/westley.c, mentioned in another SO answer - it's supposed to print the value of pi, about 3.142, but when I compile it and run it I get 0.250. It looks like when the GCC preprocessor (both 4.1.2 and 3.4.6 tested) runs on the code, it converts #define _ -F<00||--F-OO--; _-_-_...

Why are formatting characters like CRLF being rendered by certain browsers as whitespace?

I need someone to explain to me where this extra padding is coming from on divs that contain img elements. You can go to http://www.dev12.com/CSSTest for live examples of my two problems. Problem #1: Safari, Firefox and Opera render roughly 6 pixels of unwanted bottom padding on the container div. It does not matter if I explicitly se...

C# XSLT transform adding &#xA; and &#xD; to the output

I have an XSLT transform issue: style="width:{Data/PercentSpaceUsed}%;" And the value of Data/PercentSpaceUsed is integer 3. And it outputs: style="width:&#xD;&#xA; 3&#xD;&#xA; %;" instead of what I expected: style="width:3%;" Here's the code that does the transform: xslt_xslt is the transform xml, sw.ToString() contains the ...

Removing extra whitespace from generated HTML in MVC

I have an MVC application view that is generating quite a large HTML table of values (>20MB). I am compressing the view in the controller using a compression filter internal class CompressFilter : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { HttpRequestBase ...

WML expected whitespace error

I am transforming an XML file to WML using XSLT. Everything is fine until I try to open the WML in M3Gate. It gives the error "Bad WML syntax. 'Fatal Error. Ln 1, Col 38 Expected whitespace'." Here is the offending code. However, I've tried moving things around and it gives the same error. <?xml version="1.0" encoding="UTF-16"?> ...

How to keep whitespace before document element when parsing with Java?

In my application, I alter some part of XML files, which begin like this: <?xml version="1.0" encoding="UTF-8"?> <!-- $Id: version control yadda-yadda $ --> <myElement> ... Note the blank line before <myElement>. After loading, altering and saving, the result is far from pleasing: <?xml version="1.0" encoding="UTF-8"?> <!-- $Id: ver...

Is there a way to make whitespace visible in the XCode editor?

I want the tabs and spaces to be visible in XCode. Is this possible? I can't find it under preferences. ...