[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

How Can I display XML file?

Zhan feng Wang

8/18/2007 10:22:00 AM

Hi,friends,
I have a XML string, such as xs="<?xml version='1.0' ?><testh><test1
1/><test2 2/></testh>",how can I display(current window or a new window)
it as XML like:
â??<testh>
<test1> 1 </test1>
<test2> 2 </test2>
</testh
I wrote as following, but do not work:
print "<script language=\"javascript\">\nfunction t(){\n"
print "document.write('",xs,"');\n"
print "}\nt();</script>\n"
or as:
print "<script language=javascript>\n"
print "winx=open('','XML','menubar,scrollbars,resizeable');\n"
print "winx.document.writeln('xs');\n"

Anyone knows it?
Thanks
--
Posted via http://www.ruby-....

3 Answers

Zhan feng Wang

8/18/2007 10:23:00 AM

0

the xml string is xs="<?xml version='1.0' ?><testh><test1> 1
</test1><test2> 2 </test2></testh>"

Thanks
--
Posted via http://www.ruby-....

Stéphane Wirtel

8/18/2007 2:00:00 PM

0

Zhan feng Wang a écrit :
> Hi,friends,
> I have a XML string, such as xs="<?xml version='1.0' ?><testh><test1
> 1/><test2 2/></testh>",how can I display(current window or a new window)
> it as XML like:
> â??<testh>
> <test1> 1 </test1>
> <test2> 2 </test2>
> </testh
> I wrote as following, but do not work:
> print "<script language=\"javascript\">\nfunction t(){\n"
> print "document.write('",xs,"');\n"
> print "}\nt();</script>\n"
> or as:
> print "<script language=javascript>\n"
> print "winx=open('','XML','menubar,scrollbars,resizeable');\n"
> print "winx.document.writeln('xs');\n"
>
> Anyone knows it?
> Thanks
You can use the Builder gem, to generate an indented xml stream.

Stef

Phlip

8/18/2007 2:17:00 PM

0

Zhan feng Wang wrote:

> I have a XML string, such as xs="<?xml version='1.0' ?><testh><test1
> 1/><test2 2/></testh>",how can I display(current window or a new window)
> it as XML like:
> ?<testh>
> <test1> 1 </test1>
> <test2> 2 </test2>
> </test>

Use XSLT to convert the XML to XHTML describing the XML. This is a common
XSLT application, and you should be able to find a sample script showing
how.

--
Phlip
http://www.oreilly.com/catalog/9780...
"Test Driven Ajax (on Rails)"
assert_xpath, assert_javascript, & assert_ajax