Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2740

Reading multiple records from an xml file

$
0
0

I am trying to use the toolkit_file_xmllist_input adapter, and specifically the xmllistMatchStreamName property.  Here's what the manual says about it:

 

Property ID: matchStreamName (note the manual is missing the "xmllist" prefix)

Type: boolean

(Optional) If set to true, the XML element names are matched against the stream name. The adapter discards messages with unmatched values.

 

I take this to mean that if the xml file has multiple elements, this adapter will distribute their contents to appropriate input streams that have the same name as the element (if the streams exist).

 

I can't get this to work.  Also, when I try to perform discovery on this adapter, I get an Unable to perform discovery on adapter error.

 

Can someone please help?  See the test project and data below.  I would like the adapter to route data to the Employee and Address streams.

 

The main question here is, can I separate different records from a single xml file with this or another adapter?

 

Thanks in advance,

Dan

 

 

ESP CODE:

CREATE SCHEMA S_Employee (

  "type" string,

  "Name" string,

  Id string,

  Age string

);

 

 

CREATE SCHEMA S_Address (

  Id string,

  Street string,

  City string,

  State string,

  ZIP string

);

 

 

CREATE INPUT STREAM NEWSTREAM SCHEMA (Column1 INTEGER);

CREATE INPUT STREAM Employees SCHEMA S_Employee;

CREATE INPUT STREAM Addresses SCHEMA S_Address;

 

 

ATTACH INPUT ADAPTER employees TYPE toolkit_file_xmllist_input to NEWSTREAM

PROPERTIES

  dir = 'C:/Users/tarnower/Documents/SybaseESP/5.1/workspace/xmltest' ,

  file = 'employees.xml',

  xmllistMatchStreamName = TRUE

;

 

DATA:

<?xml version='1.0' encoding='utf-8'?>

<Personnel>

<Employees>

<Employee type="permanent">

<Name>Seagull</Name>

<Id>3674</Id>

<Age>34</Age>

</Employee>

<Employee type="contract">

<Name>Robin</Name>

<Id>3675</Id>

<Age>25</Age>

</Employee>

<Employee type="permanent">

<Name>Crow</Name>

<Id>3676</Id>

<Age>28</Age>

</Employee>

</Employees>

<Addresses>

<Address>

<Id>3674</Id>

<Street>123 Pine</Street>

<City>Anytown</City>

<State>XX</State>

<ZIP>00000</Zip>

</Address>

<Address>

<Id>3675</Id>

<Street>2323 Oak</Street>

<City>Anytown</City>

<State>XX</State>

<ZIP>00000</Zip>

</Address>

<Address>

<Id>3676</Id>

<Street>999 Maple</Street>

<City>Anytown</City>

<State>XX</State>

<ZIP>00000</Zip>

</Address>

</Addresses>

</Personnel>


Viewing all articles
Browse latest Browse all 2740

Latest Images

Trending Articles



Latest Images