j'ai un xsd très simple qui définit un élément « cache »fichier de configuration Spring ne peut pas analyser les éléments définis dans mon propre schéma
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns="http://mysite/schema/cache"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://mysite/schema/cache">
<xsd:complexType name="objectType" abstract="false">
<xsd:attribute name="target" type="xsd:string">
</xsd:attribute>
</xsd:complexType>
<xsd:complexType name="cacheType">
<xsd:sequence>
<xsd:element name="object" type="xsd:string" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="cache" type="cacheType"></xsd:element>
</xsd:schema>
J'ai un fichier de configuration de printemps avec:
<?xml version="1.0" encoding="utf-8"?>
<objects xmlns="http://www.springframework.net"
xmlns:cache="http://mysite/schema/cache"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mysite/schema/cache http://mysite/cache.xsd">
<description>
</description>
<cache:cache>
<cache:object target="site"/>
</cache:cache>
</objects>
Au cours de l'appel à
Spring.Objects.Factory.Xml.XmlObjectDefinitionReader.DoLoadObjectDefinitions at startup, I get the following error:
[XmlSchemaValidationException: The 'http://mysite/schema/cache:cache' element is not declared.]
Ceci suggère que le ressort ne peut pas trouver mon schéma, mais le xsd est disponible.
Des idées pour lesquelles cela ne fonctionne pas?
Eh bien, j'ai défini un analyseur d'espace de noms et cela fonctionne maintenant .. mis à part le fait que mon schéma semble être le cul – iasksillyquestions
Mon xsd n'avait pas l'attribut elementFormDefault = "qualifié"! – iasksillyquestions
Pour plus de détails sur l'utilisation de elementFormDefault, consultez cette discussion: http://www.xfront.com/HideVersusExpose.html –