|
Hi Stefan,
Stefan Troschuetz wrote: Do you get any error message?
I am getting the reason of failure as:
"Type 'OEM' is not found in Schema"
Can you please suggest some solution for this?
Thanks in advance.
And also Thanks for your suggestion on my note.
Kavita seth
|
|
|
|
|
Kavita seth wrote: Can you please suggest some solution for this?
Mmh, I'm not sure where this error comes from as the OEM type is declared in the schema. Maybe it has something to do with declaring all schema components in the empty namespace. I strongly recommend using a custom target namespace. Also it might be helpful to see the declaration of the INFO-COMPONENT element.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hello can anyone help me in getting the xml file's root node in the following format.
Here Schedule is root node.
I am using the XmlTextWriter class.
<tns:schedule xmlns:tns="http://www.Mycompany.com/Schedule" xmlns:dt="http://www.Mycompany.com/DataTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.Mycompany.com/Schedule Schedule.xsd" scheduleType="Playback" version="1.0" creationTime="2006-01-29T00:00:00" originator="Mycompany">
<scope startTime="2006-01-29T04:00:00" stopTime="2006-01-29T06:00:00" />
- <channelRef id="05" action="Noop">
<source url="ucast://192.168.3.110:10000" />
</channelRef>
Can anyone help me in this regards...
Thanks
Anee
Anee
|
|
|
|
|
Show us the code that you got so far and we'll tell you what has to be changed. Don't expect someone to write the whole code for you.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hello,
I did, like this.. and got the root element, in the way.. which my sample xml document contains.
But i am not much sure, that whether the method that i followed is correct or not. please help me out in fixing whether this is right or not.
This the piece of code, which i wrote to write the root node .. according to my requirement..
//writer.WriteStartElement("tns", "schedule", "http://www.MyCopmpany.com/Schedule");
writer.WriteStartElement("tns:schedule");
writer.WriteAttributeString("xmlns:tns", "", "http://www.MyCompany.com/Schedule");
writer.WriteAttributeString("xmlns:dt", "","http://www.MyCompany.com/DataTypes");
writer.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
writer.WriteAttributeString("xsi:schemaLocation", "http://www.MyCompany.com/Schedule Schedule.xsd");
writer.WriteAttributeString("scheduleType", "Playback");
writer.WriteAttributeString("version", "1.0");
writer.WriteAttributeString("creationTime", "2006-01-29T00:00:00");
writer.WriteAttributeString("originator", "MyCompany");
writer.WriteStartElement("scope");
writer.WriteAttributeString("startTime", "2006-01-29T04:00:00".ToString());
writer.WriteAttributeString("stopTime", "2006-01-29T06:00:00".ToString());
writer.WriteEndElement();
//use the record structure
int i = 0, count;
count = xmlSlotNodes.Count;
// sort the slots according to there callSign
xmlSlotNodes.Sort(0,count,new Sorting ());
string[] prgmTime = new string[2];
----
----
Thank you
Anee
|
|
|
|
|
Looks quite ok, but
- For starting the root element you should use the following overload of the WriteStartElement method, cause the one that is currently used expects a local name and not a qualified name:
writer.WriteStartElement("tns", "schedule", "http://www.MyCopmpany.com/Schedule");
- For writing the namespace declarations you should use the following overload, cause the one that is currently used also expects a local name and not a qualified name:
writer.WriteAttributeString("xmlns", "tns", null, "http://www.MyCompany.com/Schedule");
writer.WriteAttributeString("xmlns", "dt", null,"http://www.MyCompany.com/DataTypes");
writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance");
writer.WriteAttributeString("xsi", "schemaLocation", "http://www.w3.org/2001/XMLSchema-instance", "http://www.MyCompany.com/Schedule Schedule.xsd");
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hello Stefan!!
Great thanks... Its works fine.
Thank you
Anee
Anee
|
|
|
|
|
how to connect xmlfile to tally.
i have tally software 7.2 version and rts link.
v.surendrakumar
|
|
|
|
|
Good Morning Every one,
I have an application that is going to recieve Xml file from another application via Http post.
the file structure would be as follows:
one rot node
100 childnodes and 4 childnodes for each among 100.
i am using XmlTextReader class to parse through the Xml file. the application goes on smooth as long as the structure of Xml file is correct. if there is a welformedness error in any one of the childnodes then the reader halts at that point and throws an XML error that "The starting tag doesdont match the ending tag".Once the parser encounters this error its stops reading.
I have done research and found out that XMlWellformedness eror is a fatal error and The parser is not allowed to overcome this error untill the Xmlfile structure is corrected as per the standard specifications.
i wanted to know Is there any way programaticaly that i can overcome this error!
right now im using XmlTextReader class for parsing and While loop to iterate through the nodes step by step sequentially.
I would really appreciate if some one could guide me!
Abhi Manav
|
|
|
|
|
Abhi Manav wrote: I have an application that is going to recieve Xml file from another application via Http post.
Abhi Manav wrote: the application goes on smooth as long as the structure of Xml file is correct. if there is a welformedness error in any one of the childnodes then the reader halts at that point and throws an XML error that "The starting tag doesdont match the ending tag".
Can't you fix the other app so it produces correct XML?
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Generation of Xml file is in Clients hands!
I was just trying to figure out my application in such scenarios!
Is there any way to resolve my problem?!
|
|
|
|
|
I've never seen a parser that deals with the non-wellformed XML in a way other than throwing an exception or returning an error. The syntactic wellformedness is at the very heart of XML and if your client continues to produce XML that is not wellformed he and his partners will have many problems processing these documents.
Until your client produces wellformed XML you could try to find an error-tolerant parser. If you cannot find any, you may be able to write one yourself (either generally applicable or specialized on the files you're reading). Also you may be able to write some code that deals with XML file as plain text and repairs it, so the XML parser can read it without errors.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thanks a ton for the advice!
i will work on the Xml repair API, hope it would be usefull in other cases too!
i l get back once i comeplete the thing!
Thanks!
|
|
|
|
|
Hi
I wanted to ask:
Is this possible to create a new XML file based on another XML file using XSL/XSLT?
I'm trying to build an application that can provide filtering capabilities in an XML file. I want to show the file in a TreeView such that the nodes should show the text inside the XML Tags and not the 'tag Element text'...
Thanks in advance
Rocky
|
|
|
|
|
Rocky71 wrote: Is this possible to create a new XML file based on another XML file using XSL/XSLT?
Yes, you would usually use xsl:copy and/or xsl:copy-of .
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hello,
I setup SharePoint services 3 at work so I can use its helpdesk capabilities. The problem is I want to track the number of closed service tickets for each technician. There is a built in Web Part that displays the initiated, engaged, resolved, and closed tickets. I want to add a bar for each technician that will display each of our closed tickets. The web part looks like this below. A little over half way down shows the bars where each condition will be displayed. I just want to copy a piece of that code and make a change to add the technician's closed tickets. Can anyone assist me with this?
Thanks!!
<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns ="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:WebControls="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">
<xsl:output method="html" indent="no"/>
<xsl:param name="dvt_apos">'</xsl:param>
<xsl:variable name="dvt_1_automode">0</xsl:variable>
<xsl:template match="/" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns ="http://schemas.microsoft.com/sharepoint/dsp" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:WebControls="Microsoft.SharePoint.WebControls">
<xsl:call-template name="dvt_1"/>
</xsl:template>
<xsl:template name="dvt_1">
<xsl:param name="ParentPath"/>
<xsl:variable name="dvt_StyleName">Table</xsl:variable>
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>
<xsl:variable name="dvt_RowCount" select="count($Rows)" />
<xsl:variable name="IsEmpty" select="$dvt_RowCount = 0" />
<xsl:call-template name="dvt_1.footer">
<xsl:with-param name="Rows" select="$Rows" />
</xsl:call-template>
</xsl:template>
<xsl:template name="percentformat">
<xsl:param name="percent"/>
<xsl:choose>
<xsl:when test="format-number($percent, '#,##0%;-#,##0%')= 'NaN'">0%</xsl:when>
<xsl:otherwise>
<xsl:value-of select="format-number($percent, '#,##0%;-#,##0%')" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="ChartRow">
<xsl:param name="RowName"></xsl:param>
<xsl:param name="Value"></xsl:param>
<xsl:param name="PercentValue"></xsl:param>
<tr>
<td class="ms-formbody" width="125px" style="vertical-align:middle">
<xsl:value-of select="$RowName"/>: <xsl:value-of select="$Value" />
<xsl:text xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:nbsp-preserve="yes" disable-output-escaping="yes">&nbsp;
</xsl:text>(<xsl:call-template name="percentformat"><xsl:with-param name="percent" select="$PercentValue"/></xsl:call-template>)
</td>
<td>
<table width="100%" >
<tr>
<td width="{round($PercentValue*100)+1}%" height="15px" class="ms-selected">
<xsl:text xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:nbsp-preserve="yes" disable-output-escaping="yes">&nbsp;</xsl:text>
</td>
<td width="100%" >
<xsl:text xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:nbsp-preserve="yes" disable-output-escaping="yes">&nbsp;</xsl:text>
</td>
</tr>
</table>
</td>
</tr>
</xsl:template>
<xsl:template name="dvt_1.footer">
<xsl:param name="ParentPath" />
<xsl:param name="Rows" />
<xsl:variable name="NotStarted" select="count(/dsQueryResponse/Rows/Row[normalize-space(@Status) = 'Initiated'])" />
<xsl:variable name="InProgress" select="count(/dsQueryResponse/Rows/Row[normalize-space(@Status) = 'Engaged'])" />
<xsl:variable name="Completed" select="count(/dsQueryResponse/Rows/Row[normalize-space(@Status) = 'Resolved'])" />
<xsl:variable name="Deferred" select="count(/dsQueryResponse/Rows/Row[normalize-space(@Status) = 'Closed'])" />
<xsl:variable name="AllTasks" select="count(/dsQueryResponse/Rows/Row)" />
<xsl:variable name="percentNotStarted" select="$NotStarted div $AllTasks" />
<xsl:variable name="percentInProgress" select="$InProgress div $AllTasks" />
<xsl:variable name="percentCompleted" select="$Completed div $AllTasks" />
<xsl:variable name="percentDeferred" select="$Deferred div $AllTasks" />
<table width="100%" cellspacing="0" cellpadding="2" style="border-right: 1 solid #C0C0C0; border-bottom: 1 solid #C0C0C0; border-left-style: solid; border-left-width: 1; border-top-style: solid; border-top-width: 1;">
<xsl:call-template name="ChartRow">
<xsl:with-param name="RowName">Initiated</xsl:with-param>
<xsl:with-param name="Value"><xsl:value-of select="$NotStarted"/></xsl:with-param>
<xsl:with-param name="PercentValue"><xsl:value-of select="$percentNotStarted"/></xsl:with-param>
</xsl:call-template>
<xsl:call-template name="ChartRow">
<xsl:with-param name="RowName">Engaged</xsl:with-param>
<xsl:with-param name="Value"><xsl:value-of select="$InProgress"/></xsl:with-param>
<xsl:with-param name="PercentValue"><xsl:value-of select="$percentInProgress"/></xsl:with-param>
</xsl:call-template>
<xsl:call-template name="ChartRow">
<xsl:with-param name="RowName">Resolved</xsl:with-param>
<xsl:with-param name="Value"><xsl:value-of select="$Completed"/></xsl:with-param>
<xsl:with-param name="PercentValue"><xsl:value-of select="$percentCompleted"/></xsl:with-param>
</xsl:call-template>
<xsl:call-template name="ChartRow">
<xsl:with-param name="RowName">Closed</xsl:with-param>
<xsl:with-param name="Value"><xsl:value-of select="$Deferred"/></xsl:with-param>
<xsl:with-param name="PercentValue"><xsl:value-of select="$percentDeferred"/></xsl:with-param>
</xsl:call-template>
</table>
</xsl:template>
<xsl:template name="dvt_1.header">
<xsl:param name="ParentPath" />
<xsl:param name="Rows" />
<table cellSpacing="0" cellPadding="2" border="0" width="365px" >
<tr>
<td class="ms-formfieldlabel">
<p>
<strong>Overall Task Status</strong>
</p>
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>
|
|
|
|
|
How can i insert data from textbox into xml datatype column using asp.net? Also how can i select the data from xml datatype in the datagrid?
Any one can help me plz....
|
|
|
|
|
Hi,
Without going into the complexity of Schema you could do the following:
INSERT INTO TableName values('lt root /gt')
lt = <
gt = >
Note: the value should be a valid XML documents or XML fragment (e.g. an XML document that doesn't have a root)
for more information about XML, you can try this website http://jameleon.sourceforge.net/xmlBasics.html[^]
about getting XML from datagrid, sorry I didn't understand your question, please explain it more.
Hope this helps
|
|
|
|
|
i want to insert data from textbox into xml datatype column in database.
i tried the coding for this... But it accepts the data with tags( Root> ).If we enter without the tag, it is showing error.
|
|
|
|
|
hello,
I am new to both the xml and C#.net technologies. I am generating a xml file in c#.net.I am trying to generate a xml file whose first/root node should look like this:
<tns:schedule xmlns:tns="http://www.sample.com/Schedule" xmlns:dt="http://www.sample.com/DataTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sample.com/Schedule Schedule.xsd" scheduleType="Playback" version="1.0" creationTime="2006-01-29T00:00:00" originator="sample">
<scope startTime="2006-01-29T04:00:00" stopTime="2006-01-29T06:00:00" />
I am using the xmlWriter class to generate the xml. The data for xml is taken from the structure which is filled by the program itself.
<u>My code is as follows:</u>
private void generateXml()
{
TreeNode tempNode,selectedNode;
frmFindByProgram.stProgram stTemp = new frmFindByProgram.stProgram();
selectedNode=new TreeNode();
tempNode = new TreeNode();
XmlTextWriter writer = new XmlTextWriter("E:\\Projects\\Project1\\July\\26\\ScheduleDemo\\NewXML.xml", new System.Text.UTF8Encoding());
//Write the header information
writer.WriteStartDocument();
//Write the root node
writer.WriteStartElement("tns", "schedule","http://www.sample.com/Schedule");
//use the record structure
int i = 0, count;
count = xmlSlotNodes.Count;
// sort the slots according to there callSign
xmlSlotNodes.Sort(0,count,new Sorting ());
string[] prgmTime = new string[2];
stTemp = (frmFindByProgram.stProgram)xmlSlotNodes[i];
selectedNode=getClickedNode();
writer.Formatting = Formatting.Indented;
writer.WriteStartElement("CruiseLine");
// writer.WriteAttributeString("Id", selectedNode.Text );
writer.WriteAttributeString ("Name",selectedNode.Parent.Text);
writer.WriteStartElement("Ship");
writer.WriteAttributeString("Name", selectedNode.Text );
writer.WriteStartElement("Channel");
writer.WriteStartElement("CallSign");
writer.WriteAttributeString("Value", stTemp.CallSign);
prgmTime = stTemp.Duration.Split('-');
do
{
stTemp = (frmFindByProgram.stProgram)xmlSlotNodes[i];
prgmTime = stTemp.Duration.Split('-');
writer.WriteStartElement("Program");
writer.WriteAttributeString("Id", stTemp.ProgramID);
writer.WriteAttributeString("Title", stTemp.Title);
writer.WriteAttributeString("AssetName", stTemp.AssetName);
writer.WriteAttributeString("StartTime", prgmTime[0].ToString());
writer.WriteAttributeString("EndTime", prgmTime[1].ToString());
writer.WriteEndElement();
//Write some white space between nodes
writer.WriteWhitespace("\n");
tempNode =selectedNode;
selectedNode = getClickedNode();
-----
-----
---
writer.close();
}
<u>my output file, NewXML.xml file contains the following </u>:
<?xml version="1.0" encoding="utf-8" ?>
- <tns:schedule xmlns:tns="http://www.sample.com/Schedule" >
- <CruiseLine Name="Carnival">
- <Ship Name="Celebration">
- <Channel>
- <CallSign Value="ABC">
<Program Id="104" Title="assde4" AssetName="asset4" StartTime="01:30" EndTime="02:00" />
</CallSign>
......
</tns:schedule>
<u>In order to modify the root/first node's information as given in the my sample file....</u>
i added new line to the code that is at:
//Write the root node
writer.WriteStartElement("tns", "schedule","http://www.sample.com/Schedule");
writer.WriteAttributeString("dt",null,"http://www.sample.com/DataTypes");
- <tns:schedule d1p1:dt="" xmlns:d1p1="http://www.sample.com/DataTypes" xmlns:tns="http://www.sample.com/Schedule">
i don't know from where this d1p1 got inserted and also why this attribute instead of getting appended is becoming the first attribute of the root element.
Please can anyone help me out.I am trying it from last 4 days.. please try to help me soon.
Thank you.
Anee
<u></u>
Anee
|
|
|
|
|
I am writing the following code for creating the XML file.
HRESULT hr;
IXMLDOMDocumentPtr pXMLDoc = NULL;
CoInitialize(NULL);
hr=pXMLDoc.CreateInstance("msxml2.domdocument");
IXMLDOMNodePtr pRootNode= NULL;
IXMLDOMNodePtr pRecNode= NULL;
IXMLDOMNodePtr pRecNode1= NULL;
IXMLDOMElementPtr pElement=NULL;
_variant_t varNodeType((short)MSXML2::NODE_ELEMENT);
hr= pXMLDoc->createNode(varNodeType,
_T("RTCS"), _T("Remote Target Control System"),&pRootNode);
hr=pXMLDoc->createElement(_T("Connection"),&pElement);
IXMLDOMAttributePtr pRecIdAttr = NULL;
IXMLDOMNamedNodeMapPtr pattributeMap;
hr=pXMLDoc->createAttribute(_T("connect"),&pRecIdAttr);
hr=pRecIdAttr->put_nodeTypedValue(_variant_t(_T("connect_val")));
hr=pElement->get_attributes(&pattributeMap);
hr=pattributeMap->setNamedItem(pRecIdAttr,&pRecNode);
hr=pXMLDoc->appendChild(pRootNode,&pRecNode);
but i am not able to see the child node created in the xml file.Only root node is created:
The xml file i want to create is:
?xml version="1.0"?>
<rtcs name="Remote Target Control System">
<Connection connect= "connectval" ipaddress = "ip_addresss" Port = "port_number"/>
<Logging Directory="path" Level="level" ComPort="port_number" Maxsize="max_size"/>
<Video BitRate="bitrate" InputType="input_type" Preview="preview" FrameDrop="frame_drop" Dumping ="dump"/>
<IR directory_path="dir_path"/>
</rtcs
|
|
|
|
|
I have the following webservice which gets a xml payload I would like to take that payload validate it against a schema then send it to websphere MQ. I have a good portion working but when I write the payload to MQ its empty almost like I am not able to get the information being sent in. Here is the code I am using and any help would be great as I have hit a road block and still pretty new to all this.
/// <remarks>
[System.Web.Services.Protocols.SoapHeaderAttribute("payloadManifest", Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
[System.Web.Services.WebMethodAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://arknet.arkona.com/wsTransport/service/ProcessMessage", RequestNamespace="http://www.starstandards.org/webservices/2005/10/transport", ResponseNamespace="http://www.starstandards.org/webservices/2005/10/transport", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, Binding="starTransport")]
public virtual void ProcessMessage([System.Xml.Serialization.XmlElementAttribute(ElementName="payload")] ref Payload payload)
{
//Here is the Code that reads the XML Payload Stream and Validates it to the correct Schema before sending the message forward.
//System.Xml.XmlElement xe = payload.content[0].Any;
//XmlDocument xmlDoc = xe.OwnerDocument;
//xmlDoc.Schemas.Add(null, "http://localhost/wsTransport/ProcessCRM.xsd");
//xmlDoc.Validate(delegate(object sender, ValidationEventArgs vargs)
//{
// Console.WriteLine("{0}: {1}", vargs.Severity, vargs.Message);
//}, xe);
System.Xml.XmlElement xe = payload.content[0].Any;
XmlDocument xmlDoc = xe.OwnerDocument;
string qManager = "ARKDEV.QUEUE.MANAGER";
string channel = "SYSTEM.ADMIN.SVRCONN";
string hostName = "arkdev.arkona.com";
string qName = "ROB.IN.QUEUE";
MQEnvironment.Hostname = (hostName);
MQEnvironment.Channel = (channel);
MQEnvironment.Port = 1414;
try
{
MQQueueManager qMgr = new MQQueueManager(qManager);
MQQueue queue = qMgr.AccessQueue(qName, MQC.MQOO_OUTPUT);
MQMessage msgData = new MQMessage();
msgData.WriteString(xmlDoc.OuterXml);
MQPutMessageOptions pmo = new MQPutMessageOptions();
queue.Put(msgData, pmo);
queue.Close();
qMgr.Close();
}
catch (MQException e)
{
Console.WriteLine("Error: {0}", e.ToString());
}
}
Thanks for taking the time to look at this and any help would be great
|
|
|
|
|
Hi Guys,
I am not that good with xPath, so please don't laugh at my question
Trying to query an XmlNode to find a given element's parent's attribute...
For example:
<root>
<parent name="Mom">
<kid>Mike</kid>
<kid>Rose</kid>
</parent>
</root>
Basically, I'm trying to find the name of "Mike's" parent (Mom). If you can help me out, thank you so much... thousand kisses to you!
Grapes
|
|
|
|
|
You use parent::node() :
using namespace System;
using namespace System::Xml;
int main(array<System::String ^> ^args)
{
String^ xmlString =
"<root>"
" <parent name=\"Mom\">"
" <kid>Mike</kid>"
" <kid>Rose</kid>"
" </parent>"
"</root>";
XmlDocument^ xmlDoc = gcnew XmlDocument;
xmlDoc->LoadXml(xmlString);
XmlNodeList^ children = xmlDoc->SelectNodes("/root/parent/kid");
for each (XmlNode^ child in children)
{
XmlNode^ parent = child->SelectSingleNode("parent::node()");
if (parent != nullptr)
{
Console::WriteLine("{0}'s parent is good old {1}.", child->InnerText,
parent->Attributes->GetNamedItem("name")->Value);
}
}
return 0;
}
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Thanks alot George!!
Grapes
|
|
|
|
|