大量的xml文档需要转换导入到数据库。 由于xml文档有几个不同各类的机器不断生成,纵观csp未能找到合适的解决方法。 不知可否建议软件增加对xml文档的读取函数,谢谢
用在什么地方? 贴上几个xml样例文件看看。
<?xml version="1.0"?> <PurchaseOrders> <PurchaseOrder PurchaseOrderNumber="99503" OrderDate="1999-10-20"> <Address Type="Shipping"> <Name>Ellen Adams</Name> <Street>123 Maple Street</Street> <City>Mill Valley</City> <State>CA</State> <Zip>10999</Zip> <Country>USA</Country> </Address> <Address Type="Billing"> <Name>Tai Yee</Name> <Street>8 Oak Avenue</Street> <City>Old Town</City> <State>PA</State> <Zip>95819</Zip> <Country>USA</Country> </Address> <DeliveryNotes>Please leave packages in shed by driveway.</DeliveryNotes> <Items> <Item PartNumber="872-AA"> <ProductName>Lawnmower</ProductName> <Quantity>1</Quantity> <USPrice>148.95</USPrice> <Comment>Confirm this is electric</Comment> </Item> <Item PartNumber="926-AA"> <ProductName>Baby Monitor</ProductName> <Quantity>2</Quantity> <USPrice>39.98</USPrice> <ShipDate>1999-05-21</ShipDate> </Item> </Items> </PurchaseOrder> <PurchaseOrder PurchaseOrderNumber="99505" OrderDate="1999-10-22"> <Address Type="Shipping"> <Name>Cristian Osorio</Name> <Street>456 Main Street</Street> <City>Buffalo</City> <State>NY</State> <Zip>98112</Zip> <Country>USA</Country> </Address> <Address Type="Billing"> <Name>Cristian Osorio</Name> <Street>456 Main Street</Street> <City>Buffalo</City> <State>NY</State> <Zip>98112</Zip> <Country>USA</Country> </Address> <DeliveryNotes>Please notify me before shipping.</DeliveryNotes> <Items> <Item PartNumber="456-NM"> <ProductName>Power Supply</ProductName> <Quantity>1</Quantity> <USPrice>45.99</USPrice> </Item> </Items> </PurchaseOrder> <PurchaseOrder PurchaseOrderNumber="99504" OrderDate="1999-10-22"> <Address Type="Shipping"> <Name>Jessica Arnold</Name> <Street>4055 Madison Ave</Street> <City>Seattle</City> <State>WA</State> <Zip>98112</Zip> <Country>USA</Country> </Address> <Address Type="Billing"> <Name>Jessica Arnold</Name> <Street>4055 Madison Ave</Street> <City>Buffalo</City> <State>NY</State> <Zip>98112</Zip> <Country>USA</Country> </Address> <Items> <Item PartNumber="898-AZ"> <ProductName>Computer Keyboard</ProductName> <Quantity>1</Quantity> <USPrice>29.99</USPrice> </Item> <Item PartNumber="898-AM"> <ProductName>Wireless Mouse</ProductName> <Quantity>1</Quantity> <USPrice>14.99</USPrice> </Item> </Items> </PurchaseOrder> </PurchaseOrders>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://tempuri.org/po.xsd" xmlns="http://tempuri.org/po.xsd" elementFormDefault="qualified"> <xs:annotation> <xs:documentation xml:lang="en"> Purchase order schema for Example.com. Copyright 2000 Example.com. All rights reserved. </xs:documentation> </xs:annotation> <xs:element name="purchaseOrder" type="PurchaseOrderType"/> <xs:element name="comment" type="xs:string"/> <xs:complexType name="PurchaseOrderType"> <xs:sequence> <xs:element name="shipTo" type="USAddress"/> <xs:element name="billTo" type="USAddress"/> <xs:element ref="comment" minOccurs="0"/> <xs:element name="items" type="Items"/> </xs:sequence> <xs:attribute name="orderDate" type="xs:date"/> </xs:complexType> <xs:complexType name="USAddress"> <xs:annotation> <xs:documentation> Purchase order schema for Example.Microsoft.com. Copyright 2001 Example.Microsoft.com. All rights reserved. </xs:documentation> <xs:appinfo> Application info. </xs:appinfo> </xs:annotation> <xs:sequence> <xs:element name="name" type="xs:string"/> <xs:element name="street" type="xs:string"/> <xs:element name="city" type="xs:string"/> <xs:element name="state" type="xs:string"/> <xs:element name="zip" type="xs:decimal"/> </xs:sequence> <xs:attribute name="country" type="xs:NMTOKEN" fixed="US"/> </xs:complexType> <xs:complexType name="Items"> <xs:sequence> <xs:element name="item" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="productName" type="xs:string"/> <xs:element name="quantity"> <xs:simpleType> <xs:restriction base="xs:positiveInteger"> <xs:maxExclusive value="100"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="USPrice" type="xs:decimal"/> <xs:element ref="comment" minOccurs="0"/> <xs:element name="shipDate" type="xs:date" minOccurs="0"/> </xs:sequence> <xs:attribute name="partNum" type="SKU" use="required"/> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> <!-- Stock Keeping Unit, a code for identifying products --> <xs:simpleType name="SKU"> <xs:restriction base="xs:string"> <xs:pattern value="\d{3}-[A-Z]{2}"/> </xs:restriction> </xs:simpleType> </xs:schema>
<?xml version="1.0"?> <purchaseOrder xmlns="http://tempuri.org/po.xsd" orderDate="1999-10-20"> <shipTo country="US"> <name>Alice Smith</name> <street>123 Maple Street</street> <city>Mill Valley</city> <state>CA</state> <zip>90952</zip> </shipTo> <billTo country="US"> <name>Robert Smith</name> <street>8 Oak Avenue</street> <city>Old Town</city> <state>PA</state> <zip>95819</zip> </billTo> <comment>Hurry, my lawn is going wild!</comment> <items> <item partNum="872-AA"> <productName>Lawnmower</productName> <quantity>1</quantity> <USPrice>148.95</USPrice> <comment>Confirm this is electric</comment> </item> <item partNum="926-AA"> <productName>Baby Monitor</productName> <quantity>1</quantity> <USPrice>39.98</USPrice> <shipDate>1999-05-21</shipDate> </item> </items> </purchaseOrder>
<?xml version="1.0" encoding="utf-8"?> <PurchaseOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.cpandl.com"> <ShipTo Name="Teresa Atkinson"> <Line1>1 Main St.</Line1> <City>AnyTown</City> <State>WA</State> <Zip>00000</Zip> </ShipTo> <OrderDate>Wednesday, June 27, 2001</OrderDate> <Items> <OrderedItem> <ItemName>Widget S</ItemName> <Description>Small widget</Description> <UnitPrice>5.23</UnitPrice> <Quantity>3</Quantity> <LineTotal>15.69</LineTotal> </OrderedItem> </Items> <SubTotal>15.69</SubTotal> <ShipCost>12.51</ShipCost> <TotalCost>28.2</TotalCost> </PurchaseOrder>
感谢 xml2db 提出意见,我们已经发布了支撑xml脚本函数的版本,敬请下载。
感谢孟老师,软件越来越强大了
提供ERP顾问咨询及落地实施,商业智能及数据分析BI,提供私有云、公有云环境的系统集成服务,QQ号:1138418237
登录后方可发贴