Hallo again,

I realized to parse the example xml file in the tutorial. I now simply want
to write the PurchaseOrderElement to a new xml file but I get error messages
when trying to. Here is the code and the error. What am I doing wrong?
Please, any help is appreciated.
Thanks,
Steffen

                        File f = new
File("/home/sg/workspace/xml-po/src/test/resources/org/geotools/po/po.xml");
                        URI uri = f.toURI();
                        InputStream input = uri.toURL().openStream();
                        POConfiguration configuration = new POConfiguration();
                        Parser parser = new Parser(configuration);
                        PurchaseOrderType po = (PurchaseOrderType) 
parser.parse(input);
                        System.out.println(po.getBillTo().getName());
                        
                        Encoder encoder = new Encoder(configuration);
                        System.out.println(encoder.getSchema().toString());
                        OutputStream out = new FileOutputStream("test.xml");
                        QName name = new QName(configuration.getNamespaceURI());
                        encoder.encode(po, name, out);

Robert Smith
[EMAIL PROTECTED] (element: [xsd:schema: null])
(document: [#document: null], schemaLocation:
file:/home/sg/workspace/xml-po/po.xsd, targetNamespace:
http://www.geotools.org/po, attributeFormDefault: <unset>,
elementFormDefault: qualified, finalDefault: [], blockDefault: [], version:
null)
Exception in thread "main" java.lang.NullPointerException
        at org.geotools.xml.Encoder.encode(Encoder.java:364)
        at org.geotools.po.POTest.main(POTest.java:50)
-- 
View this message in context: 
http://www.nabble.com/Problem-with-xml-binding-example-tf4415555.html#a12610900
Sent from the geotools-gt2-users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to