Nesting MSXML objects and not having it translate special characters

mdlueck

Sr. Application Developer
Local time
Yesterday, 22:23
Joined
Jun 23, 2011
Messages
2,650
I have run into an issue nesting one MSXML object within another MSXML object that when I output the XML from the outer MSXML object, the inner MSXML object's XML has been sanitized such that all of the special characters have been translated.

This article explains the mapping which is being done:
http://support.microsoft.com/kb/251354

Is there some way to have the outer MSXML simply not perform sanitation on the data, and instead allow the XML content to pass straight through?

Sample .XML output of the outer MSXML object is as follows:

Code:
? objXMLDOMDoc.XML
<FASMessage><XMLSchemaVersion>2.1.0.1</XMLSchemaVersion><FASRule>FASEmailSend</FASRule><FASRuleMessage><FASRuleMessage><FromAddress>Michael Lueck &lt;mlueck@company.com&gt;</FromAddress><ToAddress>Michael Lueck &lt;mlueck@company.com&gt;</ToAddress><MsgSubject>This is a first test email!</MsgSubject><Priority>0</Priority><MsgBody>This is a way cool test!</MsgBody></FASRuleMessage>  </FASRuleMessage></FASMessage>
This is more how I desire it to work as far as character encoding. (Yes I realize the code is not producing exactly the same schema currently.)

Code:
<FASMessage>
  <XMLSchemaVersion>2.1.0.1</XMLSchemaVersion>
  <FASRule>FASEmailSend</FASRule>
  <FASRuleMessage>
    <FromName>Michael Lueck</FromName>
    <FromAddress>mlueck@company.com</FromAddress>
    <ToName>Michael Lueck</ToName>
    <ToAddress>mlueck@company.com</ToAddress>
    <MsgSubject>This is a first test email!</MsgSubject>
    <Priority>0</Priority>
    <MsgBody>This is a way cool test!</MsgBody>
   </FASRuleMessage>
 </FASMessage>
Basically the <FASRuleMessage> tag is what I want to be the inner MSXML object. Based on the <FASRule> value I will drop into the correct parser code for the particular message type.

So I am looking for a way to allow XML tags to pass through the MSXML object bare / un-encoded.
 
I believe I need to get this API working to accomplish what I am in need of:

createDocumentFragment Method
http://msdn.microsoft.com/en-us/library/windows/desktop/ms755489(v=vs.85).aspx

The sample code, however, does not insert the DocumentFragment within the flow of the XML document, rather has it completely separate.

My attempts to morph the DocumentFragment within the main XML being created keeps blowing up.

Anyone with sample code of inserting raw XML within a main XML document?
 
I received the answer from the MSXML forum:

Ability to merge multiple XML objects together into one final XML document, how?
http://social.msdn.microsoft.com/Fo...x/thread/d03104df-7195-42f4-8847-8cee8f966531

Working code is as follows:
Code:
  'Create the FASRuleMessage element
  objXMLDOMDoc.documentElement.appendChild  (objXMLDOMDoc.importNode(Me.fasrulemessage.documentElement,  True))
 

Users who are viewing this thread

Back
Top Bottom