#1
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    May 2009
    Posts
    2
    Rep Power
    0

    ASP/C#: Code for reading xml code doesnít work anymore


    Hi

    I have a confused problem I donít understand. Hope you can help me.

    I wrote a code to read a XML-stream which I get from a server. Everything works fine. Now there is a new program on the server and the XML-stream gets now one attribute in the first node (see below).

    About this little attribute my code doesnít work anymore. Why?

    Code:
    XmlDocument doc = new XmlDocument();
    doc.Load(Server.MapPath(responseStream));
    
    XPathNodeIterator nodeItor;
    XPathNavigator nav = doc.CreateNavigator();
    
    String type = "";
    nodeItor = nav.Select(".//TYPE");
    if (nodeItor.MoveNext())
    {
      type = nodeItor.Current.Value.ToString();
    }
    
    XmlNodeList elemList;
    if (type.Equals("2") || type.Equals("3"))
      elemList = doc.SelectNodes(".//TAB_6");
    else
      elemList = doc.SelectNodes(".//TAB_20");
      
    GridView1.DataSource = ConvertXmlNodeListToDataTable(elemList);
    My old XML-Stream (works fine with the code):
    Code:
    <Result>
       <MODUL>
           <INFONR>05</INFONR>
    	<TYPE>2</TYPE>
      	<FZNR>97</FZNR>
    	<KGS>08128139</KGS>
      	<TAB_6>
        	   <T_NAME>Green</T_NAME>
    	   ...
      	</TAB_6>
    	<TAB_6>
        	   <T_NAME>Ford</T_NAME>
    	   ...
       	</TAB_6>
      	...
    My new XML-Stream (don't work):
    Code:
    <Result xmlns="http://schemas.datacontract.org/2004/07/ABC">
       <MODUL>
           <INFONR>05</INFONR>
    	<TYPE>2</TYPE>
      	<FZNR>97</FZNR>
    	<KGS>08128139</KGS>
      	<TAB_6>
        	   <T_NAME>Green</T_NAME>
    	   ...
      	</TAB_6>
    	<TAB_6>
        	   <T_NAME>Ford</T_NAME>
    	   ...
      	</TAB_6>
      	...
    Thanks
    Mel
  2. #2
  3. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    May 2009
    Posts
    2
    Rep Power
    0
    Can nobody help me?

    About the

    Code:
    xmlns="http://schemas.datacontract.org/2004/07/ABC"
    I don't get any results from the XML.

    Without the xmlns I would get all the results.

Similar Threads

  1. alternative piece of code that will work in IE4
    By Steve Schofield in forum ASP Development
    Replies: 1
    Last Post: July 23rd, 2001, 11:59 AM
  2. alternative piece of code that will work in IE4
    By Steve Schofield in forum ASP Development
    Replies: 1
    Last Post: July 19th, 2001, 11:29 AM
  3. Here's a snipit of code ...why won't it work?!
    By Steve Schofield in forum ASP Development
    Replies: 1
    Last Post: December 8th, 2000, 06:43 PM
  4. Can't get code for paging with index server to work
    By Steve Schofield in forum ASP Development
    Replies: 1
    Last Post: May 12th, 2000, 09:34 AM
  5. I'm stumped....Code doesn't work right.
    By Steve Schofield in forum ASP Development
    Replies: 1
    Last Post: March 16th, 2000, 12:58 PM

IMN logo majestic logo threadwatch logo seochat tools logo