CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2002
    Location
    USA
    Posts
    18

    Bianry data in XML

    Hello,

    I am creating XML on fly and my data is stored in WTL::CString object and this data is having some Binary data

    e.g.

    These are the steps I do to create my XML and "strFailedDesc" is WTL::CString object and contains binary data.

    sipNode = m_sipXMLDoc->createElement(_bstr_t("FailedDesc"));
    strFailedTransactionXML = "<![CDATA[";
    strFailedTransactionXML += strFailedDesc;
    strFailedTransactionXML += "]]>";
    sipNode->text = _bstr_t(strFailedTransactionXML) ;

    sipNode->text = _bstr_t(strFailedTransactionXML) ; ..This soperation falies and gives error:

    "Code = 80004005, Message = Unspecified error Source = msxml4.dll Description = An invalid character was found in text content."

    This works perfectly well when there is no binary data in "strFailedDesc"

    I am new in XML programming, Can somebody tell me why this error is comming and what is the way around.

    Thanks

  2. #2
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125
    Simple.

    XML is a text based protocol!
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  3. #3
    Join Date
    Dec 2002
    Location
    USA
    Posts
    18
    Even when we enclose the binary data in CDATA section XML parser works?

    Isn't it supposed to ignore it.

    So there is no way of passing binary data in XML.

  4. #4
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125
    Well, there are a number of techniques for passing binary data in a test wrapper. UUENCODE is probably the granddady of them all. Microsoft SOAP protocol is XML based and supports extended types of data transfer.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured