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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem writing dynamic XML from an MTS object? 2

Status
Not open for further replies.

hdougl1

Programmer
Dec 6, 2000
54
0
0
US
New to XML and, I'm creating a XML structure with data from a recordset within a MTS object returning a XML string called from a ASP page . I'm using response.write to display the XML structure and all I'm getting is the data written across the screen and not in a XML type structure. The basic programing structures are as followed;

ASP
set objHTML = Server.CreateObject("NoMatch.clsNoMatch")strHTML = objHTML.GenHtmlReport(strStartDate, strEndDate)

DLL
GenHtmlReport = &quot;<?xml version='1.0' ?>&quot;
XML stuff

ASP
response.write strHTML

I hope this is enough information to provide me a clue on sending XML data to the client from a dll returned string.
Thanks in advance
 
maybe u need to tell the browser ur sending XML data by setting the &quot;content-type&quot; header to &quot;text/xml&quot;

-pete
 
I tried using Response.ContentType = &quot;text/xml&quot; with error thou, maybe since I'm also linking to a style sheet that states TYPE='text/css'. I don't know where to add text/xml statement with other content types.
Thanks
 
r u mixing the XML in with HTML in ur response data? That is not going to work.

-pete
 
To be exact I'm writing HTML to the page then I'm going to the dll to get the formated XMl data and returning it as a string and then response.write the XML only(tags and data)string to the screen.
ex. of the returned string
&quot;<?xml version='1.0' ?>&quot;
<NoMatchReport>
<NoMatchList>
<DocRef>xxx</DocRef>
<VoucherID>yyy</VoucherID>
<EnteredDate>zzz</EnteredDate>
</NoMatchList>
</NoMatchReport>

Again thanks a lot for your help.
 
yeah the browser is going to treat the XML tags as &quot;not recognized&quot; HTML and just display any text that is inbetween them.

to display the XML format you will have to translate the tag characters to entities

<NoMatchReport> becomes
&lt;NoMatchReport&gt;

you could do that in your dll and pass back the transformed string rather than the XML string

hope that helps
-pete
 
Pete, it appears that the browser is not processing the data as XML. Now I see the XML tags and the data on the screen. One last question where or how do I tell the browser I'm sending XML after other HTML tags sent to the page?
Thanks
 
response.write &quot;<xmp>&quot; & XMLString & &quot;</xmp>&quot;

display xml format in asp page.

Ted
 
Pete and Ted thanks a lot for your help I still have not been successfull in my objective and I have learned a lot in the last 24 hours. I believe my problem has been the mix of HTML and then trying present the XML data. I am looking into XSL to control the HTML and XML output.

Again thank you all very much
Henry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top