Adam Levitt
06-23-2005, 08:07 PM
I am currently using the XmlObjectFactory from Spring.NET release 0.6. I am making the following call in my code:
IResource resource = new FileSystemResource("spring.xml");
XmlObjectFactory xmlObjectFactory = new XmlObjectFactory(resource);
IDestinationManager dManager = (DefaultDestinationManager) xmlObjectFactory.GetObject("destinationManager");
My spring.xml file looks like this:
<objects xmlns="http://www.springframework.net">
<import resource="queues.xml" />
<object id="destinationManager" type="Arch.Messaging.DefaultDestinationManager, Arch.Messaging">
<property name="queues">
<dictionary>
<entry key="queue1">
<ref object="myQueue1" />
</entry>
</dictionary>
</property>
...
</object>
...
</objects>
The problem here is that when I include the definition for "queue1" in the same xml file (spring.xml), everything works properly. However, if I take the object definitions for the queues and put them into "queues.xml" which resides in the same directory as "spring.xml", and include the <import resource="queues.xml" /> tag, I get the following exception:
XmlException parsing XML document from file [c:\projects-net\ArchMessaging\conf\spring.xml]
at Spring.Objects.Factory.Xml.XmlObjectDefinitionRead er.LoadObjec
tDefinitions(IResource resource)
at Spring.Objects.Factory.Xml.XmlObjectFactory..ctor( IResource re
source)
at Arch.Messaging.DestinationManagerTest.Setup() in C:\projects-n
et\ArchMessaging\src\Arch.Messaging\TestSuite\Arch .Messaging\DestinationManagerTest.cs:line 37
My "queues.xml" file looks like this:
<objects xmlns="http://www.springframework.net">
<object id="myQueue1" type="Arch.Messaging.Queue, Arch.Messaging">
<constructor-arg type="string" index="0">
<value>queue/DummyQueue</value>
</constructor-arg>
...
</object>
...
</object>
Any pointers in the right direction would be much appreciated. I'm struggling to figure out if this is a bug or if I am doing something incorrectly.
Thanks,
Adam
IResource resource = new FileSystemResource("spring.xml");
XmlObjectFactory xmlObjectFactory = new XmlObjectFactory(resource);
IDestinationManager dManager = (DefaultDestinationManager) xmlObjectFactory.GetObject("destinationManager");
My spring.xml file looks like this:
<objects xmlns="http://www.springframework.net">
<import resource="queues.xml" />
<object id="destinationManager" type="Arch.Messaging.DefaultDestinationManager, Arch.Messaging">
<property name="queues">
<dictionary>
<entry key="queue1">
<ref object="myQueue1" />
</entry>
</dictionary>
</property>
...
</object>
...
</objects>
The problem here is that when I include the definition for "queue1" in the same xml file (spring.xml), everything works properly. However, if I take the object definitions for the queues and put them into "queues.xml" which resides in the same directory as "spring.xml", and include the <import resource="queues.xml" /> tag, I get the following exception:
XmlException parsing XML document from file [c:\projects-net\ArchMessaging\conf\spring.xml]
at Spring.Objects.Factory.Xml.XmlObjectDefinitionRead er.LoadObjec
tDefinitions(IResource resource)
at Spring.Objects.Factory.Xml.XmlObjectFactory..ctor( IResource re
source)
at Arch.Messaging.DestinationManagerTest.Setup() in C:\projects-n
et\ArchMessaging\src\Arch.Messaging\TestSuite\Arch .Messaging\DestinationManagerTest.cs:line 37
My "queues.xml" file looks like this:
<objects xmlns="http://www.springframework.net">
<object id="myQueue1" type="Arch.Messaging.Queue, Arch.Messaging">
<constructor-arg type="string" index="0">
<value>queue/DummyQueue</value>
</constructor-arg>
...
</object>
...
</object>
Any pointers in the right direction would be much appreciated. I'm struggling to figure out if this is a bug or if I am doing something incorrectly.
Thanks,
Adam