I've seen this discussed before, but have never seen any working examples.
Even the examples in the PDF's from IBM do not work.
I have this mapping file (CDSPVTestData.map):
<U2xml root="CDSPVTestData"/>
<U2xml record="PVTestData"/>
<U2xml file="PV.TESTDATA"
FIELD="KEY"
map-to='MyID'
type='S'
treated-as='element'
/>
<U2xml file="PV.TESTDATA"
FIELD="MYNAME"
map-to='MyName'
type='S'
treated-as='element'
/>
<U2xml file="PV.TESTDATA"
FIELD="MYCODE"
map-to='MyCode'
type='S'
treated-as='element'
/>
And this BASIC program (XMLTEST):
CALL OPEN("PV.DEV",PV.DEV.FILE)
STATUS = XMLEXECUTE("SELECT KEY,MYNAME,MYCODE, 'RVK' ACCT FROM PV.TESTDATA
TOXML ELEMENTS XMLMAPPING 'CDSPVTestData.map'","",XMLVAR,SVAR)
PRINT XMLVAR
WRITE XMLVAR ON PV.DEV.FILE,"TEST.XML"
STOP
Which successfully generate this XML (TEST.XML):
<?xml version="1.0"?>
<CDSPVTestData>
<PVTestData>
<MyID>1</MyID>
<MyName>MY TEST NAME</MyName>
<MyCode>MY TEST CODE</MyCode>
<ACCT>RVK</ACCT>
</PVTestData>
</CDSPVTestData>
Now here is the hard part..... I just want to use XML extraction as shown in
the Chapter 7 of the BasicExt.pdf, so I write this program (XMLTESTEXT):
#INCLUDE UNIVERSE.INCLUDE XML.H
STATUS=PrepareXML("PV.DEV/TEST.XML",TEST_XML)
IF STATUS=XML.ERROR THEN
STATUS=XMLError(errmsg)
PRINT errmsg
STOP
END
STATUS = OpenXMLData(TEST_XML,"&XML&/CDSPVTestData.ext",TEST_XML_DATA)
IF STATUS=XML.ERROR THEN
STATUS=XMLError(errmsg)
PRINT errmsg
STOP
END
STOP
And have this extraction map (CDSPVTestData.ext):
<U2xml-extraction>
<file-extraction start="/CDSPVTestData/PVTestData"
dictionary="D_PV.TESTDATA" null="EMPTY"/>
<FIELD-extraction FIELD="KEY" path="PVTestData,MyID/text()"/>
<FIELD-extraction FIELD="MYNAME" path="PVTestData,MyName/text()"/>
<FIELD-extraction FIELD="MYCODE" path="PVTestData,MyCode/text()"/>
</U2xml-extraction>
When I run this XMLTESTEXT, I get this error:
"U2XMAP: Illegal U2XMAP file, missing the <U2XMAP>."
Anybody able to help? I've tried various other incarnations of the EXT file
from chapter 7 in the pdf but with no results. Chapter 7 doesn't even
mention the U2XMAP file. I do find U2XMAP file later on in documentation but
I can't see how it relates.
Thanks,
Peter
This email and any attachments are intended solely for use of the named
addressee.If you received this email in error please notify the sender by
return e-mail, delete this e-mail, and refrain from any disclosure or action
based on the information.
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/