本文介绍了从xml生成xsd时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我想比较2 xmls的模式结构。出于这个目的,我从一个xml创建了xsd,然后将xsd(模式结构)与另一个xml进行比较...这样我就可以知道两个xml是否具有相同的结构或不是。 以下是xmlI 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> ,错误来了 但是当我使用以下xsdwhen comparing xml and xsd both,error comesbut 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> 比较成功 请帮助 hight可感知comparison is successfulpls helphight appreciable推荐答案 这篇关于从xml生成xsd时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!