开发者

(Easy one) Alter xml schema collection on sql server to modify an element's attribute

I have the following xml schema named XsdContacts(pretty sim开发者_如何学Pythonple actually)

<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="contact">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" nillable="true" />
<xs:element name="position" type="xs:string" nillable="true" />
<xs:element name="phone1" nillable="true">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:unsignedInt">
<xs:attribute name="idtipo" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="phone2" nillable="true">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:unsignedInt">
<xs:attribute name="idtipo" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="email" type="xs:string" nillable="true" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

And I want to alter lines 12 and 21, I want to add a Default to that attribute. The thing is that I tried to do it with the alter xml schema collection but it won't work.


Have a look at chapter 14 in The Art of XSD SQL Server Schema Collections. You think you need to drop the schema collection and recreate it again and before you do that you need to remove any bindings to the schema.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜