Click here to Skip to main content
15,890,438 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How can I associate the editbox with the ratio button? (dynamically update editbox ratio button) Pin
danginkgo25-Jun-08 20:23
danginkgo25-Jun-08 20:23 
QuestionGrid control with Check boxes....Please Help Pin
Rajesh_Parameswaran25-Jun-08 3:55
Rajesh_Parameswaran25-Jun-08 3:55 
AnswerRe: Grid control with Check boxes....Please Help Pin
Iain Clarke, Warrior Programmer25-Jun-08 4:16
Iain Clarke, Warrior Programmer25-Jun-08 4:16 
GeneralRe: Grid control with Check boxes....Please Help Pin
Rajesh R Subramanian25-Jun-08 4:17
professionalRajesh R Subramanian25-Jun-08 4:17 
GeneralRe: Grid control with Check boxes....Please Help Pin
Iain Clarke, Warrior Programmer25-Jun-08 4:22
Iain Clarke, Warrior Programmer25-Jun-08 4:22 
GeneralRe: Grid control with Check boxes....Please Help Pin
Rajesh_Parameswaran25-Jun-08 22:08
Rajesh_Parameswaran25-Jun-08 22:08 
GeneralRe: Grid control with Check boxes....Please Help Pin
Iain Clarke, Warrior Programmer25-Jun-08 22:27
Iain Clarke, Warrior Programmer25-Jun-08 22:27 
QuestionNeed to write the ASCII (230) in XML content section using MSXML 4.0. Pin
AnotherFakeName25-Jun-08 3:27
AnotherFakeName25-Jun-08 3:27 
I need to write the ASCII (230) in XML content section using MSXML 4.0.

Premise: XML incompatible with third party tool.

Under MSXML I am converting my string to BSTR (wide char), and it end’s up in the XML file back into the ASCII equivalent. Unfortunately it does not work for the accented characters when in the content section of an element. Instead that part of the string stays in wide-char in the xml file.
This is trouble since the XML file is passed to a third party utility that does not support this wide-char, nor the usual mapping like [& eaccent;] nor a XML header indicating UTF-8 or other.

For example:
I save the string:
<Test>Char é</Test>
It will actually be saved as:
<Test>Char Ç</Test>
Where 'Ç' is an example of some accented char (not necessarily 'é').

Note that you must open the XML in binary to see this. Notepad, Visual Studio or XmlPad all display the accented character fine (they detects the wide char, unlike my third party tool).

If I open the XML using a hex editor to replace the 2 characters by the ASCII # 230, the third party tool works fine.

So my question is: How can I force a char-230 (or other bad char) to actually be into the XML file using MSXML 4.0?

My code to create the XML node:
Example: CreateElementNode( myXmlDoc, "Node_Name", "Test é" );

BSTR AsciiToBSTR( LPCTSTR pszFText )
{
// TROUBLE with: "àáâäçèéêëìíîòóô"; (and more?)

	BSTR bsText = NULL;
	WCHAR *wszURL = NULL;
	
	int wSize = strlen( pszFText );
	
	::MultiByteToWideChar( CP_ACP, 0, pszFText, -1, wszURL, wSize );
	bsText = SysAllocString( wszURL );
	free( wszURL );

	return bsText;
}

MSXML2::IXMLDOMNodePtr CreateElementNode( MSXML2::IXMLDOMDocument2Ptr pXMLDoc, string sName, string sNamespaceURI )
{
	MSXML2::IXMLDOMNodePtr node;

	BSTR bsName = NULL;
	bsName = AsciiToBSTR( sName );

	BSTR bsNamespaceURI = NULL;
	bsNamespaceURI = AsciiToBSTR( sNamespaceURI );

	VARIANT vtype;
	vtype.vt = VT_I4;
	V_I4( &vtype ) = (int)MSXML2::NODE_ELEMENT;

	node = pXMLDoc->createNode( vtype, bsName, bsNamespaceURI );

	return node;
}

AnswerRe: Need to write the ASCII (230) in XML content section using MSXML 4.0. Pin
Nemanja Trifunovic25-Jun-08 3:48
Nemanja Trifunovic25-Jun-08 3:48 
GeneralRe: Need to write the ASCII (230) in XML content section using MSXML 4.0. Pin
AnotherFakeName25-Jun-08 4:46
AnotherFakeName25-Jun-08 4:46 
GeneralRe: Need to write the ASCII (230) in XML content section using MSXML 4.0. Pin
Nemanja Trifunovic25-Jun-08 5:07
Nemanja Trifunovic25-Jun-08 5:07 
GeneralRe: Need to write the ASCII (230) in XML content section using MSXML 4.0. Pin
AnotherFakeName25-Jun-08 9:11
AnotherFakeName25-Jun-08 9:11 
GeneralRe: Need to write the ASCII (230) in XML content section using MSXML 4.0. Pin
Nemanja Trifunovic25-Jun-08 11:02
Nemanja Trifunovic25-Jun-08 11:02 
AnswerRe: Need to write the ASCII (230) in XML content section using MSXML 4.0. Pin
AnotherFakeName25-Jun-08 9:11
AnotherFakeName25-Jun-08 9:11 
GeneralRe: Need to write the ASCII (230) in XML content section using MSXML 4.0. Pin
AnotherFakeName25-Jun-08 10:23
AnotherFakeName25-Jun-08 10:23 
QuestionDate change notification Pin
Ali Tavakol25-Jun-08 3:20
Ali Tavakol25-Jun-08 3:20 
AnswerRe: Date change notification [modified] Pin
SandipG 25-Jun-08 3:25
SandipG 25-Jun-08 3:25 
AnswerRe: Date change notification Pin
David Crow25-Jun-08 8:53
David Crow25-Jun-08 8:53 
AnswerRe: Date change notification Pin
Bram van Kampen25-Jun-08 10:57
Bram van Kampen25-Jun-08 10:57 
QuestionEnabling ClearType setting in windows vista changes the font size Pin
subramanyeswari25-Jun-08 2:47
subramanyeswari25-Jun-08 2:47 
QuestionGetting user input into a list control Pin
theCPkid25-Jun-08 2:05
theCPkid25-Jun-08 2:05 
QuestionRe: Getting user input into a list control Pin
Rajesh R Subramanian25-Jun-08 2:42
professionalRajesh R Subramanian25-Jun-08 2:42 
QuestionRe: Getting user input into a list control Pin
theCPkid25-Jun-08 3:32
theCPkid25-Jun-08 3:32 
AnswerRe: Getting user input into a list control Pin
Rajesh R Subramanian25-Jun-08 3:52
professionalRajesh R Subramanian25-Jun-08 3:52 
AnswerRe: Getting user input into a list control Pin
Steen Krogsgaard25-Jun-08 3:13
Steen Krogsgaard25-Jun-08 3:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.