Wednesday 15 July 2015

Load XML into C++ MSXML from byte array -


I am getting XML on a network socket. I want to take that XML and take further action in DOM Need to load. MSXMM requires input strings that are in UCS-2 or UTF-16 and ignore the XML header with the encoding type completely while loading the string. It allows to load pieces of XML, so it makes some sense.

I look at two possible ways to handle this problem:

1) Write the file to disk and load it in MSXML via the file path. Additional disk I / O makes this approach far from favorites.

2) To manually identify the encoding, to convert the peak into XML header and then to convert to UTF-16, call MultibiteTorDaCaire and specify the code page based on the encoding. This approach works fine, but I want to try to find out the encoding on MSXML.

Does anyone have any other ideas to accomplish this?

I have not seen other XML parsers, but I would be interested in how non-MSX Dome Parser accomplishes this.

Thank you, Paul

A simple way passes a secure array to the load function eg .

 const char * xml = "& lt; root />"; SAFEARRAYBOUND REGASBOUND [1]; RigaSound [0] .lLbound = 0; RigaSound [0]. CElements = strlen (xml); SAFEARRAY * psa = SafeArrayCreate (VT_UI1, 1, rgsabound); Mempie (PSA-> PVDTTA, XML, Stellen (XML)); Various V; VariantInit (and v); V_VT (V) = VT_ARRAY | VT_UI1; V_ARRAY (& v) = PAA; VARIANT_BOOL fSuccess; PXMLDock-> Weight (V, and FSUF); If (fSuccess == VARIANT_TRUE) {/ * do something * /} 

There is no error checking on running or exiting resources explicitly

or CreateStreamOnHGlobal Use to make and pass it in the load.


No comments:

Post a Comment