hi jason

i've had a check and i'm pretty sure that the functionality you required was added to betwixt as part of the anonymous collections work. please update to CVS HEAD and take a look at the latest documentation.

- robert

On 19 Jan 2005, at 15:41, Jason Wood wrote:

1) is there a document describing the different attributes each element in a
configuration file an contain?
2) has to do with List.


When using a configuration if the <addDefaults/> element is not present then
all properties must be explicitly listed. For a List property to show up in
the XML output, it as all the rest must be explicitly listed ... <element
name="MyAttributes" property="attributes"/>. This is fine, but "MyAttribute"
will show up for every entry in the java.util.List...


example ...

public class OutterClass
{
  private Vector attributes = new Vector();

  public OutterClass()
  {
    attributes.add(new DerivedClassA());
    attributes.add(new DerivedClassB());
  }

  public void addAttribute(BaseClass attr)
  {
   attributes.add(attr);
  }

  public Vector  getAttributes()
  {
    return attributes;
  }
}

public class DerivedClassA implements BaseClass
{
}

public class DerivedClassB implements BaseClass
{
}

<?xml version='1.0' encoding='UTF-8' ?>
<info>
<element name='MyOutterClass'>
 <element name="MyAttributes" property="attributes"/>
</element>
</info>

<MyOutterClass>
  <MyAttributes/>
  <MyAttributes/>
</MyOutterClass>
-----------------------------------------------------------------

I tried to remove the name="MyAttribtue" because I want betwixt to use each
entries (DerivedClassA and DerivedClassA) .betwixt file. for instance


<info>
 <element name="MyDerivedClassA">
  <addDefaults/>
 </element>
</info>

<info>
 <element name="MyDerivedClassB">
  <addDefaults/>
 </element>
</info>

but the digester states the "name" attribtue is required...

[ERROR] Digester - Begin event threw exception <org.xml.sax.SAXException:
Name attribute is required.>org.xml.sax.SAXException: Name attribute is
required.
at
org.apache.commons.betwixt.digester.ElementRule.begin(ElementRule.java: 75)
at
org.apache.commons.digester.Digester.startElement(Digester.java:1286)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
Source)
at
org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknow n
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement( Unkno
wn Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDi spatc
her.dispatch(Unknown Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unkn own
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1629)
at
org.apache.commons.betwixt.XMLIntrospector.findByXMLDescriptor(XMLIntro spect
or.java:949)
at
org.apache.commons.betwixt.XMLIntrospector.introspect(XMLIntrospector.j ava:4
65)
at
org.apache.commons.betwixt.XMLIntrospector.introspect(XMLIntrospector.j ava:4
12)
at
org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(AbstractBean Write
r.java:223)
at
org.apache.commons.betwixt.io.AbstractBeanWriter.write(AbstractBeanWrit er.ja
va:155)
at
org.apache.commons.betwixt.io.BeanWriter.write(BeanWriter.java:190)
at com.betwixt.Main.main(Main.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja va:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso rImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)


I thought I could use the PluralStemmer in this case, but there is not
enough information being passed to findPluralDescriptor( String
propertyName, Map map ) in order for the code to choose the right
ElementDescriptor. Is it possible that if the name attribute is not present
to tell betwixt to use the given name in the classes .betwixt file for
output? If it is possible and not already in the current CVS src ... can I
checkout the source and add it.


Thanks
J




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to