| | |
XML Namespace prefix problem
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jun 2007
Posts: 1
Reputation:
Solved Threads: 0
Hi,
I have an xml which looks like this:
<Events>
<Event xmlns="http://abc.com">
<System>
<Name ="abc" />
</System>
<Manager>
<Name ="abc1" />
</System>
</Event>
</Events>
I use the following code to obtain the System node and it fails
XmlDocument document = new XmlDocument();
document.Load("c:\\results.xml");
XmlNodeList tmp1 = document.GetElementsByTagName("Event");
foreach (XmlNode k in tmp1)
{
XmlNode a = k.SelectSingleNode("System");
<<---------- a always returns NULL-------------->>
<< if I add a prefix to the URI, or remove the namespace URI from the results.xml, then it works, however, this is the XML i need to parse, any ideas. >>
if (a != null)
What am I doing wrong?
I have an xml which looks like this:
<Events>
<Event xmlns="http://abc.com">
<System>
<Name ="abc" />
</System>
<Manager>
<Name ="abc1" />
</System>
</Event>
</Events>
I use the following code to obtain the System node and it fails
XmlDocument document = new XmlDocument();
document.Load("c:\\results.xml");
XmlNodeList tmp1 = document.GetElementsByTagName("Event");
foreach (XmlNode k in tmp1)
{
XmlNode a = k.SelectSingleNode("System");
<<---------- a always returns NULL-------------->>
<< if I add a prefix to the URI, or remove the namespace URI from the results.xml, then it works, however, this is the XML i need to parse, any ideas. >>
if (a != null)
What am I doing wrong?
![]() |
Similar Threads
- XML data to database (RSS, Web Services and SOAP)
- VB.NET Error (ASP.NET)
- Problem when handling with processes! (C)
- xsl-fo (DaniWeb Community Feedback)
- getattr function (Python)
- Regular Expression Matching New Line (Perl)
- Brain Dead Night (C++)
Other Threads in the ASP.NET Forum
- Previous Thread: A suitable Word Template
- Next Thread: delete a row in a sql databse
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 3.5 activexcontrol advice ajax alltypeofvideos anathor asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox child click commonfunctions compatible confirmationcodegeneration content contenttype courier css database datagrid datagridview datagridviewcheckbox datalist deadlock development dgv dropdown dropdownlist dropdownmenu edit expose feedback flash flv folder form formatdecimal forms formview google grid gridview homeedition hosting iframe iis javascript jquery list login menu microsoft mono mssql multistepregistration nameisnotdeclared numerical objects order panelmasterpagebuttoncontrols project ratings refer rotatepage save schoolproject search security serializesmo.table silverlight smartcard sqlserver2005 suse textbox tracking typeof unauthorized validation vb.net video view virtualdirectory vista visual-studio visualstudio web webarchitecture webdevelopemnt webservice xml youareanotmemberofthedebuggerusers





