Announcement Announcement Module
No announcement yet.
Using XML value/ref shortcuts not working Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using XML value/ref shortcuts not working

    Hi, I am getting a strange intermittent error (not on all machines) trying to use property/value shortcut in the XML file.

    This form:

    <property name="name" value="StockQuoteFeed"/>

    is giving SAXParseException:

    org.springframework.beans.factory.BeanDefinitionSt oreException: Line 75 in XML document from class path resource [spring-configuration.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Attribute "value" must be declared for element type "property".
    org.xml.sax.SAXParseException: Attribute "value" must be declared for element type "property".
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(U nknown Source)
    at javax.xml.parsers.DocumentBuilder.parse(DocumentBu
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR

    When replaced with non-shortcut version:

    <property name="name"><value>StockQuoteFeed</value></property>

    the error on this line goes away. I get the same issue with using "ref".

    Note that this error only happens on two out of three development boxes I tried it on. One of the three just miraculously works. IntelliJ IDEA reports no errors with the XML file, its only when I run the SPring client is when I get this error.

    I am using ClassPathXmlApplicationContext to load XML file in my test client.

    Any help much appreciated, since the shortcut version saves a lot of typing!

    Kindest regards,

  • #2
    What version of Spring are you using? Shortcuts (as attributes) are supported since Spring 1.2 - check out your Spring version DTD.


    • #3

      Ah, of course!

      Thank you very much. The JAR I was using on the machines that break is 1.1.5, while the machine that worked is 1.2.5. So it explains it perfectly.

      Once again thanks,