Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

show the xml or html response on the page 1

Status
Not open for further replies.

ozane

Technical User
Feb 3, 2005
57
TR
hi,
i am connecting to a server and getting the query result via asp.net. result can be in XML or HTML format, and prepared on the server side. when i get the result file i want see the details on the page. coudnt manage showing the content on the page appropriately. it must be very easy :) if i use response.write it is not giving me the right solution. the code... here...

Dim conn As Zoom.Net.IConnection = Zoom.Net.IConnectionFactory.Create(zhostip, zport)
conn.DatabaseName = dbName
conn.Syntax = Zoom.Net.RecordSyntax.SUTRS
conn.Options.Item("elementSetName") = "F"

Dim query As Zoom.Net.IPrefixQuery = Zoom.Net.IPrefixQueryFactory.Create(zQuery)
Dim rs As Zoom.Net.IResultSet = conn.Search(query)
Dim rec As Zoom.Net.IRecord = rs.Item(zMetaNo)
Dim content As String = System.Text.Encoding.UTF8.GetString(rec.Content)

and want to see content on the page as xml or html...

thanks...
 
Have you tried writing the content out to a Literal control?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
how should i do that, if you mean just adding a literal control and change the text with "content" i did. i want to see raw xml or html.
"literal" and "response.write" is giving me just texts...
 
Sorry, I thought you meant you wanted to render the HTML/XML.

How about a Textbox then?



____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
thanks...
yep textbox is giving right tree view but it is a text box... i mean i want to see the content as it can be seen in the explorer view, colourfull etc.. for xml and html responses i can create different views but first i should find the right way to see xml or html...

 
There isn't a default ASP.NET control that will show your HTML or XML with "colourfull" tags. You will have to do this yourself (you could extend an existing control) or search for a control that someone may already have written.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
one way is to write it to a file and read from file, but it is not a good way, i think...
ok thanks
 
How will writing the content to a file and then reading it keep the formatting that a particular application applies?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
content of "content" is xml or can be html.
so if write it in to a xml file or.. i can read it from the file...
but that is not what i want to use. i did it before for xml files.
 
But how will writing xml (for example) to an xml file apply any formatting such as colouring to nodes? That formatting is only applied once you open it in a particular application - it is not applied to the file.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
yep i am not appliying it to the file.
i think there is confusions, so i couldnt explain my problem clearly.

i am not going to color the xml "file". IE will do it for me. it is raw xml... (ok forget about html content.)
when you open a xml file with IE you see the tags arranged. thats what i want to see on my page for the "content" string in my code, which is sent by server.
i load and see like that when i use file. but it is not a file now.

as you can understand i am not an programming expert, my explanations may be confusing.
 
OK, I think I see what you want. Something like the following if I'm correct:

Remove all the HTML from a webpage (so you only have your "<%@ Page" declaration. Then add the following to your code behind section:
Code:
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        Dim strXML As String = "<parent><node1>Test 1</node1><node2>Test 2</node2></parent>"
        Response.ContentType = "text/xml"
        Response.Write(strXML)
    End Sub


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top