It looks like the reply-to is not set properly on this list, so I'm
forwarding my reply.  Sorry!

Dave

----- Forwarded by David N Bertoni/CAM/Lotus on 09/26/2001 05:37 PM -----
                                                                                
                                              
                      David N Bertoni                                           
                                              
                                               To:      Guillaume L�onard 
<[EMAIL PROTECTED]>                             
                      09/26/2001 05:19         cc:                              
                                              
                      PM                       Subject: Re: Using 
XSLTInputSource with wchar_t*(Document link: David N        
                                               Bertoni)                         
                                              
                                                                                
                                              



The problem is that unless you know what encoding the string is in, and how
big a wchar_t is on your platform, it's pretty difficult to know what to
do.

If you can guarantee that the code points in your string are encoded in
UTF-16, you can simply copy the first 2 bytes of the wide characters to an
array of chars that's large enough and use that to create the istream.
You'd have to do the right thing to make sure the endianness is correct for
your platform, but that's about it.  If you wchar_t is 32 bits, another
possibility is to use UTF-32, but I'm not sure if the parser intrinsically
supports that encoding.  In that case, you'd need to make sure the encoding
is present in the XML declaration.

Otherwise, you can transcode the string to a narrow string using wcstomb
and use that, but if there are characters in the stylesheet which cannot be
represented properly, that transcoding will fail.

Dave



                                                                                
                                              
                      Guillaume                                                 
                                              
                      L�onard                  To:      "Xalan-C-Users" 
<[email protected]>                        
                      <[EMAIL PROTECTED]         cc:      (bcc: David N 
Bertoni/CAM/Lotus)                                      
                      um.net>                  Subject: Using XSLTInputSource 
with wchar_t*                                   
                                                                                
                                              
                      09/26/2001 02:21                                          
                                              
                      PM                                                        
                                              
                                                                                
                                              
                                                                                
                                              



I have a string in memory (wchar_t*) that I wan't to use as a stylesheet.

I wan't to call XalanTransformer::compileStylesheet and I don't want to use
a file.  If I had a char*, I would use the XSLTInputSource ctor that takes
a
istream as a parameter, but there isn't a ctor that takes a wistream.

Is there a way to do this?

thks






Reply via email to