从xml生成xsd时出错 [英] error in generating xsd from xml
本文介绍了从xml生成xsd时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想比较2 xmls的模式结构。出于这个目的,我从一个xml创建了xsd,然后将xsd(模式结构)与另一个xml进行比较...这样我就可以知道两个xml是否具有相同的结构或不是。
以下是xml
I want to compare the schema structure of 2 xmls.For that purpose I created xsd from one xml and then comparig that xsd (schema structure) with another xml...so that I can know whether both xml have same structure or not.
following is xml
<?xml version="1.0"?>
<bookstore xmlns="generic">
<book genre="autobiography">
<title>The Autobiography of Benjamin Franklin</title>
<author>
<first-name>Ben</first-name>
<last-name>Franklin</last-name>
</author>
<price>89.88</price>
</book>
<book genre="novel">
<title>The Confidence Man</title>
<author>
<first-name>John</first-name>
<last-name>Melville</last-name>
</author>
<price>11.99</price>
</book>
</bookstore>
生成的xsd是
generated xsd is
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="bookstore" targetNamespace="generic" xmlns:mstns="generic" xmlns="generic" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="bookstore" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="book">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string" minOccurs="0" msdata:Ordinal="0" />
<xs:element name="price" type="xs:string" minOccurs="0" msdata:Ordinal="2" />
<xs:element name="author" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="first-name" type="xs:string" minOccurs="0" />
<xs:element name="last-name" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="genre" form="unqualified" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<当比较xml和xsd两者时,
,错误来了
但是当我使用以下xsd
when comparing xml and xsd both,error comes
but when i use following xsd
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="generic" elementFormDefault="qualified" targetNamespace="generic">
<xsd:element name="bookstore" type="bookstoreType"/>
<xsd:complexType name="bookstoreType">
<xsd:sequence maxOccurs="unbounded">
<xsd:element name="book" type="bookType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="bookType">
<xsd:sequence>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="author" type="authorName"/>
<xsd:element name="price" type="xsd:decimal"/>
</xsd:sequence>
<xsd:attribute name="genre" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="authorName">
<xsd:sequence>
<xsd:element name="first-name" type="xsd:string"/>
<xsd:element name="last-name" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
< br $>
比较成功
请帮助
hight可感知
comparison is successful
pls help
hight appreciable
推荐答案
这篇关于从xml生成xsd时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文