dayv2005
dayv2005

Reputation: 364

Trying to create a dynamic temp table (dataset) from a DTD Schema? [OE10.1C]

I am trying to create a dynamic temp table and dataset from an external DTD file. I trying to simplify some xml code POST/GET and take advantage of the READ/WRITE XML functions with datasets.

I referenced the documentation for READ-XMLSCHEMA and it seems to do what I need however, I keep getting errors and can't figure out what I am doing wrong.

Here is a snippet

DEFINE VARIABLE hTable                  AS HANDLE       NO-UNDO. 
DEFINE VARIABLE retOK                   AS LOGICAL      NO-UNDO.
DEFINE VARIABLE cSourceType             AS CHARACTER    NO-UNDO.
DEFINE VARIABLE cFile                   AS CHARACTER    NO-UNDO.
DEFINE VARIABLE lOverrideDefaultMapping AS LOGICAL      NO-UNDO.
DEFINE VARIABLE cFieldTypeMapping       AS CHARACTER    NO-UNDO.
DEFINE VARIABLE cVerifySchemaMode       AS CHARACTER    NO-UNDO. 

CREATE TEMP-TABLE hTable.

ASSIGN
    cSourceType = "file"
    cFile = "http://xml.cxml.org/schemas/cXML/1.2.025/InvoiceDetail.dtd"
    lOverrideDefaultMapping = NO
    cFieldTypeMapping = ?
    cVerifySchemaMode = ?.

retOK = hTable:READ-XMLSCHEMA (cSourceType,
                           cFile,
                           lOverrideDefaultMapping,
                           cFieldTypeMapping,
                           cVerifySchemaMode).

Does anyone know how I can achieve this using Openedge 10.1C.

Thanks

Errors that i am receiving...

---------------------------
Error
---------------------------
Error reading XML file 'http://xml.cxml.org/schemas/cXML/1.2.025/InvoiceDetail.dtd'. (13035)
---------------------------
OK   
---------------------------
---------------------------
Error
---------------------------
READ-XML encountered an error while parsing the XML Document: FATAL ERROR:    file 'http://xml.cxml.org/schemas/cXML/1.2.025/InvoiceDetail.dtd', line '15',  column '2', message 'Expected comment or CDATA'. (13064)
---------------------------
OK   
---------------------------

Upvotes: 0

Views: 822

Answers (1)

Tom Bascom
Tom Bascom

Reputation: 14020

I think Progress is looking for an XSD file -- not a DTD. Looking at your link and comparing it to a working XSD file that I use they look nothing alike.

An example of XSD that Progress will like looks like this:

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="" xmlns:prodata="urn:schemas-progress-com:xml-prodata:0001">
  <xsd:element name="tt_DBId" prodata:proTempTable="true">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="tt_DBIdRow" minOccurs="0" maxOccurs="unbounded">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="dbidLogName" type="xsd:string" nillable="true" prodata:label="DB Logical Name"/>
              <xsd:element name="dbidPhysName" type="xsd:string" nillable="true" prodata:label="DB Physical Name"/>
              <xsd:element name="dbidHost" type="xsd:string" nillable="true" prodata:label="DB Host Name"/>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
    <xsd:unique name="dbidLogName-idx" prodata:primaryIndex="true">
      <xsd:selector xpath=".//tt_DBIdRow"/>
      <xsd:field xpath="dbidLogName"/>
    </xsd:unique>
  </xsd:element>
</xsd:schema>

Also, 10.1C isn't going to have the best compatibility. That's a really old release that hasn't seen an update in a long time. A lot of improvements were made in the late 10.2B service packs and OE11.4 or 11.5 should have even better support.

Upvotes: 2

Related Questions