Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 13th, 2006, 08:04 AM
Authorized User
 
Join Date: Oct 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to monuindia2002
Default Adding a new Element

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>1 006</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

Mahesh
__________________
Mahesh
 
Old March 13th, 2006, 08:18 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

What platform and which libraries are you intending to use?
e.g. Windows and COm, Windows and .NET, Unix and java?
How will you know where to append the node if the name "msgText" is not constant?

If you are intending this to be a SOAP message then I don't think your format is legal because the actual payload is not in a defined namespace.

--

Joe (Microsoft MVP - XML)
 
Old March 13th, 2006, 11:59 PM
Authorized User
 
Join Date: Oct 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to monuindia2002
Default

Hi Joe

Sorry for the confusion, msgText is constant but <a1:LEUDataSet> is not constant.
I am using Windows and .net, and Xml in tag <a1:LEUDataSet> is being generated from Soap Formatter
which i need to append in msgText tag.

Regards
Mahesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem adding element to the previous element dani1 XSLT 5 September 10th, 2008 01:38 AM
adding options to a select element dymanicly StevesonD Javascript How-To 0 September 28th, 2006 09:53 AM
Adding an Element with Attribute to XML file xergic Classic ASP XML 0 November 20th, 2004 08:26 AM
adding of element and assigning to one element sushovandatta XSLT 2 November 16th, 2004 07:04 PM
Adding an element to a binded DropDownlist mahulda ASP.NET 1.0 and 1.1 Basics 3 March 10th, 2004 03:12 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.