Html 未找到元素XML/XSD的声明
我对XML非常陌生,我面临验证方面的问题,如果我的XML和XSD文件结构良好,我也希望得到一些反馈 在根据XSD->No声明验证XML时,我经常遇到错误 我正在windows上使用程序XML复制编辑器。 我还尝试了一个针对XSD的在线验证器XML,并得到了这个错误 我收到错误Src resolve:无法将名称“string”解析为“type Definition”组件 XML XSDHtml 未找到元素XML/XSD的声明,html,xml,xsd,Html,Xml,Xsd,我对XML非常陌生,我面临验证方面的问题,如果我的XML和XSD文件结构良好,我也希望得到一些反馈 在根据XSD->No声明验证XML时,我经常遇到错误 我正在windows上使用程序XML复制编辑器。 我还尝试了一个针对XSD的在线验证器XML,并得到了这个错误 我收到错误Src resolve:无法将名称“string”解析为“type Definition”组件 XML XSD 找不到元素xs:schema的声明时出错。这意味着您正在尝试验证模式,而不是实例文档。您没有说明如何调用验证,但
找不到元素xs:schema的声明时出错。这意味着您正在尝试验证模式,而不是实例文档。您没有说明如何调用验证,但我怀疑在您使用的任何API中,模式和源文档都是错误的。base=string需要替换为base=xs:string,这解决了您所看到的直接问题。可能还有其他人。
<?xml version="1.0" encoding="UTF-8"?>
<alumnos>
<alumno>
<nombre>Samuel</nombre>
<apellido>Van Bladel</apellido>
<email>Samuelvanbladel@gmail.com</email>
<foto>google.com</foto>
<expediente>NX-0001R</expediente>
<curso>1</curso>
<modulo>Mark up languages
<nota>10/10</nota>
<comentario>Muy bien hecho hasta el techo.</comentario>
</modulo>
<modulo>Java
<nota>9/10</nota>
<comentario>Codigo muy bien structurada.</comentario>
</modulo>
</alumno>
<alumno>
<nombre>Deniz</nombre>
<apellido>Turki</apellido>
<email>DenizTurki@gmail.com</email>
<foto>google.com</foto>
<expediente>NX-0002R</expediente>
<curso>2</curso>
<modulo>Mark up languages
<nota>10/10</nota>
<comentario>Muy bien hecho hasta el techo.</comentario>
</modulo>
<modulo>Java
<nota>9/10</nota>
<comentario>Codigo muy bien structurada.</comentario>
</modulo>
</alumno>
<alumno>
<nombre>Denisa</nombre>
<apellido>Hermann</apellido>
<email>Denisahermann@gmail.com</email>
<foto>google.com</foto>
<expediente>NX-0003R</expediente>
<curso>3</curso>
<modulo>Mark up languages
<nota>10/10</nota>
<comentario>Muy bien hecho hasta el techo.</comentario>
</modulo>
<modulo>Java
<nota>9/10</nota>
<comentario>Codigo muy bien structurada.</comentario>
</modulo>
</alumno>
<alumno>
<nombre>Bruno</nombre>
<apellido>porto</apellido>
<email>BrunoPorto@gmail.com</email>
<foto>google.com</foto>
<expediente>NX-0004R</expediente>
<curso>4</curso>
<modulo>Mark up languages
<nota>10/10</nota>
<comentario>Muy bien hecho hasta el techo.</comentario>
</modulo>
<modulo>Java
<nota>9/10</nota>
<comentario>Codigo muy bien structurada.</comentario>
</modulo>
</alumno>
</alumnos>
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- definition of simple elements -->
<xs:element name="nombre">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[a-zA-Z0-9]{20}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="apellido">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[a-zA-Z0-9]{30}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="comentario">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[a-zA-Z0-9]{50}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="modulo">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[a-zA-Z0-9]{10}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="nota" >
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:pattern value="[0-9]{8}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="email">
<xs:simpleType >
<xs:restriction base="xs:string">
<xs:pattern value="[^@]+@[^\.]+\..+"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="foto">
<xs:simpleType>
<xs:restriction base="xs:anyURI">
<xs:pattern value="http://.+" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="expediente">
<xs:simpleType>
<xs:restriction base="string">
<xs:pattern value="NX + [0-9][0-9][0-9][0-9][0-9] + R"/>
</xs:restriction>
</xs:simpleType>
<!-- definition of attributes -->
<xs:attribute name="id" type="xs:integer" use="required"/>
<!-- definition of complex elements -->
<xs:element name="alumno">
<xs:complexType>
<xs:sequence>
<xs:element ref="nombre"/>
<xs:element ref="apellido"/>
<xs:element ref="modulo"/>
<xs:element ref="nota"/>
<xs:element ref="expediente"/>
<xs:element ref="foto"/>
<xs:element ref="email"/>
<xs:element ref="comentario"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:element>
</xs:schema>