Monthly Archives: February 2006

Addicted to http data

Addicted to http data

I got into work today and I could not get access to the internet. I was flumuxed. What am I meant to do now. I knew I had plenty to do that didn’t need net access but the first thing I do when I get in is check my mail, check digg and check some of my feeds. I felt utterly lost. Does anybody else feel like this when their net connection goes down.

Server not found

I can’t remember having this kind of dependency when I was on dial-up (dial-up, hi hi…. what fools we were :))

Thankfully downtime was limited to 19 minutes but still, it was touch and go for a while there.

Update:
Look slike there is a clinical (kind of) name for this – Hyperconnectia

XSLT output CDATA sections

I was transforming some xml to xml another format and some of the text nodes could potentially contained invalid characters, so placing them in CDATA sections would be wise. I tried the following –

[code lang=”xml”]

…….

< ![CDATA[
]]>

[/code]

which of course did not work and resulted in what you see below. I knew this would happen but I was real busy and figured it worth a shot.

[code lang=”xml”]

<xsl:value-of select=”fields/field[normalize-space(@name)=’Description’]/value/text()” />

[/code]

Some digging resulted in the finding of the “cdata-section-elements” attribute which contains a whitespace-separated list of QNames so using –

[code lang=”xml”]

…….



[/code]

I get the desired result

[code lang=”xml”]
< ![CDATA[This is a description]]>
[/code]

Marvellous I tell you, It’s amazing what you can actually learn when you RTFM , in this case the XSL W3C recommendation.

ValueError: bad marshal data

Very strange error happened today – I was running a few python scripts I was writing when I suddenly started getting a “ValueError: bad marshal data” error .

ValueError: bad marshal data

It was due to libxml2 but I didn’t know why. I deleted the “C:\Python24\Lib\site-packages\libxml2.pyc” and the “C:\Python24\Lib\site-packages\libxml2.pyo” file which solved the problem. No idea why as the error message means nothing to me.

LibXML2 and LibXSLT documentation

If you use libxml2 and libxslt (windows binaries) in python, you’ll know how annoying it is trying to figure out how to do something as the documentation is quite limited.

You can find out what is available in the python shell using dir() and __doc__ and help() but that’s a pain so I wrote a script to output a HTML file with the complete listing of the methods and prperties that libxml2 and libxslt have. Run it on your machine and you’ll have a ful list of all the methods (with __doc__ output) available with a permalink to each one and a link to google searching for references to that method.

Hope it helps

Bobby Super Dog

After much persuasion and torture, we are now the proud parents of “Bobby”, An 8 week old golden labrador. He is sleeping at my feet as I type. He does wake and start barking incredibly early but fingers crossed that will end soon. He’s only 8 weeks but already I have hime sitting, giving paw, playing football and pissing and pooping everywhere he sees fit (Gill taught him that).
Bobby Super Dog