cancel
Showing results for 
Search instead for 
Did you mean: 

Problems importing XML into DataWindow

Former Member
0 Kudos

I am trying to create a DataWindow that can import the following XML string. I have tried several times to create an import template but nothing works. I even tried stripping off the root element and that didn't help either. I am using PB 10.5 but have all versions of PB available.

<root totalResults="2" response="True"><result title="movie title 1" year="1977" imdbID="tt0076759" type="movie" poster="poster2.jpg"/><result title="movie title 2" year="1980" imdbID="tt0080684" type="movie" poster="poster2.jpg"/></root>

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

If you don't use a template, PB expects the fields to be in tags, not attributes.

The following template works with your data. Edit source and replace, or add, this template.

template=(comment="" encoding="UTF-16LE" name="IMDB_xml" xml="<?xml version=~"1.0~" encoding=~"UTF-16LE~" standalone=~"no~"?><root><result title=~"mtitle~" year=~"yr~" imdbID=~"imdbid~" type=~"mtype~" poster=~"postername~" __pbband=~"detail~"/></root>")

In the <result> tag, replace the names in double quotes to match your actual column names. On the Data Import tab of the datawindow properties, set format to configure to XML, and set the template to the new one (IMDB_xml).

I used PB 12.5 with your string, with a minor alteration. Add the "<?xml...?>" tag to the beginning of your string. It successfully imported two rows, from your XML with no changes.

Answers (0)