Re: Expat and JavaScript

Karl Waclawek <[email protected]>
Newsgroups gmane.text.xml.expat.general
Message-ID <[email protected]>
Franky Braem wrote:
>>
>> How does p.currentElement.name get its value from Expat
> This is how it is done:
>
> void XMLParser::StartElementHandler(void *userData,
>                                    const XML_Char *name,
>                                    const XML_Char **atts)
> {
>    wxMBConvUTF16 conv;
>    XMLParser *parser = (XMLParser*) userData;
>
>    wxString element(name, conv);
>
>    ...
>
>    jsval rval;
>    jsval argv[] =
>    {
>        JS_NewUCStringCopyN(cx, (jschar *) element.c_str(), 
> element.length()));
>        OBJECT_TO_JSVAL(objAttr)
>    };
>
>    wxJS_CallFunctionProperty(parser->m_cx, parser->m_obj, 
> "onStartElement",
>                              2, argv, &rval);
> }

I know nothing about the wx API, but it seems that maybe you are calling the
wxstring constructor with the wrong arguments. "name" is already in 
UTF-16 encoding,
so why pass an instance of wxMBConvUTF16 (Google indicates this is used 
for converting
from UTF-8 to UTF-16)?

Karl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.