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

How to display xml-string like in a browser

Status
Not open for further replies.

Janosh

Programmer
Apr 26, 2010
9
FI
Hello!
I have in an sql-database different xml-strings that have been saved there to keep log of soap-calls and I would like to be able to be able to view these xml strings in my application, in a way that every elemet would be on a new row like:
<root>
<test>adgd</test>
<test2>adgd</test2>
</root>

instead of:
<root><test>adgd</test><test2>adgd</test2></root>

has anyone programmed anything similar or do you know if there is any easy way of displaying xml in this way?
 
In addition I'm using PB 10.2 Build 9914
 
You can create a datawindow object with and external datasource with the column names the same as your xml elements. Then create an xml template in that datawindow object and use that for the import template. Arrange the fields with the corresponding labels for the tags in whatever way you want.

In the script after you have your xml string do a
Code:
dw_1.importstring(XML!,ls_xml)
to bring the data into the datawindow.

Matt

"Nature forges everything on the anvil of time"
 
Hi, thanks for your reply, but that's not exactly what I'm looking for.

I would like to view the whole xml message in "xml code", so that I can spot possible errors.
(Because the xml-responses I get aren't always alike, I can't create an import template)
 
You could try:
Code:
integer li_rc
inet lcx_inet
li_rc = getcontextservice('Internet',lcx_inet)
If (li_rc <> 1) THEN
	messagebox('Clicked','getcontextservice failed')
ELSE
	lcx_inet.hyperlinktourl('c:\temp\error.xml')
END IF

Which would open the xml file in a browser.
Or you could declare an external function Shellexecutea
and 'execute' the xml file in which case you would open whatever application is registered in windows to open xml files.

Matt

"Nature forges everything on the anvil of time"
 
That was a lot of help, but I got it done a little bit differently:

I inserted a Microsoft Web Browser - OLE Object (which i gave the name ie) to my program, then I saved the xml string to a temporary file and just used the built-in function to open it in the browser window:

ie.object.navigate("C:\tempexml.xml")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top