cancel
Showing results for 
Search instead for 
Did you mean: 

importstring with xml merging row data

Former Member
0 Kudos

I have a simple XML import I'm trying to do, rather than manually parsing the data. There's a problem though. The following XML generates 3 rows in the datawindow instead of 4. I'm using a default template.

<?xml version="1.0"?><dw_tqxml>

<dw_tqxml_row><dosetime>AM</dosetime><qty>1</qty></dw_tqxml_row>

<dw_tqxml_row><dosetime>8pm</dosetime><qty>1.25</qty></dw_tqxml_row>

<dw_tqxml_row><dosetime>NOON</dosetime></dw_tqxml_row>

<dw_tqxml_row><qty>3.00</qty></dw_tqxml_row>

</dw_tqxml>

The first and second rows come out fine, the third row is a combination of the two last rows.

Here's the result data

"AM", "1"

"8pm", "1.25"

"NOON", "3.00"

dw sql is:

select space(10) as dosetime, space(10) as qty from dummy

It's my understanding that missing data should use the default values in the datawindow.

PB 12.5 Build 5583

Anyone have any ideas on why it's merging rows? This is the first time I've used XML import, don't really have a clue what I'm missing.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I have limited experience with XML import. What I have just found is:

  • Column tag names are ignored during import.
  • The import "finds" the data between each detail item.
  • Appears to completely ignore the surrounding "row" tags.

Your XML file needs empty detail tags when there is no data. No PowerBuiilder import function will assign default values. Only InsertRow() function does that.

XML imports/exports works really well with nested or composite datawindows. There are templates generated that you can use.  Not sure how templates work.

Former Member
0 Kudos

So basically, you're required to have the right number of data elements for each row, or it'll stuff them together for you. Not quite how I imagined an XML import to work. The whole concept of XML is that missing tags, unless required, or extra tags, don't cause problems. If an xml file is properly formatted with data tagged as rows, why the heck aren't they being used?

Looks like I'll be writing my own parser for this.

Thanks Lars.

Former Member
0 Kudos

Hopefully someone knowing more than I can assist.

Appears that most of the little template features are for export only.

Former Member
0 Kudos

Lars, you'd recall the issues we had with a large xml import, especially where the format sets change on a regular basis.  We ended up writing our own parsing routine. (the data we were processing was information 'extracted' in xml format from mobile phones - a utility required by a law enforcement agency).

On the aspect of the latter -writing your own parsing routines - I'd be interested to hear from anyone if this process is less efficient than using and swapping datawindow templates.

Bill Beale