users@jaxb.java.net

Binder getXmlNode method return null

From: cédric.briançon <cbrianco_at_gmail.com>
Date: Mon, 11 Feb 2008 02:41:16 -0800 (PST)

Hi JAXB-users list,

I'm trying to use the binding process as following :
        // First creates a KeywordsImpl object, with some dummy values
        final KeywordsImpl keyword = new KeywordsImpl();
        keyword.setKeywords(Arrays.asList(new InternationalString[] {
            new SimpleInternationalString("test1"), new
SimpleInternationalString("test2")
        }));
        keyword.setType(KeywordType.THEME);
        // Now try to marshal this object
        final JAXBContext context =
JAXBContext.newInstance(keyword.getClass());
        final Binder<Node> binder = context.createBinder();
        Node keywordNode = binder.getXMLNode(keyword);
        binder.marshal(keyword, keywordNode);

But the method binder.getXMLNode(keyword) returns me a null value...
I don't know why...

By the way, on the same object, this method works :

        final JAXBContext context =
JAXBContext.newInstance(KeywordsImpl.class);
        final Marshaller marshaller = context.createMarshaller();
        final File tempXml = File.createTempFile("jaxb", ".tmp");
        final FileWriter writer = new FileWriter(tempXml);
        // keyword is intanciated the same way as before.
        marshaller.marshal(keyword, writer);
        writer.close();

It writes correctly in my temporary xml file the XML representation of my
KeywordsImpl object.

So why the first method does not work ?
I hope finding some help here :)

Thanks!

Cédric

-- 
View this message in context: http://www.nabble.com/Binder-getXmlNode-method-return-null-tp15409034p15409034.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.