Error using XML API

Post Reply
barry.marcus
Posts: 288
Joined: Thu Nov 16, 2006 1:05 pm

Error using XML API

Post by barry.marcus »

I'm trying my hand at building an XML string using the XML api, and I am following the example in the sample script. But I am getting an error when I attempt to take the return values from a sql select and write them to an element in the xml. Here is snippet of code that is causing the error:

<sql "select id, PATN_TTL, PATN_ISD, PATN_WKU, OWNR_NAM from PATN where PATN_WKU in ('7777777') order by PATN_ISD desc, PATN_WKU desc">
<$ret = (xmlWriterStartElement($writer, 'row'))>
<$ret = (xmlWriterWriteElement($writer, 'id', '$id'))>
<$ret = (xmlWriterWriteElement($writer, 'Title', '$PATN_TTL'))>
<$ret = (xmlWriterWriteElement($writer, 'IssueDate', '$PATN_ISD'))>
<$ret = (xmlWriterWriteElement($writer, 'DocID', '$PATN_WKU'))>
<$ret = (xmlWriterWriteElement($writer, 'Assignee', '$OWNR_NAM'))>
<$ret = (xmlWriterEndElement($writer))>
</sql>

The errors are on the calls to xmlWriterWriteElement, and each call generates errors as follows:

<!-- 015 /crosshairs:5013: Vortex parameter count does not equal SQL-prep parameter count: 2 != 1 in the function vsvtx_prep -->
<!-- 100 /crosshairs:5013: Cannot compile SQL expression: Vortex arg count 2 != SQL arg count 1 in the function expr2sql -->

Your help is appreciated.
User avatar
mark
Site Admin
Posts: 5513
Joined: Tue Apr 25, 2000 6:56 pm

Error using XML API

Post by mark »

What's on line 5013 of the crosshairs script?
User avatar
John
Site Admin
Posts: 2597
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Error using XML API

Post by John »

You probably don't want quotes around the values, and make sure you have a space between quote and comma, e.g.

<$ret = (xmlWriterWriteElement($writer, 'id' , $id))>
John Turnbull
Thunderstone Software
barry.marcus
Posts: 288
Joined: Thu Nov 16, 2006 1:05 pm

Error using XML API

Post by barry.marcus »

Mark, line 5013 was the number of the first xmlWriterWriteElement line in the script. But I believe that the problem was that I failed to escape some javascript before that code with <verb>. But John, I did make your suggested changes. Problem solved, but I don't know which of those two fixed it!

Speaking of Javascript, I have another issue related to that, but I will post in a separate thread.

Thanks.
Post Reply