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 8438457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:43:21+00:00 2026-06-10T07:43:21+00:00

I ran into some problems using jQuery to read an external xml file and

  • 0

I ran into some problems using jQuery to read an external xml file and build a tree. To get around it, I am working on C# code to read the external xml file and present the data to the jQuery. Here is my code so far:

I would like to read the external xml file and print it out as is. Can someone help me how to print the xml file as is?

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  

<script runat="server">  
    protected void Page_Load(object sender, System.EventArgs e)   
  {   
        string xmlFile = "http://192.168.101.1/img/jstree.xml";   
        XmlReaderSettings settings = new XmlReaderSettings();   
        settings.IgnoreComments = true;   
        settings.IgnoreWhitespace = true;   
        Console.WriteLine(xmlFile); 
       try   
        {   
            using (XmlReader reader = XmlReader.Create(xmlFile, settings))   
            {   
                string xmlContent;   
                while (reader.Read())   
                {   
                    if (reader.NodeType == XmlNodeType.Element)   
                    {   
                        xmlContent = "";   
                        if (reader.Name == "root")   
                        {   
                            xmlContent += "<root>" + "<br />" "reader.ReadString().ToString() + "<br />";   
                        }   
                        if (reader.Name == "item id")   
                        {   
                            xmlContent += reader.ReadString().ToString() + "<br />";   
                        }   

                        if (reader.Name == "content")   
                        {   
                            xmlContent += reader.ReadString().ToString() + "<br />";   
                        }   

                         if (reader.Name == "name")   
                        {   
                            xmlContent += reader.ReadString().ToString() + "<br />";   
                        }   
                        Label1.Text += xmlContent;   
                    }   
                }   
            }   
        }   
        catch (Exception ex)   
        {   
            Label1.Text = "An Error Occured: " + ex.Message;   
        }   
    }   
</script>  

<html xmlns="http://www.w3.org/1999/xhtml" >  
<head id="Head1" runat="server">  
    <title>XmlReader: How to read and process Xml file element data in asp.net</title>  
</head>  
<body>  
    <form id="form1" runat="server">  
    <div>  
             <asp:Label    
             ID="Label1"  
             runat="server"  
             Font-Bold="false"  
             ForeColor="Crimson"  
             Font-Size="Large"  
             Font-Names="Comic Sans MS"  
             >  
        </asp:Label>  
    </div>  
    </form>  
</body>  
</html>  

Can someone help with how do I read this jstree.xml and present it to the jQuery. In jQuery, I should be able to do this:

$(document).ready(function () {
    $("#div").jstree({
        "xml_data": {
            "ajax": { 
                "url": "jstree.xml"
  • 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-06-10T07:43:23+00:00Added an answer on June 10, 2026 at 7:43 am

    Jquery should request to ASP.NET Page, like “jstree.aspx”, this page, jstree.aspx, should return a XML Stream.

    In your ASPX, after the code you writed:

        Response.Clear();
        Response.ContentType = "text/xml";
        Response.Charset = "utf-8";
    
        XmlWriterSettings settings = new XmlWriterSettings();
        settings.Encoding = Encoding.UTF8;
        settings.Indent = true;
        using (XmlWriter writer = XmlWriter.Create(Request.OutputStream, settings))
        { 
           //Write here
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While creating an online shop application using play-1.2.4 ,I ran into some problems with
I ran into a problem on Chrome and Safari using jQuery to do some
Im trying to code a popup but I ran into some problems when using
I am working on a blackberry project and ran into some problems with the
I've ran into some problems when using nested enclosures, and I'd like to know
I've ran into a wierd problem.. I'm doing some custom button-styling using jQuery and
I ran into a problem using Springsource Tool Suite when writing some groovy scripts
I decided to play with some CSS3 and ran into some problems with background
I was working on some fairly complex excel files and ran into a problem
I'm working on some sort of online indesign editor and i ran into the

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.