-
1. Re: Reusing xml element definitions/bindings
adrian.brock Mar 16, 2005 6:00 PM (in response to adrian.brock)Just to make it more concrete, I'm looking to parse something like:
<property name="whatever"> <collection> <value>SomeValue</value> <list> <dependency value="xxx"/> </list> </collection> </property> into <property> PropertyMetaData pmd = new PropertyMetaData(); <collection> CollectionMetaData cmd = new CollectionMetaData(); <value>SomeValue</value> StringValueMetaData smd = new StringValueMetaData(); smd.setValue("SomeValue"); cmd.add(smd); <list> ListValueMetaData lmd = new ListValueMetaData(); <dependency value="xxx"/> DependencyValueMetaData dvmd = new DependencyValueMetaData(); dvmd.setValue("xxx"); lmd.add(dvmd); cmd.add(lmd); pmd.setValue(cmd);
but property could easily be replaced with parameter/ParameterMetaData
that needs to do the exactly same thing on its setValue(). -
2. Re: Reusing xml element definitions/bindings
aloubyansky Mar 17, 2005 8:56 AM (in response to adrian.brock)Ok, it seems like I am going to disappoint you.
Being a Junior Scientist, I have been doing a lot of research trying to come up with the best unmarshalling metadata/handling model based on your XML snippets and requirements for customizing bindings from different sources including inheritance of bindings from parent binding sources. As a result, I now have three prototypes:
1) org.jboss.xml.binding.metadata.unmarshalling
You are using this one. You are right, there is no notion of a type here.
2) org.jboss.xml.binding.metadata
This one does have a notion of a type. Different elements can use the same type. It was hard to support nested maps in this model and I found other limitations. So, I came up with the third one.
3) org.jboss.xml.binding.sunday.unmarshalling
This is the model I currently believe in since with this API all your (XML/Java binding) requirements I know of seem to be met.
There is a testcase for the XML snippet from you using this api inpackage org.jboss.test.xml; public class MiscUnitTestCase public void testConfigWithSunday() throws Exception
This is very verbose. It doesn't use defualt binding rules yet (I am working on it right now), i.e. it requires manual binding for each element/attribute/text_content.
As a prototype, it is under active development.
I am sorry for making you learn new API each time. The last one should be sufficient in features for you. Let's get the first binding of your xml done (maybe not in a convenient way) and then let me maintain that part.
I am looking at your testcases. I could convert them to use the new API. -
3. Re: Reusing xml element definitions/bindings
aloubyansky Mar 17, 2005 11:37 AM (in response to adrian.brock)Moved last API testcases to thier own unit testcase
package org.jboss.test.xml; public class SundayUnitTestCase
Also added first runtime binding testcase (testRtBook) with selective binding customizations. -
4. Re: Reusing xml element definitions/bindings
aloubyansky Mar 18, 2005 5:58 PM (in response to adrian.brock)package org.jboss.test.xml; public class SundayUnitTestCase public void testKernel() throws Exception
Contains binding for kernel's XML schema based on what I have seen in the XMLKernelDeployer and XML test files.
The method is in comments since kernel's classes are not in the testsuite classpath.
Also, I have just typed it, not actually tested. This is very verbose and doesn't reuse handlers though there are places were it could.
Adrian, do you want me to complete this for you?