3.1.3 Information Request DTD

In addition to issuing map requests (see Map Request DTD) and administrative requests, you can issue information requests to MapViewer. An information request is an XML request string that you can use to execute SQL queries and obtain the result as an array of strings or an XML document. The SQL query must be a SELECT statement and must select only primitive SQL types (for example, not LOB types or user-defined object types).

The following is the DTD for a MapViewer information request.

<!ELEMENT info_request (#PCDATA) >
<!ATTLIST info_request
  datasource CDATA #REQUIRED
  format (strict | non-strict) "strict"
>

datasource is a required attribute that specifies the data source for which to get the information.

format is an optional attribute. If it is strict (the default), all rows are formatted and returned in an XML document. If format is set to non-strict, all rows plus a column heading list are returned in a comma-delimited text string.

Example 3-24 shows an information request to select the city, 1990 population, and state abbreviation from the CITIES table, using the connection information in the mvdemo data source and returning the information as an XML document (format="strict").

Example 3-24 MapViewer Information Request

<?xml version="1.0" standalone="yes"?>
<info_request datasource="mvdemo"
              format="strict">    
    SELECT city, pop90 population, state_abrv state FROM cities
</info_request>

Example 3–24 returns an XML document that includes the following:

<?xml version="1.0" encoding="UTF-8"?>
<ROWSET>
    <ROW num="1">
        <CITY>New York</CITY>
        <POPULATION>7322564</POPULATION>
        <STATE>NY</STATE>
    </ROW>
    <ROW num="2">
        <CITY>Los Angeles</CITY>
        <POPULATION>3485398</POPULATION>
        <STATE>CA</STATE>
    </ROW>
    <ROW num="3">
        <CITY>Chicago</CITY>
        <POPULATION>2783726</POPULATION>
        <STATE>IL</STATE>
    </ROW>
    <ROW num="4">
        <CITY>Houston</CITY>
        <POPULATION>1630553</POPULATION>
        <STATE>TX</STATE>
    </ROW>        
        . . .
    </ROWSET>