Re: [libxml++] Add parse_memory(const unsigned char* contents) ?



So, is "unsigned char*" the best type to use for a pointer to a byte
array, that could text be of any encoding?

Will it make sense for people to cast their UCS2 w_char* array to a
unsigned char*? Aren't there little-endian/big-endian issues there?

I'd like to avoid using a void*.

On Thu, 2004-10-28 at 17:55 +0200, Murray Cumming wrote:
> DomParser and SaxParser currently have a
>   void parse_memory(const Glib::ustring &contents)
> method.
> 
> libxml can parse documents in other encodings, but Glib::ustring is for
> UTF-8. At a stretch it can contain some other encodings, but I don't think
> it can contain UTF-16 or UCS2.
> 
> So I think we should add
>   void parse_memory(const unsigned char* contents, const Glib::ustring&
> encoding = Glib::ustring());
> 
> When the encoding is not specified, then libxml will get the encoding from
> the XML declaration, doing some encoding guessing to get that far.
> 
> Unfortunately we can't add this as a virtual method in the base Parser
> class, because that would break ABI, but we could add it as a non-virtual
> method to each derived class.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]