[TxMt] Tidy and XML

Nicholas Orr nick at goya.com.au
Tue Nov 29 20:45:20 UTC 2005


On 30/11/2005, at 3:47 AM, Allan Odgaard wrote:

> On 29/11/2005, at 6:00, Nicholas Orr wrote:
>
>> But I've had trouble getting the tidy to work in TextMate.  The  
>> default XML - Tidy command just adds spaces between every single  
>> character in the file.
>
> Could you show an example?
>
> If I enter: <foo><bar><fud><jaz /></fud></bar></foo>
>
> I get (after running XML -> Tidy):
>
> <?xml version="1.0"?>
> <foo>
>    <bar>
>       <fud>
>          <jaz/>
>       </fud>
>    </bar>
> </foo>

Well the test file I'm trying to run this on is 40,000 lines long  
(I've got around 40 files and they're all either around that or  
bigger).  So it's probably not much point trying to post it.  But to  
show you a little snippet, these four lines at the start :

<?xml version="1.0" encoding="UTF-16"?>
<FMPReport link="Summary.xml" type="Report" creationDate="4/10/2005"  
creationTime="11:01:50 AM">
<File name="DEV_CAR.fp7" path="/Users/nick/Desktop/Clients/CCP-Bambra  
MIS/New">
<BaseTableCatalog>
	<BaseTable id="32769" name="CAR" records="2">

get turned into this :

��< ? x m l   v e r s i o n = " 1 . 0 "    
e n c o d i n g = " U T F - 1 6 " ? > 
 < F M P R e p o r t   l i n k = " S u m m a r y . x m l "    
t y p e = " R e p o r t "    
c r e a t i o n D a t e = " 4 / 1 0 / 2 0 0 5 "    
c r e a t i o n T i m e = " 1 1 : 0 1 : 5 0   A M " > 
 	 < F i l e   n a m e = " D E V _ C A R . f p 7 "   p a t h = " /  
U s e r s / n i c k / D e s k t o p / C l i e n t s / C C P -  
B a m b r a   M I S / N e w " > 
 	 	 < B a s e T a b l e C a t a l o g > 

(obviously there a closing tags later in the document).  So it's  
doing the indent fine (which is what I'm after, but also adding extra  
spaces to everything.)

Thanks,
Nick


More information about the textmate mailing list