Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Navigate XML content
Message
 
To
24/08/2008 10:59:28
General information
Forum:
ASP.NET
Category:
XML
Environment versions
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01341375
Message ID:
01341390
Views:
19
> I have XML content as below:-
<?xml version="1.0" encoding="utf-8" ?>
<PlugInEvents>
	<PlugInEvent>
		<Name>Application.Startup</Name>
		<Description>Occurred when application startup</Description>
		<MustImplementTypes>
			<MustImplementType>
				<Type>IApplication</Type>
				<EventHandler>Startup</EventHandler>
				<Assembly>c:\\aaa.dll</Assembly>
			</MustImplementType>
		</MustImplementTypes>
	</PlugInEvent>
</PlugInEvents>
> How could I navigate it in order to show them like this ...
Name: Application Startup
Description: Occurred when application startup
Must Implement: 
      Type: IApplication
      EventHandler: Startup
      Assembly: C:\\aaa.dll
-----------------------
Hi there,
imagine your file name is "xmlNav.xml"
One way to show it, is as following:
...
using System.Data.SqlClient;
...

DataSet myXML = new DataSet();
myXML.ReadXml("xmlNav.xml");

StringBuilder myXMLstr = new StringBuilder();
foreach (DataColumn peClmn in myXML.Tables["PlugInEvent"].Columns)
   if (peClmn.Caption != "PlugInEvent_Id")
      myXMLstr.Append(peClmn.ToString() + ": " + myXML.Tables["PlugInEvent"].Rows[0][peClmn] + "\r\n");
            
myXMLstr.Append("Must Implement:" + "\r\n");

string mySpc = new string(' ', 6);
foreach (DataColumn iTypeClmn in myXML.Tables["MustImplementType"].Columns)
   if (iTypeClmn.Caption != "MustImplementTypes_Id")
      myXMLstr.Append(mySpc + iTypeClmn.ToString() + ": " + myXML.Tables["MustImplementType"].Rows[0][iTypeClmn] + "\r\n");

MessageBox.Show(myXMLstr.ToString());
You can also use XML Stream Reader.

Hope it helps
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform