473,322 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Marshaling unicode WDDX

Hi !
i am trying to serialise object which contains some unicode objects
but looks like there is no way to do it.

File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/
_xmlplus/marshal/generic.py", line 92, in _marshal
return getattr(self, meth)(value, dict)
AttributeError: WDDXMarshaller instance has no attribute 'm_unicode'

WDDX is perfect for me for exchange between python and php application.
but maybe there is a better way to do it.
Any clue?

Thanks in advance.

Jan 5 '06 #1
4 1658

"isthar" <tk********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Hi !
i am trying to serialise object which contains some unicode objects
but looks like there is no way to do it.


hi, I'm sure you'll get better answers for the unicode part of your problem
(I'd start with a look at the codecs module), but I wanted you to know that
I'm using the wddx connection between Python and PHP with no problem. Here's
the python code that writes a fairly complex data structure to the wddx
file:

def writeDocReport(self):
from xml.marshal import wddx
fileName = '%s/%s.doc.wddx' % (os.path.join(adsWeb,'jobs','wddx'),
self.name)
tmpFile = open(fileName,'wb')
tmpFile.write(wddx.dumps(self.getDocData()))
tmpFile.close()

and the PHP:

function getInputData($){
$file = "wddx/$prodName.wddx";

if (!is_file($file)) {
exit("<h1>Report is not available for $prodName</h1>");
}

$output = wddx_deserialize(file_get_contents($file));
Jan 5 '06 #2
isthar wrote:
WDDX is perfect for me for exchange between python and php application.
but maybe there is a better way to do it.


It appears that Unicode objects where forgotten in the WDDX
implementation. I suggest to define the following classes:

class UWDDXMarshaller(xml.marshal.wddx.WDDXMarshaller):
def m_unicode(self, data, dict):
return self.m_string(data.encode("utf-8"), dict)

class UWDDXUnmarshaller(xml.marshal.wddx.WDDXUnmarshalle r):
def um_end_string(self, name):
ds = self.data_stack
ds[-1] = u"".join(ds[-1])
self.accumulating_chars = 0

The m_unicode part should get integrated into PyXML;
the um_end_string should probably return ASCII strings
if possible, else Unicode strings.

Regards,
Martin
Jan 5 '06 #3
Ok. but how I suppose to use them. I am currently using marshaller
indirectly via wddx.dump().

Anyway, thanks :)

Jan 10 '06 #4
isthar wrote:
Ok. but how I suppose to use them. I am currently using marshaller
indirectly via wddx.dump().


Do UWDDXMarshaller().dump()

Regards,
Martin
Jan 10 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: VM | last post by:
What's marshalling? I've had to use it extensively for a project but I don't know what it means. I tried to look for a definition in the Internet but I couldn't find anything that would explain...
3
by: Rudy Velthuis | last post by:
Hello, Does anyone know how to create a struct that will marshal to the following C++ struct A, containing an array of the user defined String10 type: struct String10 { char SLen; char S;
1
by: Nadav | last post by:
Hi I am about to write a performance crutial system, I am considering writing this system based on native COM or unmanaged C++ exposed as CLI, Now, I Wonder... does exposing a native code through...
0
by: Fraser Dickson | last post by:
I am building a web based system using ASP.NET and VB.NET which has to interact with a web service which uses XML WDDX packets. I have been given the XML Packet Specification by the Web Service...
0
by: Alexander Widera | last post by:
Hi, i want to call a wddx-service with asp.net ( c# ).... or i want to call a url .... how can i do this? description: - call a url .. - wait until there is a result - or there is a...
1
by: Bill Medland | last post by:
I am trying to do some P/Invoke custom marshaling and am looking for a little help on custom marshaling a value type. I am working based on Kate Gregory's "Arranging Custom Marshaling With...
1
by: Tim Arnold | last post by:
I'm confused about why I get this error: UnicodeError: ASCII encoding error: ordinal not in range(128) when I try to load a wddx file containing this string: <string>The image file,...
6
by: Aston Martin | last post by:
Hi All, ********************** My Situation ********************** I am working on project that involves passing a structure to unmanaged code from .Net world (well using C#). Perhaps an example...
0
by: jpogorman | last post by:
Hello, I am trying to get c# custom marshaling working in a particular scenario but it does not appear to be working or not jumping into my marshaling class when I try to debug it. I am try to...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.