on 07-24-2014 10:57 PM
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.
I have limited experience with XML import. What I have just found is:
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.