Adding a new Element

monuindia2002

Member
Joined
Jan 26, 2006
Messages
8
Programming Experience
1-3
Hi,
I have following XML,
<?xml version="1.0" encoding="UTF-8" ?>
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Header>
<msgName>saveDataService</msgName>
</soapenv:Header>
<soapenv:Body>
<msgResponse>
<msgName>saveDataService</msgName>
<response>
<additionalInfo>
<dataServiceId>CC_ForecastTypesDS</dataServiceId>
</additionalInfo>
<msgStatus>PASS/FAIL</msgStatus>
<msgText />
<warnings>Warnings Text</warnings>
</response>
</msgResponse>
</soapenv:Body>
</soapenv:Envelope>

In This Xml code in the <msgText> tag i want to append following Xml Code which is in different xml file

<a1:LEUDataSet id="ref-1" xmlns:a1="http://schemas.microsoft.com/clr/nsassem/LEU.Common/LEUBaseLibrary%2C%20Version%3D1.2.0.2%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull">
<XmlSchema id="ref-3"><?xml version="1.0" encoding="utf-16"?> <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop"> <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:DataSetId=""> <xs:complexType> <xs:choice maxOccurs="unbounded"> <xs:element name="FORECAST_TYPE" msprop:UPDATED="True" msprop:BaseTable.0="FORECAST_TYPE" msprop:UPDATE_TABLE_NAME="FORECAST_TYPE"> <xs:complexType> <xs:sequence> <xs:element name="FORECAST_TYPE_CODE" msdata:ReadOnly="true" msprop:OraDbType="126" msprop:BaseColumn="FORECAST_TYPE_CODE" type="xs:string" msdata:targetNamespace="" /> <xs:element name="CODE_DESC" msprop:OraDbType="126" msprop:BaseColumn="CODE_DESC" type="xs:string" msdata:targetNamespace="" minOccurs="0" /> <xs:element name="ASSIGNMENT_ID" msprop:OraDbType="112" msprop:BaseColumn="ASSIGNMENT_ID" type="xs:decimal" msdata:targetNamespace="" minOccurs="0" /> <xs:element name="HAS_CHILD_RECORD_YN" msprop:OraDbType="126" type="xs:string" msdata:targetNamespace="" minOccurs="0" /> </xs:sequence> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> <xs:unique name="Constraint1" msdata:primaryKey="true"> <xs:selector xpath=".//FORECAST_TYPE" /> <xs:field xpath="FORECAST_TYPE_CODE" /> </xs:unique> </xs:element> </xs:schema></XmlSchema>
<XmlDiffGram id="ref-4"><diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"><NewDataSet><FORECAST_TYPE diffgr:id="FORECAST_TYPE1" msdata:rowOrder="0" diffgr:hasChanges="modified"><FORECAST_TYPE_CODE>1006</FORECAST_TYPE_CODE><CODE_DESC>MODIFIED</CODE_DESC><HAS_CHILD_RECORD_YN>N</HAS_CHILD_RECORD_YN></FORECAST_TYPE></NewDataSet><diffgr:before><FORECAST_TYPE diffgr:id="FORECAST_TYPE1" msdata:rowOrder="0"><FORECAST_TYPE_CODE>1006</FORECAST_TYPE_CODE><CODE_DESC>999</CODE_DESC><HAS_CHILD_RECORD_YN>N</HAS_CHILD_RECORD_YN></FORECAST_TYPE></diffgr:before></diffgr:diffgram></XmlDiffGram>
</a1:LEUDataSet>

The Name of this tag is dynamic, it will change every time.
How can i do that,
Can any body help me.

Regards
Mahesh
 
I'm not getting valid Xml data out of this, you have post Xml code in Html code boxes, see Forum FAQ.

Generally speaking, the problem with copying nodes between different documents, is that you first have ImportNode the source node into the destination document (supports deep), then you AppendChild to place the imported node.
 
Back
Top