You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Malik Chettih <ma...@gmail.com> on 2006/11/28 15:31:08 UTC
Common Betwixt : PLEASE Help
Hi everybody,
I'm using Commons Betwixt to parse and write an xml file. I'm looking to
parse a part of xml like this :
<chart_value_text>
<row>
<null/>
<null/>
<null/>
<null/>
</row>
<row>
<null/>
<string>lowest\rvalue</string>
<string></string>
<null/>
</row>
<row>
<null/>
<null/>
<string></string>
<string>highest\rvalue</string>
</row>
</chart_value_text>
For map the chart_value_text
<info primitiveTypes="attribute">
<element name="chart_value_text">
<element name='row' property='rows'
class='chart.reference.ChartValueTextRow'/>
<addDefaults add-properties='false'/>
</element>
</info>
And for map a row i use :
<info primitiveTypes="attribute">
<element name='row'>
<element name='string' property='labels'/>
<addDefaults add-properties='false'/>
</element>
</info>
The java classes are :
public class ChartValueText {
protected List rows = new ArrayList();
public ChartValueText(){
}
public List getRows() {
return rows;
}
public void setRows(List rows) {
this.rows = rows;
}
public void addRow(ChartValueTextRow chartValueTextRow){
this.rows.add(chartValueTextRow);
}
}
public class ChartValueTextRow {
protected List labels = new ArrayList();
public ChartValueTextRow(){
}
public List getLabels() {
return labels;
}
public void setLabels(List labels) {
this.labels = labels;
}
public void addLabel(String label){
this.labels.add(label);
}
}
Write the xml file depend on the value of the label. If The label is
"null" the value must be <null/>. If not the parse must be
<string>VALUE OF LABEL</string>
Can you help me.
Thank's in advance.
Malik CHETTIH