tailieunhanh - Professional XML Databases phần 6
Là một giá trị, những thuộc tính này có giá trị của thuộc tính nhãn của các yếu tố kiểu tài nguyên hoặc yếu tố. Trong ví dụ cuối cùng của chúng tôi, chúng tôi xác định các nguồn tài nguyên mà đại diện nhà của chúng tôi với một nhãn myhouse: | Flat Files Delimited First let s see how to read a delimited file and save the results to an XML document. We ve already seen examples of the delimited file and XML document that we ll be transforming. In this example this file is called Kevin Williams 744 Evergreen Terrace Springfield KY 12345 12 01 2000 12 04 2000 1 blue 2 in. grommet 17 silver 3 in. widget 22 0 0 0 Homer Simpson 742 Evergreen Terrace Springfield KY 12345 12 02 2000 12 05 2000 2 red 1 in. sprocket 13 blue 2 in. grommet 11 0 0 0 This is mapping into the file InvoiceData Invoice customerIDREF c1 orderDate 12 01 2000 shipDate 12 04 2000 shipMethod UPS LineItem partIDREF p1 quantity 17 price LineItem partIDREF p2 quantity 22 price Invoice Invoice customerIDREF c2 orderDate 12 02 2000 shipDate 12 05 2000 shipMethod USPS LineItem partIDREF p3 quantity 13 price LineItem partIDREF p1 quantity 11 price Invoice Part partID p1 name grommet size 2 in. color blue Part partID p2 name widget size 3 in. color silver Part partID p3 name sprocket size 1 in. color red 443 Chapter 12 Customer customerID c1 name Kevin Williams address 744 Evergreen Terrace city Springfield state KY postalCode 12345 Customer customerID c2 name Homer Simpson address 742 Evergreen Terrace city Springfield state KY postalCode 12345 InvoiceData First we need to map from the delimited file to the XML document. We ve already done this a couple of pages earlier when we were discussing how transform maps are created. Armed with this information we can use the following VBScript code to open the flat file break it apart and use the DOM to construct the XML equivalent. The entire listing can be found in the file but we ll analyze it here section by section Dim fso ts sLine Dim el dom root Dim sField 23 Dim sThisName sThisSize sThisColor Dim sSize sColor sName sAddress Dim iLineItem Dim invoiceBucket partBucket customerBucket Dim li nl .
đang nạp các trang xem trước