Re: [xml] Build DOM tree manually from ASCII file and getting data into xmlChar



On Wed, Jul 31, 2002 at 02:44:03PM -0600, Steve Williams wrote:
Hi,

I am reading a (non-xml) file and building the DOM tree manually using 
xmlNewDoc, xmlNewDocNode, xmlNewChild (per the sample on the web site).

I am confused how I get input that I read into a char * array into an 
xmlChar* buffer...

  see http://xmlsoft.org/encoding.html
  xmlChar * means an array of char encoded in UTF-8

Right now, I am using BAD_CAST to force the issue, but I need to do it 

  This is fine if you're sure it's ASCII

"right" for deployment as I may be getting french characters in the 
input file...

  French characters (well accented ones for example) are not in ASCII
but probably in ISO Latin 1, use the following function to convert them
before passing the strings to the API:
  int
  isolat1ToUTF8(unsigned char* out, int *outlen,
                const unsigned char* in, int *inlen) {

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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