SQL与XML的深度融合:从基础到应用
1. XML命名空间与模式
在处理XML时,命名空间的使用十分关键。在模式头中识别的每个命名空间都可分配一个前缀名,用于限定对该命名空间内项目的引用。例如以下典型的模式头和模式体摘录,它使用前缀名和限定来引用主XML模式命名空间(由W3C维护)和公司命名空间:
<schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:corp="http://www.mycompany.com/schemas/purchasing" > <complexType> … other element declarations go here … <element name-="orderDate" type="xsd:date" /> <element type="corp:custAddrType" /> <element type="corp:custAddrType" /> <element type="corp:repListType" nillable="true" /> … other element declarations continue …在这个例子中,公司XML命名空间由前缀corp