简体   繁体   中英

How to write the STX / ETX ( C0 control code) into the BSTR buffer IXMLDOMElement*

I have one application which is passing one (BSTR* ProfileXml) as out parameter. So One I am sending the Profile after allocating it using SysAllocString(Profile)

WCHAR   Profile[] = 
L"<IhvSecurity xmlns=\"http://www.sampleihv.com/nwifi/profile\">"
L"<IHVSecurityParam2>parameter value</IHVSecurityParam2>"
L"</IhvSecurity>";

It' working fine with paramater values for almost all the ascii character (excluding C0 codes like STX ascii code 2 ETX ascii code 3). As soon I send either of STX or ETX that application send error and asking for valid xml buffer, I am using IXMLDOMElement method for loading profile buffer an modifying buffer and saving again buffer. I haven' mention the encoding in Profile string buffer default is utf - 8.

So I am doing some thing wrong here or We cannot use STX / ETX in xml ??? MSMXL parser cannot parse them. Or they some way / API is there to write this into param buffer is node.

Any help will really appreciated

Thanks

You are right, you can't use control characters in XML 1.0 . See the specification for the valid range . XML 1.1 adds support for these control characters, but I don't think MSXML supports XML 1.1.

As a workaround you could implement some kind of escaping scheme and then decode it at the other end.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM