How Can I display XML file?

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

Anyone knows it?
Thanks

the xml string is xs="<?xml version='1.0' ?> 1
2 "

Thanks

Zhan feng Wang a écrit :

print "document.write('",xs,"');\n"
print "}\nt();</script>\n"

or as:
print “\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

Zhan feng Wang wrote:

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

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs