We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Expand\Collapse all nodes

data-nova
data-nova asked
on
Medium Priority
2,974 Views
Last Modified: 2012-06-27
Can anyone give me an example about how I can make an XML file (displayed in a browser) that has a Collapse\Expand all option ?
Maybe it needs some javascript .Thank you
Comment
Watch Question

Author

Commented:
for example i have this file

 <Customerlist>
<Customer no="100" name="John Smith" country="Italy">
     <SalesInfo>        
      <Sale saleid="501" date="2006-03-02" amount="10.00"></Sale>
        <Sale saleid="675" date="2006-03-11" amount="42.00"></Sale>
     </SalesInfo>        
     <Otherinfo CustomerCategory="AA" Zone="4"/>
</Customer>
<Customer no="200" name="Davy Jackson" country="France">
     <SalesInfo>        
      <Sale saleid="324" date="2006-02-22" amount="12.00"></Sale>
        <Sale saleid="700" date="2006-03-11" amount="56.00"></Sale>
     </SalesInfo>        
     <Otherinfo CustomerCategory="BB" Zone="3"/>
</Customer>
</Customerlist>


 how can i display it so that i only see like this with the nodes collapsed
- <Customerlist>
+ <Customer no="100" name="John Smith" country="Italy">
+ <Customer no="200" name="Davy Jackson" country="France">
  </Customerlist>
CERTIFIED EXPERT
Top Expert 2004
Commented:
Errr...  I don't think you can...

That's just how the browser displays it

You can't embed javascript in an XML file...

Tim

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:

 i could use XSL.i dont need to have just the XML file
 I have seen it work in some places
CERTIFIED EXPERT
Commented:
create a file, save it with .xml extension and open it with Internet Explorer

Author

Commented:

 well that displays all the nodes open , i want all of them displayed collapsed
Commented:
you will be provided with + and - sign to the left of the tags.
you can use them to expand or collapse the xml file.

you can use xml editors.
http://www.stylusstudio.com/xml_download.html
http://www.altova.com/download.html

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.