Archives

Archives / 2004 / May
  • My Latest RSS article

    Good news: My latest RSS article has been approved by ASPToday.com. However it is not online yet and I don't know when it is scheduled. I will notify you guys when it is live or when I know the publication date. Stay tuned!

    Sonu

  • How can I retrieve specific nodes when having a namespace in the xml element?

    If you have the following xml file which contains a xmlns parameter, then you can't use simple SelectSingleNode to retrieve a specific node.

    Used Classes:

    XmlDocument
    XmlNode
    XmlNamespaceManager

    XML File:

    <?xml version="1.0" encoding="utf-8" ?>
    <OfferSheetXML xmlns="
    http://localhost/OfferSheetSchema.xsd" >
      <Offer>
        <OfferSheetId>31</OfferSheetId>
      </Offer>
    </OfferSheetXML>


    Now try to run the following code with the above xml:

    <%@ Import Namespace="System.Xml"%>
    <%@ Page Language="C#" Debug="true"%>

    <script runat="server">
    void Page_Load(object sender, System.EventArgs e)
    {
        XmlDocument xmlDoc = new XmlDocument();
        xmlDoc.Load(Server.MapPath("temp.xml"));

        XmlNode node = xmlDoc.SelectSingleNode("//OfferSheetXML");
        Response.Write ("Node Name : " + node.Name);
    }
    </script>


    Running the above code will generate the following error message:

    System.NullReferenceException: Object reference not set to an instance of an object.
    Line 16:  Response.Write ("Node Name : " + node.Name);


    The solution is that you will also have to specifiy the namespace for the xpath. The following code solves the problem and retrives the node:

    <%@ Import Namespace="System.Xml"%>
    <%@ Page Language="C#" Debug="true"%>

    <script runat="server">
    void Page_Load(object sender, System.EventArgs e)
    {
        XmlDocument xmlDoc = new XmlDocument();
        xmlDoc.Load(Server.MapPath("temp.xml"));

        XmlNamespaceManager nsmRequest = new XmlNamespaceManager(xmlDoc.NameTable);
        nsmRequest.AddNamespace("ns1", "
    http://localhost/OfferSheetSchema.xsd");
        XmlNode node = xmlDoc.SelectSingleNode("//ns1:OfferSheetXML", nsmRequest);

        Response.Write ("Node Name : " + node.Name);
    }
    </script>


    Thanks to Kevin Yu for his help.

  • ASM: Admin Interface

    I just uploaded the second version of ASM. In this version I have implemented some admin interfaces. Please note that I do not mean that the project is complete. It's very far from a completion. Please take a look what I have written so far and tell me your oppinion.

    Sonu

  • How to sort an XML using XPathExpression?

    If you want to sort a XML document you have two options (at least these are the two options I know). The first would be to pass a sort parameter to the XSLT and the XSLT would do the sorting for us. The second one would be to use the XPathExpression class which provides a function called AddSort. This function does the sorting for us. This how to shows the second option!

    Used Classes:

    XPathDocument
    XPathExpression
    XPathNavigator
    XPathNodeIterator

    XML File:

    <?xml version="1.0" encoding="utf-8"?>
    <CategoryList>
      <Category ID="01">
     <Title>One</Title>
      </Category>
      <Category ID="03">
     <Title>Three</Title>
      </Category>
      <Category ID="04">
     <Title>Four</Title>
      </Category>
      <Category ID="02">
     <Title>Two</Title>
      </Category>
    </CategoryList>

    Code:

    XPathDocument xpathDoc = new XPathDocument(Server.MapPath("categories.xml"));
    XPathNavigator nav = xpathDoc.CreateNavigator();

    XPathExpression expr;
    expr = nav.
    Compile("CategoryList/Category");

    //Sort Category by ID.
    expr.AddSort("@ID", XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Text);

    XPathNodeIterator iterator = nav.Select(expr);
    while (iterator.
    MoveNext
    ()){
        Response.Write("Attribute = ");
        Response.Write(iterator.Current.GetAttribute("ID",""));
        Response.Write(" Title = ");
        Response.Write(iterator.Current.Value);
        Response.Write("<br>");
    }

    Output:

    Attribute = 01 Title = One
    Attribute = 02 Title = Two
    Attribute = 03 Title = Three
    Attribute = 04 Title = Four

  • How to remove xml elements using RemoveChild()?

    This how to shows how to remove some xml nodes:

    Used Classes:

    XmlDocument
    XmlNode

    XML File:


    <?xml version="1.0" encoding="utf-8"?>
    <CategoryList>
      <Category ID="01">
        <MainCategory>XML</MainCategory>
        <Description>This is a list my XML articles.</Description>
        <Active>true</Active>
      </Category>
    </CategoryList>


    Code:

    XmlDocument xmlDoc = new XmlDocument();
    xmlDoc.Load(Server.MapPath("categories.xml"));
     
    XmlNode node = xmlDoc.SelectSingleNode("/CategoryList/Category[@ID='01']");
    XmlNode commonParent = node.ParentNode;

    if(node != null)
    {
        commonParent.RemoveChild(node);
    }

    xmlDoc.Save(Server.MapPath("categories.xml"));

  • When will I get my GMail account?

    In the last time I recognized that everybody is getting an invitation for the GMail email account. Marcie got one few days ago and now Travis got one too. When will I get one? If somebody has the power to get me one, I would really appreciate that.

    Sonu

  • My official applogize to Kirk Allen Evan

    Some days ago I wrote an article about binding nested xml elements with Container.DataItem. Unfortunaly I forgot ( I really forgot ) to mention his reference in the article. I want to say that I didn't wanted to steal your code or something like that. Before writing the article I also posted my problem with your solution on my blog and referenced your blog entry which shows the date 5/10/2004 1:56 PM . If I really wanted to steal your code then I wouldn't even referenced you in that post of mine. So once again, I am really really sorry that I forgot to reference you. Next time I will remember that!

    Sonu

  • How to perform a case-sensitive search with XPath?

    Used Classes:

    XmlDocument
    XmlNodeList

    XML File:

    <?xml version="1.0" encoding="utf-8"?>
    <Users>
      <User>
        <Name>sonu</Name>
        <Password>sonu</Password>
      </User>
    </Users>


    Code:

    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Xml" %>
    <%@ Page Language="C#" Debug="true" %>

    <script  runat="server">
    void Page_Load(object sender, System.EventArgs e){
        if(!Page.IsPostBack){
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(Server.MapPath("user.xml"));
     
            XmlNodeList nodeList = xmlDoc.SelectNodes("Users/User[Name = translate('SONU', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')]");

            Response.Write(nodeList.Count.ToString());
        }
    }
    </script>

  • How to use XPath with XML and XSL?

    Ever wondered how this can be achieved? Just imagine a scenario where you would need to pass the xpath to xslt so that you query out some specific nodes or imagine that you need to pass the sort arguments to xslt so that you can sort the contents according the user needs. For that purpose I have written this small xml 'how to' which shows how this can be achieved. I would like to thank Don Kiely for his support.

    How to use XPath with XML and XSL?

    Sonu

  • How to use XPath with XML and XSL?

    This snippet of code shows you how to transform a xpath query to a xsl sheet. Thanks to Don Kiely for his support.

    Used classes:

    XPathDocument
    XslTransform
    XPathNavigator
    XsltArgumentList

    XML File:

    <?xml version="1.0" encoding="utf-8"?>
    <CategoryList>
      <Category>
        <MainCategory>1</MainCategory>
        <Description>This is a list my ASP.NET articles.</Description>
        <Active>true</Active>
      </Category>
      <Category>
        <MainCategory>2</MainCategory>
        <Description>This is a list my XML articles.</Description>
        <Active>true</Active>
      </Category>
      <Category>
        <MainCategory>3</MainCategory>
        <Description>This is a list my C# articles.</Description>
        <Active>true</Active>
      </Category>
    </CategoryList>


    XSLT File:

    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="
    http://www.w3.org/1999/XSL/Transform">
    <xsl:param name="strXPath" />

    <xsl:template match="/">
     <xsl:for-each select="$strXPath">
      <xsl:value-of select="Description"/><br/>
        </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>


    Code:

    XPathDocument xmlDoc= new XPathDocument(Server.MapPath("categories.xml"));
       
    XslTransform xslt = new XslTransform();
    xslt.Load(Server.MapPath("categories.xslt"));

    XPathNavigator nav = xmlDoc.CreateNavigator();
       
    XsltArgumentList arguments = new XsltArgumentList();
    arguments.AddParam("strXPath", "", nav.Select("CategoryList/Category[MainCategory='1']"));

    MemoryStream ms = new MemoryStream();
    xslt.Transform( nav, arguments, ms, null);
    ms.Seek( 0, SeekOrigin.Begin );

    StreamReader sr = new StreamReader(ms);
    Response.Write(sr.ReadToEnd());


    Output:

    This is a list my ASP.NET articles.

  • How to use XPath correctly?

    Note: Don't use the XmlDocument class if you are going to work with xpath queries. .NET has his own class for that purpose called XPathDocument. The class does not run any validation checking. When using xpath you should avoid the // to reduce the search. The reason for that is that the // searches the complete document.

    Used Classes:

    XPathDocument
    XPathNavigator
    XPathNodeIterator

    Code:

    XPathDocument Doc = new XPathDocument(FileName);
    XPathNavigator nav = Doc.CreateNavigator();
    XPathNodeIterator Iterator = nav.Select("/bookstore/book");
    while (Iterator.MoveNext())
    {
        Console.WriteLine(Iterator.Current.Name);
    }

    Source:[MSDN]

  • My Article Management Project on GotDotNet

    I created yesterday night a new GotDotNet project. This project will be used to build a Article Management System (AMS). This is similar to a content management system. This system is based on XML and XSL. We will not use any SQL Server or any other database - only pure XML :) For that project I would require some more members which would help me to build this system. The goal of AMS is to learn and to provide a useful solution that may others want to use on their websites. If you are interested to work with me on this project please visit the AMS workspace.

    Thanks, Sonu

  • How to create a xml on the fly?

    Used Classes:

    XmlDocument
    XmlDeclaration

    Code:

    XmlDocument myDoc = new XmlDocument();
    myDoc.LoadXml("<root>test</root>");
    XmlDeclaration myDeclaration = myDoc.CreateXmlDeclaration("1.0","utf-8",null);
    myDoc.InsertBefore(myDeclaration, myDoc.DocumentElement);


    The above code will create this:

    <?xml version="1.0" encoding="utf-8" ?>
    <root>test</root>

  • How to use '&' in a xml file?

    The ampersand sign is not valid in xml. You have to escape the ampersand using '&amp;'.

    This will not work:

    <example>Barnes & Nobles </example>

    But this will:

    <example>Barnes &amp; Nobles </example>

  • How to update an xml file with XmlDocument?

    Used Classes

    XmlDocument
    XmlNodeList

    Before running the code our xml looks like this:

    <?xml version="1.0" encoding="utf-8"?>
    <CategoryList>
      <Category ID="01">
        <MainCategory>XML</MainCategory>
        <Description>This is a list my XML articles.</Description>
        <Active>true</Active>
      </Category>
    </CategoryList>

    After running the code our xml becomes this:

    <?xml version="1.0" encoding="utf-8"?>
    <CategoryList>
      <Category ID="01">
        <MainCategory>ASP.NET</MainCategory>
        <Description>This is now my ASP.NET list.</Description>
        <Active>false</Active>
      </Category>
    </CategoryList>


    The code which does that looks like this:

    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Xml" %>
    <%@ Page Language="C#" Debug="true" %>

    <script  runat="server">
    void Page_Load(object sender, System.EventArgs e){
        if(!Page.IsPostBack){
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(Server.MapPath("categories.xml"));

            XmlNodeList nodeList = xmlDoc.SelectNodes("/CategoryList/Category[@ID='01']");

            // update MainCategory 
            nodeList[0].ChildNodes[0].InnerText = "ASP.NET";
            // update Description 
            nodeList[0].ChildNodes[1].InnerText = "This is now my ASP.NET list.";
            // update Active 
            nodeList[0].ChildNodes[2].InnerText = "false";

            // Don't forget to save the file
            xmlDoc.Save(Server.MapPath("categories.xml"));
            Response.Write("XML File updated!");
        }
    }
    </script>

  • How to Bind Nested XML to a Repeater Control with Container.DataItem?

    The container.DataItem is an easy-to-use method to bind XML to a control. You can use a repeater, list control, or any other control to bind the XML. If you have have worked with XML and a repeater control, you know what I am talking about. In this short "how to," I will show you how you can bind a nested XML element to a repeater control. But, first of all, let's see an example where we bind a simple XML to a repeater control. Read the complete article here.

    Sonu

  • How to Bind Nested XML to a Repeater Control with Container.DataItem?

    My article about binding nested xml elements with Container.DataItem has been published on CodeGuru. From the article:

    "The container.DataItem is an easy-to-use method to bind XML to a control. You can use a repeater, list control, or any other control to bind the XML. If you have have worked with XML and a repeater control, you know what I am talking about. In this short "how to," I will show you how you can bind a nested XML element to a repeater control. But, first of all, let's see an example where we bind a simple XML to a repeater control."

    Read the complete article here.

    Sonu

    I would like to thanks Kirk Allen for this great tip.

  • How to create a new xml file with XmlDocument?

    This code will create new xml file from scratch. The file does not exist now and will be created with the help of the class XmlDocument.

    Used Classes:

    XmlDocument
    XmlDeclaration
    XmlElement
    XmlText

    XML File:

    <?xml version="1.0" encoding="utf-8"?>
    <CategoryList>
      <Category ID="01">
        <MainCategory>XML</MainCategory>
        <Description>This is a list my XML articles.</Description>
        <Active>true</Active>
      </Category>
    </CategoryList>

    Code:

    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Xml" %>
    <%@ Page Language="C#" Debug="true" %>

    <script  runat="server">
    void Page_Load(object sender, System.EventArgs e){
        if(!Page.IsPostBack){
            XmlDocument xmlDoc = new XmlDocument();

            // Write down the XML declaration
            XmlDeclaration xmlDeclaration = xmlDoc.CreateXmlDeclaration("1.0","utf-8",null);

            // Create the root element
            XmlElement rootNode  = xmlDoc.CreateElement("CategoryList");
            xmlDoc.InsertBefore(xmlDeclaration, xmlDoc.DocumentElement); 
            xmlDoc.AppendChild(rootNode);

            // Create a new <Category> element and add it to the root node
            XmlElement parentNode  = xmlDoc.CreateElement("Category");

            // Set attribute name and value!
            parentNode.SetAttribute("ID", "01");

            xmlDoc.DocumentElement.PrependChild(parentNode);

            // Create the required nodes
            XmlElement mainNode  = xmlDoc.CreateElement("MainCategory");
            XmlElement descNode  = xmlDoc.CreateElement("Description");
            XmlElement activeNode  = xmlDoc.CreateElement("Active");

            // retrieve the text 
            XmlText categoryText= xmlDoc.CreateTextNode("XML");
            XmlText descText  = xmlDoc.CreateTextNode("This is a list my XML articles.");
            XmlText activeText  = xmlDoc.CreateTextNode("true");

            // append the nodes to the parentNode without the value
            parentNode.AppendChild(mainNode);
            parentNode.AppendChild(descNode);
            parentNode.AppendChild(activeNode);

            // save the value of the fields into the nodes
            mainNode.AppendChild(categoryText);
            descNode.AppendChild(descText);
            activeNode.AppendChild(activeText);

            // Save to the XML file
            xmlDoc.Save( Server.MapPath("categories.xml"));

            Response.Write("XML file created");
        }
    }
    </script>

  • How to auto-increment an unique ID in xml?

    Note: The XmlReader class is much faster than XmlTextReader and XmlValidatingReader if you need a fast non-cached stream access to the input. The XmlReader can read files larger than 2GB. The other classes are limited and can only read files less than 2GB. References: [msdn]

    Used Classes:

    XmlTextReader
    FileStream

    XML File:

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <employee>
       <person id="1">
         <firstname>Bob</firstname>
         <lastname>Jones</lastname>
         <active>true</active>
       </person>
       <person id="5">
         <firstname>Bob</firstname>
         <lastname>Jones</lastname>
         <active>true</active>
       </person>
       <person id="9">
         <firstname>Bob</firstname>
         <lastname>Jones</lastname>
         <active>true</active>
       </person> 
       <person id="15">
         <firstname>Bob</firstname>
         <lastname>Jones</lastname>
         <active>false</active>
       </person> 
    </employee>


    Code:

    private int GetNextNodeID()
    {
        // Read the xml file and lock it, so that somebody
        // else is not able to use it.
        FileStream file = new FileStream(Server.MapPath("test.xml"), FileMode.Open, FileAccess.ReadWrite, FileShare.None);

        XmlTextReader reader = new XmlTextReader(file);
        int nMaxID = 0; 
        while (reader.Read())
        {
            if (reader.IsStartElement() && reader.Name == "person")
            {
                int nID = Int32.Parse(reader.GetAttribute("id"));
                if(nMaxID < nID) nMaxID = nID;
            }
        }
        // Close the file. Now this file is again open for all.
        file.Close();
        nMaxID++;
        return nMaxID;
    }

    See also the following post for some interesting comments:
    How to Auto-Increment an Unique ID in XML Part I

  • How to Auto-Increment an Unique ID in XML Part III

    After reading a bit about the XmlReader class, I recognized that it is much faster then other classes. This class provides you a fast non-cached stream access to the input. Furthermore you can read files that are larger than 2GB. The XmlTextReader and XmlValidatingReader do not provide this, there are limited and can only read files less than 2GB. I have changed my previous code according to this and looks now like this:

    XML File:

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <employee>
       <person id="1">
         <firstname>Bob</firstname>
         <lastname>Jones</lastname>
         <active>true</active>
       </person>
       <person id="5">
         <firstname>Bob</firstname>
         <lastname>Jones</lastname>
         <active>true</active>
       </person>
       <person id="9">
         <firstname>Bob</firstname>
         <lastname>Jones</lastname>
         <active>true</active>
       </person> 
       <person id="15">
         <firstname>Bob</firstname>
         <lastname>Jones</lastname>
         <active>false</active>
       </person> 
    </employee>


    Code:

    private int GetNextNodeID()
    {
        // Read the xml file and lock it, so that somebody
        // else is not able to use it.
        FileStream file = new FileStream(Server.MapPath("test.xml"), FileMode.Open, FileAccess.ReadWrite, FileShare.None);

        XmlTextReader reader = new XmlTextReader(file);
        int nMaxID = 0; 
        while (reader.Read())
        {
            if (reader.IsStartElement() && reader.Name == "person")
            {
                int nID = Int32.Parse(reader.GetAttribute("id"));
                if(nMaxID < nID) nMaxID = nID;
            }
        }
        // Close the file. Now this file is again open for all.
        file.Close();
        nMaxID++;
        return nMaxID;
    }


    This code is also available in the XML How To's section.
    References: [msdn]

    Sonu

  • XML how to's !

    In the last time I have shown many small "how to's" about XML in my blog. Don't worry this will not stop. Instead I have created a new article section called "XML How To's. This section will include small snippets of xml code which I write and think will be useful for you. Each time I write a new "how to" I will make a post with the link so that you guys are always notified about that. Currently it already contains 5 how to's. More will follow.

    Sonu

  • How to use InsertAfter()?

    Used Classes:

    XmlDocument
    XmlNode
    XmlElement

    XML File:

    <?xml version="1.0" encoding="utf-8"?>
    <CategoryList>
      <Category>
        <MainCategory ID="3">XML</MainCategory>
        <Description>List of XML articles.</Description>
        <Active>Yes</Active>
      </Category>
    <CategoryList>


    Code:

    XmlDocument xmlDoc = new XmlDocument();
    xmlDoc.Load(Server.MapPath("../dbase/categories.xml"));

    string xmlQuery="/CategoryList/Category/MainCategory[@ID='"+ddlMainCategory.SelectedValue.ToString()+"']";

    XmlNode xmlNode = xmlDoc.SelectSingleNode(xmlQuery);   
    XmlElement xmlSubCat = xmlDoc.CreateElement("SubCategory");
    xmlSubCat.InnerText = txbSubCategories.Text;
    XmlNode commonParent = xmlNode.ParentNode;
    commonParent.InsertAfter(xmlSubCat, xmlNode);
    xmlDoc.Save(Server.MapPath("../dbase/categories.xml"));

  • How to bind a nested xml to a repeater control with Container.DataItem?

    Used Classes:

    XmlDocument
    XmlNodeList

    XML File:

    <?xml version="1.0" encoding="utf-8"?>
    <CategoryList>
      <Category>
        <MainCategory ID="3">XML</MainCategory>
        <Description>List of XML articles.</Description>
        <Active>Yes</Active>
      </Category>
    </CategoryList>

    Code:

    XmlDocument doc = new XmlDocument();
    doc.Load(Server.MapPath("dbase/categories.xml"));
    XmlNodeList nodes = doc.SelectNodes("CategoryList/Category/MainCategory");

    // rpDirectory is the repeater control
    rpDirectory.DataSource = nodes;
    rpDirectory.DataBind();


    And in the design view of the ASP.NET page:

    // Will return the ID 3
    <%# ((System.Xml.XmlNode)Container.DataItem).Attributes["ID"].Value %>
    // Will return XML
    <%# ((System.Xml.XmlNode)Container.DataItem).InnerXml %>

     

    Thanks to Kirk Allen Evan for this great tip!

  • How to write an xml document using XmlTextWriter?

    Used Classes:

    XmlTextWriter

    Code:

    private void btWriteXML_Click(object sender, System.EventArgs e)
    {
        XmlTextWriter xmlWriter = new XmlTextWriter(Server.MapPath("friends.xml"), null);

        // Format automatically
        xmlWriter.Formatting = Formatting.Indented;

        // Write root element
        xmlWriter.WriteStartElement("FriendsList");
        // Write first sub element of root element
        xmlWriter.WriteStartElement("Friend");

        // now start adding names 1.name
        xmlWriter.WriteElementString("Name","Michael");
        // 2.name
        xmlWriter.WriteElementString("Age","39");
     
        // write end elements
        xmlWriter.WriteEndElement();
        // close writer
        xmlWriter.Close();

        Response.Write("Xml Written");
    }

  • How to read the attribute value from an xml element?

    Used Classes:

    XmlNodeList

    XML File:

    <?xml version="1.0" encoding="utf-8"?>
    <CategoryList>
      <Category>
        <MainCategory ID="1">VC++</MainCategory>
        <Description>A list of VC</Description>
        <Active>Yes</Active>
      </Category>
    </CategoryList>


    Code:

    XmlNodeList nodes = xmlDoc.SelectNodes("/CategoryList/Category");
       
    for(int i=0;i<nodes.Count;i++)
    {
        // Will return VC++
        Response.Write(nodes.Item(i).ChildNodes[0].InnerText);
        // Will return 1
        Response.Write(nodes.Item(i).ChildNodes[0].Attributes["ID"].Value);
    }

  • How to read an xml file using XmlTextReader?

    Note: The XmlTextReader does not provide any validation for you. This is the reason why XmlTextReader provides a fast non-cached forward only access to the XML data.

    Used Classes:

    XmlTextReader

    Code:


    private void btReadXML_Click(object sender, System.EventArgs e)
    {
        XmlTextReader xmlReader = new XmlTextReader(Server.MapPath("cds.xml"));

        // Get rid of the first node which is <?xml version="1.0" encoding="ISO-8859-1"?>
        xmlReader.Read();
       
        Response.Write(xmlReader.AttributeCount);
        while(xmlReader.Read())
        {
          Response.Write(xmlReader.Value);
          Response.Write("<br>");

          // If you want to compare a XML tag
          // then you cant use the Value property
          // Instead use the ReadString() method

          if(xmlReader.Name == "ElementName")
                Response.Write(xmlReader.ReadString());
        }
    }

  • How to Auto-Increment an Unique ID in XML Part II

    After the great suggestions which I received in How to Auto-Increment an Unique ID in XML, I re-designed the code according to the suggestions. The current code will now also work with ID's that are not sequential and it will find the highest ID. If you are going to work with the code and xml, then I would recommend that you do not delete any elements, because this will create duplicate ID's. Instead you should set the active element to false. Here is the new XML file:

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <employee>
       <person id="1">
         <firstname>Bob</firstname>
         <lastname>Jones</lastname>
         <active>true</active>
       </person>
       <person id="5">
         <firstname>Bob</firstname>
         <lastname>Jones</lastname>
         <active>true</active>
       </person>
       <person id="9">
         <firstname>Bob</firstname>
         <lastname>Jones</lastname>
         <active>true</active>
       </person> 
       <person id="15">
         <firstname>Bob</firstname>
         <lastname>Jones</lastname>
         <active>false</active>
       </person> 
    </employee>


    And here is the new function:

    private int GetNextNodeID()
    {
        // Read the xml file and lock it, so that somebody
        // else is not able to use it.
        FileStream file = new FileStream(Server.MapPath("test.xml"), FileMode.Open, FileAccess.ReadWrite, FileShare.None);

        XmlTextReader reader = new XmlTextReader(file);

        XmlDocument xmlDoc = new XmlDocument();   
        xmlDoc.Load(reader);

        XmlNodeList nodes = xmlDoc.SelectNodes("/employee/person");
      
        int nMaxID = 0;  
        for(int i=0;i<nodes.Count;i++)
        {
            if(nMaxID < Int32.Parse(nodes[i].Attributes["id"].Value))
                nMaxID = Int32.Parse(nodes[i].Attributes["id"].Value);
        }
      
        // Close the file. Now this file is again open for all.
        file.Close();
        nMaxID++;
        return nMaxID;
    }


    Fire up your feedback ;)
    Sonu

    Note: This function is much slower when you work with many nodes.

  • How to Auto-Increment an Unique ID in XML

    In some cases you will need to create unique ID's for each node in your xml file. For example just think of something like an employee xml file. Let say your xml file looks like this (In the xml example, I assume that there will be always a person id.).

    <?xml version="1.0" encoding="ISO-8859-1"?>
      <employee>
       <person id="1">
         <firstname>Bob</firstname> 
         <lastname>Jones</lastname> 
       </person>
       <person id="2"> 
         <firstname>Bob</firstname> 
         <lastname>Jones</lastname>
       </person>
    </employee>

    And now you would like to create a function which returns the next ID for the person, which should be 3 in our case. For that purpose I wrote a small function which reads the total nodes and incremenets it with one. The function looks like this:

    private int GetNextNodeID()
    {
        XmlDocument doc = new XmlDocument();
        doc.Load(Server.MapPath("employee.xml"));
        XmlNodeList nodes = doc.SelectNodes("//employee/person");

        int nNodeID = nodes.Count;
        nNodeID++;

        return nNodeID;
    }

    Sonu

  • An Easy Guide to Use the XmlTextReader and XmlTextWriter Classes

    Last week I promised you to write a small article about the XmlTextReader and XmlTextWriter class. This article will show you how to use these classes with 2 small examples. I have already posted the code of the article here. But this was just the source code. So if you want a complete article then you should read it. The article also contains a visual studio project as an example to download. Read the complete article here.

    Sonu

  • InsertAfter() didn't worked the way I want !

    While working with the XML classes of .NET I needed to use the InsertAfter() function of XmlDocument to insert a new element after a specific existing element in my XML file. My XML file still looks like this:

    <?xml version="1.0" encoding="utf-8"?>
    <CategoryList>
      <Category>
        <MainCategory ID="3">XML</MainCategory>
        <Description>List of XML articles.</Description>
        <Active>Yes</Active>
      </Category>
    <CategoryList>

    Now I needed to insert a new element called SubCategory after the MainCategory element. For this purpose I choosed the InsertAfter() function. I used the following code but it doesn't worked.

    XmlDocument xmlDoc = new XmlDocument();
    xmlDoc.Load(Server.MapPath("../dbase/categories.xml"));

    string xmlQuery="/CategoryList/Category/MainCategory[@ID='"+ddlMainCategory.SelectedValue.ToString()+"']";
       
    XmlNode xmlNode = xmlDoc.SelectSingleNode(xmlQuery);
    XmlElement xmlSubCat = xmlDoc.CreateElement("SubCategory");
    xmlSubCat.InnerText = txbSubCategories.Text;
    xmlDoc.DocumentElement.InsertAfter(xmlSubCat, xmlNode);
    xmlDoc.Save(Server.MapPath("../dbase/categories.xml"));

    When running this code in the browser it always returned the following error:

    System.ArgumentException: The reference node is not a child of this node.

    And the error always referenced to the line where I call the InsertAfter function. I have tried several solutions but didn't get this worked. So I asked in the microsoft XML newsgroups and a member was able to help me. The problem was that the node on which I call the InsertAfter() method should be the parent of the reference node. Here is the modified code:

    XmlDocument xmlDoc = new XmlDocument();
    xmlDoc.Load(Server.MapPath("../dbase/categories.xml"));

    string xmlQuery="/CategoryList/Category/MainCategory[@ID='"+ddlMainCategory.SelectedValue.ToString()+"']";

    XmlNode xmlNode = xmlDoc.SelectSingleNode(xmlQuery);   
    XmlElement xmlSubCat = xmlDoc.CreateElement("SubCategory");
    xmlSubCat.InnerText = txbSubCategories.Text;
    XmlNode commonParent = xmlNode.ParentNode;
    commonParent.InsertAfter(xmlSubCat, xmlNode);
    xmlDoc.Save(Server.MapPath("../dbase/categories.xml"));

    Sonu

  • Bind a Nested Xml to a Repeater Control with Container.DataItem

    I am still working on my AMS system. If you have read my previous post "Get Attribute Value from XML" then you know how my XML looks like. If not here is it again:

    <?xml version="1.0" encoding="utf-8"?>
    <CategoryList>
      <Category>
        <MainCategory ID="3">XML</MainCategory>
        <Description>List of XML articles.</Description>
        <Active>Yes</Active>
      </Category>
    </CategoryList>

    Now I need to retrieve the ID of the element MainCategory and the value. For that purpose I used a repeater control to bind this xml. It is a simple straight forward code:

    DataSet dsCategories = new DataSet();
    dsCategories.ReadXml(Server.MapPath("dbase/categories.xml"));
    rpDirectory.DataSource = dsCategories;
    rpDirectory.DataBind();

    Then I used the following Databinder method to retrieve the value first.

    <%# DataBinder.Eval(Container.DataItem, "MainCategory") %>

    Unfortunaly when finally running the code in the browser, I always got the error message:

    System.Web.HttpException: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'MainCategory'.

    I could not understand that. My xml file above clearly shows that this element does exist. So where is the error?
    After a research on the net I saw a nice post from Kirk Allen, who described a solution for such problems. After reading through his post, I changed my code to the following and it worked like a charm - Thanks Kirk :)

    XmlDocument doc = new XmlDocument();
    doc.Load(Server.MapPath("dbase/categories.xml"));
    XmlNodeList nodes = doc.SelectNodes("CategoryList/Category/MainCategory");
    rpDirectory.DataSource = nodes;
    rpDirectory.DataBind();

    And in the design view of the asp.net page I used this code to retrive the Attribute value:

    <%# ((System.Xml.XmlNode)Container.DataItem).Attributes["ID"].Value %>

    and to retrive the value of the element I used this code.

    <%# ((System.Xml.XmlNode)Container.DataItem).InnerXml %>

    Sonu

    Thanks to Kirk Allen for this great tip.

  • Get Attribute Value from XML

    I am currently working on an Article Management System ( AVM ) in ASP.NET based on XML. This system will allow users to manage their articles. It will contain many features. I will make a separate post about that. While developing I needed to add some data from a XML file to a drop down list. Here is how my XML looks like:

    <?xml version="1.0" encoding="utf-8"?>
    <CategoryList>
      <Category>
        <MainCategory ID="1">VC++</MainCategory>
        <Description>A list of VC</Description>
        <Active>Yes</Active>
      </Category>
    </CategoryList>


    I needed to add the value of the element MainCategory to the drop down list. That task isn't very difficult, I used the SelectNodes function to get the values and stored it while iterating through a loop. This looked like this:

    XmlNodeList nodes = xmlDoc.SelectNodes("/CategoryList/Category");
    for(int i=0;i<nodes.Count;i++)
    {
        ddlMainCategory.Items.Add(nodes.Item(i).ChildNodes[0].InnerText);
    }


    But the above described approach will store the value with the same name as the elements value. In our case the value and the displayed data in the drop down list is VC++. And what if you want that the value of the list item is different from the list item displayed name? That was the approach I needed. For that purpose I needed the attribute ID. This attribute ID would be saved as the list item value. But how can I now get the attribute ID? Sure I could create a new query for the SelectNodes function and call it again. But that isn't really what I want. I wanted to use the function only one time. For that problem you can use the following code:

    XmlNodeList nodes = xmlDoc.SelectNodes("/CategoryList/Category");
       
    for(int i=0;i<nodes.Count;i++)
    {
        ddlMainCategory.Items.Add(new ListItem(
            nodes.Item(i).ChildNodes[0].InnerText, 
            nodes.Item(i).ChildNodes[0].Attributes["ID"].Value
            ));
    }

    Thanks to Oleg Tkachenko for his suggestion about the XPath Query (see feedback).

    Sonu

  • XmlTextReader and XmlTextWriter Article Sample Code

    Few days ago I promised to write a small article about the XmlTextWriter and XmlTextReader classes. Yesterday evening I finally wrote the article and send it to review. The review process will hold my article for approx 24-48 hours, then it will be published. Once the article is published I will post the url here. However I want to show you the main examples I used in the article. Here is the snippet from the article. I created two functions, one to read the xml file and one to write the xml file. Please remember that with these examples I only want to show how easy it is use to the XML classes of .NET. To read the xml file I have used the following code:

    Reading the Xml File:

    01:private void btReadXML_Click(object sender, System.EventArgs e)
    02:{
    03:    XmlTextReader xmlReader = new XmlTextReader(Server.MapPath("cds.xml"));
    04:
    05:    // Get rid of the first node which is <?xml version="1.0" encoding="ISO-8859-1"?>
    06:    xmlReader.Read();
    07:   
    08:    Response.Write(xmlReader.AttributeCount);
    09:    while(xmlReader.Read())
    10:    {
    11:      Response.Write(xmlReader.Value);
    12:      Response.Write("<br>");
    13:    }
    14:}

    As you can see I am not doing very much in the above code. The first line in the function constructs a new XmlTextReader object and loads the xml file. The second line reads the first node, which is <?xml version="1.0" encoding="ISO-8859-1"?>. We do not want to print this line, therefore we will read it outside the loop and do nothing. Starting with the loop we read each next node and print out the data on the screen along with a linebreak. That's all you need to read a xml file. Very easy, isn't it ?

    Writing a xml file is also simple. Here is the code to write to a xml file.

    Writing the Xml File:

    01:private void btWriteXML_Click(object sender, System.EventArgs e)
    02:{
    03:    XmlTextWriter xmlWriter = new XmlTextWriter(Server.MapPath("friends.xml"), null);
    04:
    05:    // Format automatically
    06:    xmlWriter.Formatting = Formatting.Indented;
    07:
    08:    // Write root element
    09:    xmlWriter.WriteStartElement("FriendsList");
    10:    // Write first sub element of root element
    11:    xmlWriter.WriteStartElement("Friend");
    12:
    13:    // now start adding names 1.name
    14:    xmlWriter.WriteElementString("Name","Michael");
    15:    // 2.name
    16:    xmlWriter.WriteElementString("Age","39");
    17:
    18:    // write end elements
    19:    xmlWriter.WriteEndElement();
    20:    // close writer
    21:    xmlWriter.Close();
    22:
    23:    Response.Write("Xml Written");
    24:}

    To write the xml file we require a little bit more code than to read a file, however it is still short. The first line of the function constructs a new XmlTextWriter object to write the file. Line 06 uses the property Formatting. This property is used to format the xml file automatically. If we don't use this property our xml file will look like this:

    <FriendsList><Friend><Name>Michael</Name><Age>39</Age></Friend></FriendsList>

    To have a clean tree structure look we have to use the Formatting property. In line 09 we create the root element FriendsList. With the same function we create a new element called Friend in line 10. In the lines 14 and 16 we create two new elements with the function WriteElementString. The first parameter in this function is the name of the element and the second parameter is the value of the element. Line 19 writes the end elements and line 21 closes the xmlWriter. That's it!

    These are only two xml classes from .NET. Take a look at the MSDN for more XML classes.

    Sonu

  • Mono Beta 1 Release

    Novell is proud to introduce the first Beta release of Mono, an open source implementation the .NET framework for use on Linux, Unix and Windows System. It includes a C# compiler, an implementation of the Common Language Infrastructure and two stacks of APIs: a Unix, Linux, GNOME, Mono stack for APIs that takes the most advantage of your Unix server and desktop and a set of APIs compatible with the Microsoft .NET Framework 1.1 that provides support for ASP.NET (web services and web forms), ADO.NET and many other components.

    Source [mono]

    Sonu

  • Hottest Forum Q&A on CodeGuru - December 8th, 2003

    This week topics include: Is it possible to compare two numbers without using < and >, How can I access the string vector that holds numeric data, Is it possible to remove the Close button from the top right corner of the Dialog, How do I receive a WM_KEYDOWN message in a complicated dialog, What is the equivalent of AfxGetApp to the Application Document. Read the complete article here.

  • Hottest Forum Q&A on CodeGuru - September 22nd, 2003

    This weeks topics include: How to detect an Internet connection, How to display Arabic characters in a Richedit control, What's the difference between BeginPaint() and GetDC(), How to change an application's name at run-time, How to launch the default player for an audio CD, What is aim of Microsoft to convert int into INT_PTR, How to derive a class from ofstream. Read the complete article here.

  • A Review of Demeanor .NET Enterprise Edition

    Demeanor is a software product that allows you to protect software applications you have developed in .NET by providing obfuscation. What exactly does that mean? There are many products that can reverse engineer, or decompile, the executable (EXE) or library (DLL) file that is created in .NET. These decompilers take the Intermediary Language (IL) code and convert it back to a .NET programming language that was originally used, such as C#, VB.NET, or managed C++. Read the complete article here.

  • Adding and Displaying Data Easily via ASP and XML/XSL

    Storing and displaying data is a common and essential task, if you are working with Applications. It doesn't matter whether you are working with desktop Applications or WebApplications. The saving and displaying process is nearly always required. In this article I will show you how you can easily use an ASP form to add data into a XML file and how you can retrieve this data to display it in a well formed table. Read the complete article here.

  • A Review of REALBasic

    REALBasic is tool that allows programmers to develop applications using the BASIC programming language. Unlike Microsoft's Visual Basic, in addition to Windows, REALBasic will also create applications for MAC OS Classic and MAC OS X. We reviewed the Windows version with the understanding that the Mac versions worked the same. Even with the Windows version, you can set your target platform within the development environment. Read the complete article here. PDF Version.

  • Store and Display Data Using ASP and XML/XSL

    Storing and displaying data is an essential task if you work with applications. Regardless of whether you work with desktop applications or Web applications, the save and display processes are nearly always required. In this article, I'll show how you can easily use an ASP form to add data to a XML file, how to retrieve this data, and how to display it in a well-formed table. Read the complete article here.

  • How to use XPath and Sorting in XML

    In the first article, I showed you how to get quick results with XML, XSL, and ASP. I also introduced a short paragraph about XPath. In this article, I will show you how you can use this combination with a very easy and understandable code to sort data. As sorting is a very important task that needs to be implemented in nearly every form, simplifying its implementation will save you precious development time in your projects. As opposed to the hand-crafted solutions that one needed to use in the past, XPath enables you to write robust, self-documented, and easy to understand sorting code with a very short development cycle. Read the complete article here.

  • What is RSS ?

    Few days ago I wrote an article about RSS. While writing the article I also created a small ASP.NET/C# project which reads the content from a MSDE and creates automatically a RSS feed. For that project I used mainly the XmlTextWriter class. I saw that this class is very powerful and very easy to use. The RSS article is currently in review, so I can't give you the URL now. But I will write a short article about the usage of the XmlTextWriter and XmlTextReader class. This article will explain and show you how easy the classes are to use. Stay tuned to get notified for both articles.

    Sonu

  • Hottest Forum Q&A on CodeGuru - September 4th, 2003

    This is the first article of a series of column on CodeGuru written by Sonu Kapoor. The topics inluded are: How to Work efficiently with std::sort(), How to find a specific entry in std::vector<>, Is ++i better than i++, What is the difference between const vs. enum, What is the difference between delete and delete[], How to use Unicode Characters in a DC, Why should I link to a lib when the header file is included. Read the complete article here.

  • What is a Framework ?

    Ever wondered what a framework is ? Then you should read the article from Jim Minatel. It will show you what the key components of a framework are and you will learn why there's more to frameworks than .NET Framework, Struts, and Cocoon. Read the complete article here. Feel free to comment here about the article.

    Sonu

  • XMLPitStop is Up!

    XMLPitStop is back again. Woohoo! We are online and it seems to work. Please note that the upper header is not working right now. We are still updating and working on the interface. If you encounter something that does not look good or that does not work or if you have any suggestions, please contact me.

    Sonu

  • Windows Forms FAQ

    Few hours ago I was searching for some FAQs about the Window Forms and I found a very interesting website with a lot of Q/A with projects and examples called George Shepard's Windows Form FAQ. A very good site. Visit it now here.

    Sonu

  • Sonu Kapoors Resume

    Sonu Kapoor

    E-mail: mailto:sonukapoor@gmail.com Blog: http://weblogs.asp.net/sonukapoor/

    OBJECTIVE:

    To pursue a career in software development.

    PROFILE

     

     

    Software Developer with experience in C++, Visual Studio, extended Graphic User Interface (GUI) programming, code optimization, programming for distributed applications on both standard networks and the Internet, databases development, SQL, and Web-sites development using ASP, ASP.NET, XML, PHP/MySQL and XSL.

    EXPERIENCE

     

    Aug. 2004 – Till Yet

    Doing freelance work for several companies.

    April 2004 – July 2004

    Worked as a Computer Administrator in Montreal. My role was to provide the company users data, information and security and any other required help on their computer system.

    Nov. 2001 – Dec. 2003

    MAGELLAN Networks. Cologne, Germany. Network Consultant and Software Developer

    The company is specializing in LAN/WAN solutions, security solutions, voice-/data-integration, network analysis, consulting & network services and a wide range of network management & mobile test solutions.

    Work as a network consultant and software developer on Algorithms and Infrastructure team with responsibilities and tasks that include:

    ·          C++ programming using MS Visual Studio

    ·          PHP with MySQL programming

    ·          ASP and ASP.NET programming

    ·          CGI, Perl development under Linux

    ·          XML/XSL development

    ·          Code optimization

    ·          Computer communications via LAN

     

    June 2004

    Provide technical editing for Wrox for the book: Beginning ASP.NET 1.1 With VB.NET 2003 2nd Edition.

    SKILLS

     

     

    ·          C++ programming

    ·          MS Window development using MFC and Visual Studio

    ·          Extended skin GUI Design

    ·          Database development: SQL, MS Access 2000, MySQL, MSDE, SQL Server 2K

    ·          HTML/DHTML

    ·          CSS (Cascading Style Sheets)

    ·          JavaScript, and VBScript

    ·          Server-side Web development using ASP, ASP.NET and PHP

    ·          CGI, Perl developmentfor Unix/Linux

    ·          C#, VB.NET programming

    ·          XML, XSL/XSLT developing

    EDUCATION

     

    2000 - 2001

    Several computer courses in India

    ·          E-Commerce from Regional Computer Center. Learned languages like ASP, Java JavaScript, VBScript, XML, XSL

    ·          VC++ with MFC from E-NET software solutions

    ·          C and C++ from Soft spec - Software Solutions

     

    LANGUAGES

     

     

    Speaking/writing fluent German

    COMMENTS

     

     

    Ready and willing to learn and achieve a new knowledge and skills. Willing to relocate.

    ARTICLES

    ·          An easy way to use skins in a Dialog Based Application. http://www.thecodeproject.com/dialog/skindlg.asp

    ·          Create your own Guestbook in ASP.NET
    http://www.codeguru.com/net_asp/Guestbook.html

    ·          How to use XPath and sorting in XML
    http://www.developer.com/xml/article.php/1560361

    ·          Retrieve quick results with ASP/XML and XSL
    http://www.developer.com/xml/article.php/1472921

    More articles can be seen on my blog: http://weblogs.asp.net/sonukapoor/

    Columns

    Provided a weekly column on CodeGuru ( www.codeguru.com ) from Sep. 2003 – April 2003. The column contains the hottest Question / Answers in C++ and VC++.

     

    Projects

     

     

    Jun. 02 – Dec. 02

    Servicing Contract Manager:

     

    This tool is used for internal only. The usage of the tool was to add, delete and modify service contracts. It should help each salesman to keep tract of his contracts. It was possible to add Main and subconcracts. The user got the possibility to add, delete and modify attachements. Even emails could be send with this tool.

     

    Tools:

     

    ·          PHP

    ·          MySQL

    ·          PHPMyAdmin

    ·          XML

    ·          CSS

    ·          JavaScript

    ·          HTML

     

    Operating System:

     

    ·          Linux – Red Hat 9.0

     

    Jan. 03 – Mar. 03

    Webmin:

     

    Modified the Webmin Internet Application according the design of the MAGELLAN Company. Webmin contains over 20 modules which were all modified with the following tools:

     

    ·          CGI

    ·          Perl

    ·          PHP

    ·          JavaScript

    ·          HTML

    ·          CSS

     

    Operating System:

    ·          Linux - Red Hat 9.0

     

    Apr. 03 – June 03

    FTPGrabber:

     

    Created an application for a company which needed to automate the FTP downloads and uploads according their schedule. For example, it was possible to download some files daily from 08:00 am to 17:00 pm each 5 minutes. The same is possible for uploading files to a FTP Server. To save the config from the user we used a XML file.

     

    Tools:

     

    ·          VC++.net

    ·          WuFTPServer

    ·          CuteFTP

    ·          PureFTP

    ·          XML

     

    Operating System:

     

    ·          Windows XP

    ·          Windows 2000

     

    July 03 – Aug. 03

    Dbase Grabber:

     

    This tool was required just for the intern usage. The usage is to calculate the annual profit of each Salesman in the company. The data were stored in a MS SQL Server Database. We used again VC++ .net as frontend and MSSql Server as Backend to calculate the profit.

     

    Tools:

     

    ·          VC++.net

    ·          MS SQL Server 2000

    ·          XML

     

    Operating System:

     

    ·          Windows XP

    ·          Windows 2000

     

     

    Sep. 03 – Nov. 03

    HelpDesk:

     

    Here we bought a HelpDesk system from a company called Wonderdesk. Unfortunaly major features like sorting or having the helpdesk-id in the following order: YYYY-MM-DD-XXX was missing. So we changed and modified the whole helpdesk regarding our needs.

     

    ·          CGI

    ·          Perl

    ·          PHP

    ·          JavaScript

    ·          HTML

    ·          CSS

    ·          MySQL

    ·          PHPMyAdmin

     

    Operating System:

    ·          Linux - Red Hat 9.0

     

    Aug. 04 – Sep. 04

    Navigation Menu:

    Wrote a dynamic web navigation menu for
    www.TopXML.com. As backend we used a simple XML file. The XML file was used to store all references and articles. The navigation menu was written in simple ASP and was implemented as an include file. That means that it could find the next and previous page easily. The user could navigate through all pages with a simple next/previous link and he could navigate to the first/last page. Furthermore I provided a link to the next/previous reference. The menu can be seen here: www.topxml.com/asp/default.asp

     

    ·          ASP

    ·          XML

    Sep. 04 – Nov. 04

    Reblogger:

     

    Wrote an application to retrieve the latest XML news with the help of RSS. I wrote this application in asp.net for www.TopXML.com. This is a service for users of www.TopXML.com who want to keep up-to-date with the latest news about XML. As a backend I used a SQL Server 2000 and several stored procedures. I build several pages, which allows the administrator to add, edit or delete new blogs to the database. A page simplified the usage of the posts. Just one click was necessary to edit or delete a post. An asp.net page was created which fetches all latest news automatically 4 times per day. This page was added to the task scheduler to process this task. I also provided a RSS for the Reblogger so that others can easily syndicate the latest XML news. The reblogger can be see here: www.topxml.com/reblogger/xml_news/default.asp

     

    ·          ASP.NET

    ·          SQL Server

    ·          Stored Procedures

     

  • What is ASP.NET ?

    In the past I worked very much with Active Server Pages (ASP) and everything was fine. Microsoft has since released a new technology called ASP.NET. In this Article I will try to explain the basics of ASP.NET. I will not only explain the theoretical part but I also will show you some practical "hello world " style examples. For these examples I will use C#, and VB.NET. I will try to answer all questions as good as I can. So take a cup of tea, have a seat on your favorite place and enjoy this article. Read the complete article here.

  • Create Your Own Guestbook In ASP.NET

    Recently, I was working on a Web site and I wanted to implement a guestbook. So, I searched the Web to get the best guestbook for my Web site. But then I thought, "Hey, I am a developer. Why not create my own?" It was very easy to create a guestbook and you can do it, too. In this article, I will show you how you can easily create a guestbook. To understand the article, I assume that you have already knowledge about the basics of ASP.NET programming and XML/XSL skills. Read the complete article here.

    Sonu

  • Cool Features I Like About Visual Studio 2005 "Whidbey"

    A few hours ago, I installed Visual Studio 2005, aka "Whidbey." So, I thought, "why not share this knowledge with you guys?" In this article, I will share my first Whidbey experiences with you. We will go through the installation process together. I will also present some screenshots that are important to the new features. After that, we will start Visual Studio for the first time and see the new features. I have not started Visual Studio yet because I want to do this together with you. Read the complete article here.

  • XMLPitStop is currently down !

    David Silverlight is currently working on the new interface of XMLPitStop and therefore the website is currently down. All you will see currenly there is "This site is currently under construction and will be available shortly.". If you have never heard about XMLPitStop, let me introduce it and explain what my role is. I am responsible for the content on XMLPitStop, so if you see something that does not belong there then you can ping me. XMLPitstop is an XML information portal developed and maintained by XML Journal columnist and XML Extra Newsletter publisher David Silverlight.

    The site offers downloadable XML application with or without .NET code examples (including working demos) and provides tutorials, annotated XML tool listings, annotated XML book listings, training course recommendations, events listings, a categorized library of downloadable Extensible Style Language Transformations (XSLT) stylesheets and links to many XML sites, articles and other resources. XMLPitstop also hosts the Gold Coast XML User Group for Florida residents.

    I will ping you guys as soon as the website is up.

    Sonu

  • Cool Features I Like About Visual Studio 2005 "Whidbey"

    A few hours ago, I installed Visual Studio 2005, aka "Whidbey." So, I thought, "why not share this knowledge with you guys?" In this article, I will share my first Whidbey experiences with you. We will go through the installation process together. I will also present some screenshots that are important to the new features. After that, we will start Visual Studio for the first time and see the new features. I have not started Visual Studio yet because I want to do this together with you. Read the complete article here.

    Sonu

  • Let me Blog

    Hey guys, I have just started to blog. Since a quite time I saw that each and everbody is blogging. So I thought I should try and see what happens. However I really like bloging because its much more personal than a website. I hope that you will enjoy to read my blog. Feel free to add your comments.

    Sonu