Results 1 to 4 of 4

Thread: Spring 2.5 - Custom Namespace - problem with xerces

  1. #1

    Default Spring 2.5 - Custom Namespace - problem with xerces

    Hello,

    I have a problem. I create a custom namespace but it doesn't work. In fact when i use Xerces parser it doesn't work, else i use the parser shanijar it's work. I think with xerces try to validate the xml configuration file with the xsd. But it doesn't find it.

    My error
    sed by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'm:livrable'.
    at org.apache.xerces.util.ErrorHandlerWrapper.createS AXParseException(Unknown Source)
    at org.apache.xerces.util.ErrorHandlerWrapper.error(U nknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportErro r(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportErro r(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportErro r(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIEr rorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.repor tSchemaError(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.handl eStartElement(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.start Element(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.sc anStartElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerI mpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerI mpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(U nknown Source)
    at org.springframework.beans.factory.xml.DefaultDocum entLoader.loadDocument(DefaultDocumentLoader.java: 75)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio nReader.java:396)
    my configuration file:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:m="http://www.mycomp.com/schema/devcom"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.mycomp.com/schema/devcom devcom.xsd">
    
    	<m:livrable id="liv2" nom="Mon livrable 2">
    		<m:description>
    		  <![CDATA[Lui aussi il <b>est beau</b>]]>
    	  	</m:description>
    	</m:livrable>
    </beans>
    my xsd
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns="http://www.mycomp.com/schema/devcom" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    targetNamespace="http://www.mycomp.com/schema/devcom" 
    elementFormDefault="qualified" attributeFormDefault="unqualified">
    	<xsd:complexType name="descriptionType">
    		<xsd:simpleContent>
    			<xsd:extension base="xsd:string"/>
    		</xsd:simpleContent>
    	</xsd:complexType>
    	<xsd:complexType name="beanRefType">
    		<xsd:attribute name="ref" type="xsd:string" use="required"/>
    	</xsd:complexType>
    	<xsd:complexType name="livrableListType">
    		<xsd:sequence>
    			<xsd:element name="livrable" type="beanRefType" minOccurs="1" maxOccurs="unbounded"/>
    		</xsd:sequence>
    	</xsd:complexType>	
    	<xsd:element name="livrable">
    		<xsd:complexType>
    			<xsd:sequence>
    				<xsd:element name="description" type="descriptionType" minOccurs="0" maxOccurs="1"/>
    			</xsd:sequence>
    			<xsd:attribute name="id" type="xsd:ID" use="required"/>
    			<xsd:attribute name="nom" type="xsd:string" use="required"/>
    			<xsd:attribute name="description" type="xsd:string" use="optional"/>
    		</xsd:complexType>
    	</xsd:element>
    		<xsd:element name="activite">
    		<xsd:complexType>
    			<xsd:sequence>
    				<xsd:element name="entrees" type="livrableListType" minOccurs="0" maxOccurs="1"/>
    				<xsd:element name="sorties" type="livrableListType" minOccurs="0" maxOccurs="1"/>
    			</xsd:sequence>
    			<xsd:attribute name="id" type="xsd:ID" use="required"/>
    			<xsd:attribute name="nom" type="xsd:string" use="required"/>			
    		</xsd:complexType>
    	</xsd:element>
    </xsd:schema>
    Have you any ideas?

  2. #2

    Default

    please i need help

  3. #3

    Default

    i put the xsd in META-INF directory (with spring.schemas and spring.handlers). Is it the good directory?

  4. #4

    Default

    finally i found the problem:

    It's in my spring.schemas. I forgotten to put the folder META-INF:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •