I´m trying to serialize a Vector of Strings. They are the security-roles
allowed to access some part of my webapp. The output i need is this:
<security-roles>
<security-role rol="rol1" />
<security-role rol="rol2" />
<security-role rol="rol3" />
<security-role rol="rol4" />
</security-roles>
but all i can obtain is this:
<security-roles>
<security-role rol="[rol1, rol2, rol3, rol4]"/>
</security-roles>
The bean i'm using is :
public class SecurityRolesBean {
private Vector rolesList;
public SecurityRolesBean (){
rolesList = new Vector();
}
public Vector getRolesList(){
return rolesList;
}
public void setServiceRole(String role){
setRolesList(role);
}
private void setRolesList(String rol){
rolesList.addElement(rol);
}
}
and the dot betwixt file:
<?xml version="1.0"?>
<info>
<element name="security-roles">
<element name="security-role">
<attribute name='rol' property='rolesList'/>
</element>
</element>
</info>
The question is: How can i put each of the Vector's elements (which are
Strings) in separate xml elements?
The inverse step (populating the Bean with data read from a xml file) is
done with Digester following this rule:
[...]
<pattern value="security-role">
<set-properties-rule>
<alias attr-name="rol" prop-name="serviceRole" />
</set-properties-rule>
</pattern>
[...]
Due to Digester cannot perform the inverse operation (writting beans to
xml files) i´m trying to move it to Betwixt, but the xml format cannot
change.
Thanks in advance.
--
Rodrigo Partearroyo González
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]