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

  • SEARCH
  • Home
  • 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 7834907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:23:29+00:00 2026-06-02T13:23:29+00:00

I am trying to build a tree from an xml file using jstree. I

  • 0

I am trying to build a tree from an xml file using jstree. I followed the documentation and looks like it is not working. Here is my code:

<html>
<head>
    <title>Demo</title>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script type="text/javascript" src="C:\Users\jstree\jstree_pre1.0_fix_1\jquery.jstree.js"></script>
    <Script Language="JavaScript">
  $(function () {  

     $("#demo2").jstree({   

         "xml_data" : {  

             "ajax" : {  

                 "url" : "books.xml" 

             },  

             "xsl" : "nest" 

         },  

         "plugins" : [ "themes", "xml_data" ]  

     });  
     }); 

</Script>

</head>
<body>

</body>

  • 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-02T13:23:33+00:00Added an answer on June 2, 2026 at 1:23 pm

    The XML is not formatted in a way that jsTree can include it.

    http://www.jstree.com/documentation/xml_data

    Two types of XML structures are supported – flat and nested:

    <!-- FLAT -->
    <root>
        <item id="root_1" parent_id="0" state="closed">
            <content>
                <name><![CDATA[Node 1]]></name>
            </content>
        </item>
        <item id="node_2" parent_id="root_1">
            <content>
                <name><![CDATA[Node 2]]></name>
            </content>
        </item>
    </root>
    
    <!-- NESTED -->
    <root>
        <item id="xml_1">
            <content><name><![CDATA[Root node 1]]></name></content>
            <item id="xml_2">
                <content><name><![CDATA[Child node 1]]></name></content>
            </item>
        </item>
    </root>
    

    An alternative is to bring the XML document in and convert it into JSON, then transform it into a valid JSON or HTML data format.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im tryind to build an Vaadin tree from an XML file(MSDL), im stuck at
I'm trying to build a DOM tree from a xmlTextReaderPtr . In my final
I'm trying to build a tree of LI/UL elements from an interal object I
I'm trying to build a binary tree, but from some reason my code doesn't
I am trying to build a binary tree from a string input piped to
I am trying to build a tree structure that represents a parsed configuration file
I'm trying to build an expression tree ( still ) but getting further! I
I am trying to build a Quadtree data structure(or let's just say a tree)
I am trying build an AST for the below grammer using ANTLR condition_in :
I'm trying build a method which returns the shortest path from one node to

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.