users@jaxb.java.net

marshal vector , Please help

From: maliheh <maliheh.shariat_at_dtasoft.com>
Date: Sat, 6 Dec 2008 01:01:26 -0800 (PST)

Hi all

I have a vector type in my code , but when I add object to this and marshal
it , it doesnt return correct xml file, indeed it doesnt return any xml line
in xml file .

My code is :

ObjectFactory factory = new ObjectFactory();
ProcessSpecification ps = (ProcessSpecification)
(factory.createProcessSpecification());
WrappedVector choice =
ps.getChoiceSemanticallyPreservedPackageOrBusinessTransactionHeadOrBinaryCollaboration();

BusinessCollaborationType bcType = new BusinessCollaborationType();
bcType.setName("test");
bcType.setNameID("test_id");
choice.add(bcType);

marshaller.setProperty(marshaller.JAXB_FORMATTED_OUTPUT, new Boolean(true));

File xmlDocument = new File(dir.getPath().concat("resultFile"));

marshaller.marshal(ps, new FileOutputStream(xmlDocument));
            }


and WrappedVector is a class that extend Vector class , indeed WrappedVector
is customize of Vector.



public class WrappedVector extends Vector {

    protected HashMap vectorValidTypes;

    public WrappedVector(String s) {
        super(10);
        vectorValidTypes = new HashMap();
        StringTokenizer stringtokenizer = new StringTokenizer(s, ",");

        String s1;
        for (; stringtokenizer.hasMoreTokens();) {
            s1 = stringtokenizer.nextToken();
            String key = "";
            String value = "";
            if (s1.contains("[") && !s1.startsWith("new")) {
                key = s1.substring(0, s1.indexOf("["));
                value = s1.substring(s1.indexOf("[") + 1, s1.indexOf("]"));
            } else {
                key = s1;
                value = s1;
            }
            vectorValidTypes.put(key, value);
        }
    }
        .
        .
        .
}

I dont understand what is problem in my code that marshalling this type
doesnt return any line in xml file.

Please help


-- 
View this message in context: http://www.nabble.com/marshal-vector-%2C-Please-help-tp20868048p20868048.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.