Details
-
Type: New Feature
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
XStream (also at Codehaus), can take an SAX element and make an instance. We need to use this inside XMLAssemblyNanoContainer (see test case) to allow configuration (pseudo-components) to be inlined in the main xml document.
XStream is only one case of course..
<component impl='org.nanocontainer.testmodel.WebServerConfigBean' instansior='XStream'>
<host>foobar.com</host>
<port>4321</port>
</component>
... or...
<pseudo-component instansior='XStream'>
<persisted-state impl='org.nanocontainer.testmodel.WebServerConfigBean'>
<host>foobar.com</host>
<port>4321</port>
</persisted-state>
</pseudo-component>
It may be that PseudoComponentXMLInstansior is simple like so -
interface PseudoComponentXMLInstansior {
Object makeInstance(Element elem)
throws SAXException, ClassNotFoundException;
}
Activity
Field | Original Value | New Value |
---|---|---|
Status | Unassigned [ 1 ] | Closed [ 6 ] |
Resolution | Fixed [ 1 ] |
Joe says :-
Element element = ....;
XStream xs = new XStream();
Object result = xs.readObject(new DomXMLReader(element));
pico.registerInstance(foo, result); // blah
He also say see how XStream serializes first
System.out.println(xs.writeObject(myobj));