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



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.

Thoughts?

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]