Link to home
Start Free TrialLog in
Avatar of mikha
mikhaFlag for United States of America

asked on

write XML response results to a web browser

say, I have an XML response file from a third party web service.

This contains a result of some operation which, I need to display it to a client. this third party has also provided me with  css and javascript files, which I use to display the response XML in a web browser.

my question is how can i write back a XML file to a web browser?
Avatar of HainKurt
HainKurt
Flag of Canada image

try:

response.write(result)

Open in new window


and see how does it look like on browser...

also, post a sample result...
Avatar of mikha

ASKER

thanks @HainKurt.

I get following error, when I do response.write(result) ->  Error parsing near '<?xml version="1.0" '.

sample response XML

<?xml version="1.0"?>
<ABCServiceResponse xmlns:xsd = "http://www.w3.org/2001/XMLSchema" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance">
    <ABCResults>      
             ...    
    </ABCResults>
</ABCServiceResponse>
what do you have here

<ABCResults>      
             ...     ???
</ABCResults>

Open in new window


and how do you want to show it on page?
and what language are you usşng? vb or c#?
if you want to show xml as is

try this:

<textarea cols=80 rows=10>
<%=result%>
</textarea>

Open in new window


https://jsfiddle.net/pgss8v94/
Avatar of mikha

ASKER

@HainKurt - the third party has provided me with, js and css files. if I include those and open their response sample file using a browser, the results displays.

so, I was thinking may be I can open the XML response file in a different tab in a browser, while that html page will have reference to the js and css files provided, which will help display the results in a fancy way.

I'm using C# .

sample ---
<ABCResults>
       <xyzResults xmlns = "http://xyz.com/schema/types">
                <Result1>
                    <Result1_RULE>
                        <Result1Type>Fixed</Result1Type>
                    </Result1_RULE>
                </Result1>                        
    </xyzResults>
</ABCResults>
can you post those js and css files here

probably we can use those like

<script>
var result = '<%=result%>';
// use libraries provided by client
</script>

Open in new window

Avatar of mikha

ASKER

if i reference the Js and css, files the XML response displayed in the browser looks pretty and with those js files, I can click on a particular section of report and view details.

but problem, i'm having is , how to make the browser display that XML first. just plain XML text is also fine.

I can add the cs and js later.
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial