[xsd-users] (no subject)

Boris Kolpackov boris at codesynthesis.com
Sat Sep 30 12:01:31 EDT 2006


Hi Subhash,

subhash.dixit at tcs.com <subhash.dixit at tcs.com> writes:

> I am using unicode for xml parsing. I am trying to create Input
> Source with UChar data. Is it valid to create MemBufInputSource with
> UChar data.
> Becouse I am getting "instance document is not valid" error. Is
> there any other way to create MemBufInputSource with UChar data as
> MemBufInputSource accepts const XMLByte data type.

Note that there are lots of libraries that define UChar - we have
no idea which one you are using. From our previous (private)
correspondence I can guess that you are using ICU. ICU UChar
represents a UTF-16 code point and is 16 bits wide. Since
MemBufInputSource operates on bytes you will need to multiply the
length of your UChar string by two in order to get the right size
in bytes:

UChar* ustr = ...
unsigned long ulen = ...

MemBufInputSource is (reinterpret_cast<XMLByte*> (ustr), ulen * 2);

You may also have to override the default encoding which is obtained
from the XML document by calling the setEncoding function on
MemBufInputSource:

is.setEncoding (XMLUni::fgUTF16BEncodingString); // On a big-endian machine
is.setEncoding (XMLUni::fgUTF16LEncodingString); // On a little-endian machine


> Plz reply soon as this is very urgent for me.

You may want to consider getting a priority support contract[1] if you
require guaranteed response time.


[1] http://www.codesynthesis.com/support/

hth,
-boris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 652 bytes
Desc: Digital signature
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20060930/46b28699/attachment.pgp


More information about the xsd-users mailing list