on 05-26-2017 4:23 PM - last edited on 02-03-2024 11:42 PM by postmig_api_4
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>
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.