Display XML within a HTML document


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Display XML within a HTML document

  1. #1
    Lee Guest

    Display XML within a HTML document


    Can anybody please help me...

    I am trying to work out how to display an XML document within a HTML page.
    I want the user to be able to expand/collapse the nodes the same way as when
    viewing a pure XML document, but the XML must be embedded and displayed in
    the middle of an HTML document.

    No matter how I try this the XML ends up as a hidden XML data island, or
    just the values between the tags display as text.


  2. #2
    Russell Jones Guest

    Re: Display XML within a HTML document

    Displaying the document is no problem; you simply HTMLEncode the XML itself,
    e.g.
    <?xml version="1.0" encoding="UTF-8"?>

    Note the < and > character entities. The browser will display them as
    less-than/greater-than angle brackets (< and >). Do that for the entire
    document. See the Server.HTMLEncode method.

    However, displaying the XML as expandable/collapsible nodes is much more
    difficult. IE can already do it though, so if you only need to display it in
    IE, the simplest way to solve your problem is to display the XML document in
    an IFRAME. Set the src attribute of the IFRAME to the XML document you want
    to display.


    "Lee" <lmatthews@dataract.com.au> wrote in message
    news:3cbce9a1$1@10.1.10.29...
    >
    > Can anybody please help me...
    >
    > I am trying to work out how to display an XML document within a HTML page.
    > I want the user to be able to expand/collapse the nodes the same way as

    when
    > viewing a pure XML document, but the XML must be embedded and displayed in
    > the middle of an HTML document.
    >
    > No matter how I try this the XML ends up as a hidden XML data island, or
    > just the values between the tags display as text.
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center