Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6109311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:23:25+00:00 2026-05-23T14:23:25+00:00

My winform application communicates with the web service. For some requirement, I need to

  • 0

My winform application communicates with the web service. For some requirement, I need to present the web service response in the XML format in the winform application.

I can serialize the response type (class) instance to XML string. But when i show that string in the rich text box, it’s obviously displayed as continuous string; not as the XML as shown below.

<UserServiceAccesses>
- <UserServiceAccess>
-   <Service>
       <ID>0</ID> 
       <LocalID>Loggerr</LocalID> 
       <SystemID>-1</SystemID> 
       <ServiceType>U</ServiceType> 
       <Name>MyLogger</Name> 
       </Service>
    <ClientPermissions /> 
  </UserServiceAccess>
- <UserServiceAccess>
-     <Service>
         <ID>0</ID> 
         <LocalID>Logger2</LocalID> 
         <SystemID>-1</SystemID> 
         <ServiceType>U</ServiceType> 
         <Name>MyLogger2</Name> 
     </Service>
     <ClientPermissions /> 
  </UserServiceAccess>
<UserServiceAccesses>

Here, UserServiceAccesses is the class which has property of type UserServiceAccess. Then UserServiceAccess has a properties of type Service, ClientPermissions

How can I do it? It can be in any form (tree, table, text etc.) but it should be readable as XML. Since there are many web methods we call from application, everytime XML structure would be different and so we cannot have definite schema.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:23:26+00:00Added an answer on May 23, 2026 at 2:23 pm

    Make use of TreeView control

    Here is working code to display xml on treeview :

    using System;
    using System.Windows.Forms;
    using System.Xml;
    
    public class XmlTreeDisplay : System.Windows.Forms.Form
    {
        private System.Windows.Forms.TreeView treeXml = new TreeView();
    
        public XmlTreeDisplay()
        {
            treeXml.Nodes.Clear();
            this.Controls.Add(treeXml);
            // Load the XML Document
            XmlDocument doc = new XmlDocument();
            try
            {
                doc.LoadXml("<books><A property='a'><B>text</B><C>textg</C><D>99999</D></A></books>");
                //doc.Load("");
            }
            catch (Exception err)
            {
    
                MessageBox.Show(err.Message);
                return;
            }
    
            ConvertXmlNodeToTreeNode(doc, treeXml.Nodes);
            treeXml.Nodes[0].ExpandAll();
        }
    
        private void ConvertXmlNodeToTreeNode(XmlNode xmlNode,
          TreeNodeCollection treeNodes)
        {
    
            TreeNode newTreeNode = treeNodes.Add(xmlNode.Name);
    
            switch (xmlNode.NodeType)
            {
                case XmlNodeType.ProcessingInstruction:
                case XmlNodeType.XmlDeclaration:
                    newTreeNode.Text = "<?" + xmlNode.Name + " " +
                      xmlNode.Value + "?>";
                    break;
                case XmlNodeType.Element:
                    newTreeNode.Text = "<" + xmlNode.Name + ">";
                    break;
                case XmlNodeType.Attribute:
                    newTreeNode.Text = "ATTRIBUTE: " + xmlNode.Name;
                    break;
                case XmlNodeType.Text:
                case XmlNodeType.CDATA:
                    newTreeNode.Text = xmlNode.Value;
                    break;
                case XmlNodeType.Comment:
                    newTreeNode.Text = "<!--" + xmlNode.Value + "-->";
                    break;
            }
    
            if (xmlNode.Attributes != null)
            {
                foreach (XmlAttribute attribute in xmlNode.Attributes)
                {
                    ConvertXmlNodeToTreeNode(attribute, newTreeNode.Nodes);
                }
            }
            foreach (XmlNode childNode in xmlNode.ChildNodes)
            {
                ConvertXmlNodeToTreeNode(childNode, newTreeNode.Nodes);
            }
        }
        public static void Main()
        {
            Application.Run(new XmlTreeDisplay());
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a winform application and a list of logins to some web-service. Upon
I have a winform application that uses some referenced web services to get data.
Hi, I have a WCF service in IIS7 that communicates with a winform application
I’ve created a winform application that communicates with a WCF service. The winform displays
My winform application is launched by another application (the parent), I need determine the
A WinForm application. I want to scrape a part of an HTML web page
I have Winform application,which does some operation in loops (file access, copy file, ....).
I have a .NET winform application that writes an XML data file, but I
Im programming C# WinForm application which have big SQL Server Database. I need to
I have a winform application that controls some transmitters and sound cards. There is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.