whitespace

Actionscript stripping whitespace when it shouldn't

I'm using URLLoader in an ActionScript project to read in some XML. I then process it, and put it into a textfield. Everything looks fine. However, I don't really want the XML to be external to my SWF. So I did this: var internalXML:XML = <Content><P>It was in <City>Paris</City> that I first took a <Activity>walk in nature</Activity>.<...

Can you make valid Makefiles without tab characters?

target: dependencies command1 command2 On my system (Mac OS X), make seems to require that that Makefiles have a tab character preceding the the content of each command line, or it throws a syntax error. This is an annoyance when creating or editing Makefiles because I have my editor set up to be all-spaces-all-the-time. Can ...

Adding whitespace to web page source so that I can read it.

I'm curious about the web page I'm viewing. I use the "view--page source" and get a window with the html. I cut and paste this into notepad++. I manually parse through adding whitespace to make it readable to me. Is there a better way to do the last step? I'm hoping something has been written which automates this process, giving the...

Newlines between HTML element attributes?

Greetings, I'm doing some template work on a personal project and I'm trying very hard to keep my lines under 80 characters wide. This is difficult to do with HTML, especially when adding code for dynamic content as well. There are a lot of cases where it would be helpful to put line breaks inside the elements themselves, between attrib...

Strip whitespace in generated HTML using pure Python code

I am using Jinja2 to generate HTML files which are typically very huge in size. I noticed that the generated HTML had a lot of whitespace. Is there a pure-Python tool that I can use to minimize this HTML? When I say "minimize", I mean remove unnecessary whitespace from the HTML (much like Google does -- look at the source for google.com,...

Writing XML Exactly as XML Literals are Written

I'm transforming some XML from DrawingML to XAML. Unfortunately, the XAML one is not working as expected with white spaces, but I have found a work around. Here's the problem: Problem Statment I want to write the following in a TextBlock: Hi John, what did Sushi A say to Sushi B? So I would write: <TextBlock> <Run>Hey</Run> ...

Hidden token into default channel - AntlrV3

Suppose I'm having white spaces (WS) in the hidden channel. And for a particular rule alone, I want white spaces also to be considered, is it possible to bring WS to the default channel for that particular rule alone in the parser? ...

Antlr3 parser path command shell

I need to parse the command shell such as: cp /home/test /home/test2 My problem is in the correct path parsing. I defined a rule (I can not use a token as path but I need to define it in the parser): path : ('/' ID)+; with ID: (A.. Z | a.. z) +; WS: (' ') {$channel = HIDDEN;}; I need to keep the token WS hidden, but this gives ...

Recognizing Spaces in text [C]

I'm writing a program that deciphers sentences, syllables, and words given in a basic text file. The program cycles through the file character by character. It first looks if it is some kind of end-of-sentence marker, like ! ? : ; or . Then if the character is not a space or tab, it assumes it is a character. Finally, it identifies tha...

How do I preserve whitespace characters when parsing XML from C# LINQ

What do I need to do in either my C# code or my XML document so that the XDocument parser reads literal whitespace for Values of XElements? Background I have an XML document, part of which looks like this: <NewLineString>&#10;&#13;</NewLineString> <IndentString> </IndentString> I'm adding the values of each XELement to a...

Python xml.dom.minidom removeChild whitespace problem

Hi there, I'm trying to read an xml file into python, pull out certain elements from the xml file and then write the results back to an xml file (so basically it's the original xml file without several elements). When I use .removeChild(source) it removes the individual elements I want to remove but leaves white space in its stead making...

Simplest way to get a complete list of all the UTF-8 whitespace characters in PHP

In PHP, what's the most elegant way to get the complete list (array of strings) of all the Unicode whitespace characters, encoded in utf8? I need that to generate test data. ...

Ruby whitespace: Is { :a => 1 } better than {:a => 1}?

Looking at other people's code it seems really common to include an extra space inside curly brace blocks. Is there a reason for that? To me it seems to add extra keystrokes for added ugliness. Especially when things get nested: lambda { (1..5).map { |i| { :a => { :b => i } } } } For some reason it just looks more concise and coherent...

Writing XML strips trailing spaces

I am trying to write an XML file using MSXML4. It works fine except when I have a data element with a trailing space which must be preserved. Given the following code to insert a new element: const _bstr_t k_Parent (ToBSTR("ParentNode")); const _bstr_t k_Child (ToBSTR("ChildNode")); const _bstr_t k_Data (ToBSTR("Data...

whitespace coldfusion

what would be the correct way to stop the white space that coldfusion outputs?? i know there is cfcontent and cfoutputonly.... what is the correct way to do that?? ...

XML Carriage return encoding

Hi there, I was looking to represent a carriage return within an xml node. I have tried a whitespace preserve, hex entity with no luck- and a \n. viewing via a browser. Example <Quote> Alas, poor Yorick! I knew him </Quote> Thanks Joe ...

Grab a line's whitespace/indention with Python

Basically, if I have a line of text which starts with indention, what's the best way to grab that indention and put it into a variable in Python? For example, if the line is: \t\tthis line has two tabs of indention Then it would return '\t\t'. Or, if the line was: this line has four spaces of indention Then it would return four...

How to read CDATA XML Content

I have the following xml file: <?xml version="1.0" encoding="utf-8"?> <root> <phrase id="test"><![CDATA[test]]></phrase> <phrase id="test0"><![CDATA[test0]]></phrase> <phrase id="test2"><![CDATA[test2]]></phrase> <phrase id="test3">test3</phrase> <phrase id="test4"> <![CDATA[test4 LINEBREAK]]> </phrase> <phrase id="test5"> LINEB...

How to remove whitespace from XElement object created from XElement.ReadFrom(XmlReader)

I am parsing a large xml file. So I am using an XmlReader in combination with XElement instead of XElement.Load(). I have created as XElement object from XmlReader as shown below and here. static IEnumerable<XElement> StreamRootChildDoc(string uri) { using (XmlReader reader = XmlReader.Create(uri, xmlReaderSettings)) { ...

Adding consistent whitespace to HTML using Python

I just started working on a website that is full of pages with all their HTML on a single line, which is a real pain to read and work with. I'm looking for a tool (preferably a Python library) that will take HTML input and return the same HTML unchanged, except for adding linebreaks and appropriate indentation. (All tags, markup, and c...