(You would need to modify the code slightly if the fields are stored as children
instead of attributes, and Chapter 6 has an example of doing just that.)
Note that the schema has a columns element, which has one child column element for
every field in each row. You could have parsed that columns element instead and ended up
with the same information, but the approach used here is more flexible, since many XML
files do not contain headers describing their children??™s attributes.
nNote This automatic creation of the schema is very convenient, since it avoids hard-coding values, and it
guarantees you??™ll get all of the data from the XML input for future processing. However, in many cases, you
may want to create your schema by hand. For example, you may wish to load only a few fields, or you may
wish to have a more controlled table schema, such as one with carefully selected text field lengths. Additionally,
you may need to normalize one row in an XML schema into multiple tables. In any case, the techniques
are similar to what you??™ve done here.
Pages:
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384