commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Wood <jas...@auto-trol.com>
Subject [betwixt] couple of questions
Date Wed, 19 Jan 2005 15:41:20 GMT
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(Unknown
Source)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unkno
wn Source)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
her.dispatch(Unknown Source)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
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(XMLIntrospect
or.java:949)
	at
org.apache.commons.betwixt.XMLIntrospector.introspect(XMLIntrospector.java:4
65)
	at
org.apache.commons.betwixt.XMLIntrospector.introspect(XMLIntrospector.java:4
12)
	at
org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(AbstractBeanWrite
r.java:223)
	at
org.apache.commons.betwixt.io.AbstractBeanWriter.write(AbstractBeanWriter.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.java:39
)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message