Announcement Announcement Module
Collapse
No announcement yet.
linking XML files Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • linking XML files

    Hi,
    I'm trying to link two XML files using ENTITY using the following declaration at the top of my second XML file.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd" [
    <!ENTITY DatabaseConfig SYSTEM "DatabaseConfig.xml">
    ]>
    <beans>
    ......
    </beans

    But when I add the ENTITY the <beans></beans> part of my files turns red and my ide says that the error is "Element beans must be declared".

    Does anyone know why I would get this error? Is there another way to link XML files?

  • #2
    I tried this in IDEA 4.5 and it validated it correctly for me. What IDE are you using - perhaps there is a misconfiguration in the XML parser?

    Rob

    Comment


    • #3
      Spring itself provides support for importing bean configuration files using the <import> tag such as:

      <beans>
      <import resource="myBeans.xml"/>
      </beans>

      Rob

      Comment


      • #4
        I'm using IDEA 4.5.3.

        I just tried the <import/>. I can declare <beans> inside the file that i'm importing right?

        This is the header on the file I'm importing:

        <?xml version="1.0" encoding="UTF-8"?>
        <beans> ...

        But but I use import, I'm getting the following error:

        org.xml.sax.SAXParseException: The content of element type "beans" must match "(description?,import*,bean*)".
        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 ilder.java:76)
        at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:130)
        at org.springframework.beans.factory.xml.XmlBeanFacto ry.<init>(XmlBeanFactory.java:88)
        at org.springframework.beans.factory.xml.XmlBeanFacto ry.<init>(XmlBeanFactory.java:59)
        at com.gs.fw.assetservicing.announce.feeds.File.main( File.java:18)

        Comment


        • #5
          Please ignore my previous post. I used <import> and I got it to work.

          Thanks for your help!

          Comment


          • #6
            documentation update?

            It would be really useful to add documentation about <import> to the reference on beans: http://www.springframework.org/docs/...nce/beans.html.

            Unless I missed it, I didn't see how to do this from the documentation.

            Comment


            • #7
              I agree. I was looking for documentation there as well and couldn't find any.

              Comment


              • #8
                Create JIRA issue.

                Comment

                Working...
                X