【发布时间】:2012-02-12 16:42:45
【问题描述】:
如果我正在为业务对象定义架构(使用 Visual Studio 2010 的 XML 编辑器),如何导入外部命名空间?我正在扩展 Google Commerce Search 的架构,但如何定义以命名空间为前缀的元素?例如在查询我的一些产品数据时,属于app 命名空间的一个元素edited 看起来像:
<app:edited>2012-01-17T17:22:05.182Z</app:edited>
Visual Studio 建议我可能需要为 http://www.w3.org/2007/app 命名空间导入 .xsd 文件。我是否需要为已包含在 Google 产品供稿中的其他命名空间查找其他 .xsd 文件?例如xmlns:sc 和 xmlns:scp 在哪里可以找到这些?还是我完全错了?
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="entry"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3.org/2005/Atom"
elementFormDefault="qualified"
xmlns="http://www.w3.org/2005/Atom"
xmlns:app="http://www.w3.org/2007/app"
xmlns:sc="http://schemas.google.com/structuredcontent/2009"
xmlns:scp="http://schemas.google.com/structuredcontent/2009/products">
<xs:element name="entry">
<xs:complexType>
<xs:sequence>
<xs:element name="id" type="xs:anyURI"></xs:element>
<xs:element name="published" type="xs:date"></xs:element>
<xs:element name="updated" type="xs:date"></xs:element>
<xs:element name="title" type="xs:string"></xs:element>
<!-- how do I define the <app:edited type="date" /> element here?? -->
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
【问题讨论】:
标签: xml visual-studio-2010 xsd google-api