Phil,
a couple of remarks:
1. It appears that the tutorial you were looking at -
http://xmlbeans.apache.org/documentation/tutorial_getstarted.html
- was written for XMLBeans 1.0.x. I have not used 1.0.x. I'm not sure if the 
files referred to in the tutorial are distibuted with 1.0.x or not, but the 
tutorial says, "Start out by creating a new tutorials directory just under your 
XMLBEANS_HOME directory. This will hold the files you create in the course of 
this tutorial." so perhaps you create the files yourself (based on the tutorial 
text).
2. In your example below, you created a new, empty document and didn't populate 
it yet. There is therefore nothing to output. If you look at
http://xmlbeans.apache.org/docs/2.0.0/guide/conGettingStartedwithXMLBeans.html
there is a better example:
 
public PurchaseOrderDocument createPO()
{
    PurchaseOrderDocument newPODoc = 
PurchaseOrderDocument.Factory.newInstance();
    PurchaseOrder newPO = newPODoc.addNewPurchaseOrder();
    Customer newCustomer = newPO.addNewCustomer();
    newCustomer.setName("Doris Kravitz");
    newCustomer.setAddress("Bellflower, CA");
    return newPODoc;
}

<ns1:purchase-order xmlns:ns1="http://openuri.org/easypo";>
    <ns1:customer>
        <ns1:name>Doris Kravitz</ns1:name>
        <ns1:address>Bellflower, CA</ns1:address>
    </ns1:customer>
</ns1:purchase-order>

Hope that helps,
Wing Yew


  _____  

From: PhilNad214 PhilNad214 [mailto:philnad...@gmail.com] 
Sent: Sunday, November 21, 2010 9:17 PM
To: user@xmlbeans.apache.org
Subject: Re: Problems getting started with xmlbeans


As a followup to this, here is an example:

import org.openuri.easypo.PurchaseOrderDocument;
public class POUpdater {
    POUpdater() {
        PurchaseOrderDocument pod = PurchaseOrderDocument.Factory.newInstance();
        System.out.println(pod.toString());
    }
    public static void main(String args[]) {
        POUpdater po = new POUpdater();
    }
}

... which outputs:

<xml-fragment/>

Shouldn't it output at least an XML structure with at least the basic structure 
of the bean?



On Mon, Nov 22, 2010 at 5:44 PM, PhilNad214 PhilNad214 <HYPERLINK 
"mailto:philnad...@gmail.com"philnad...@gmail.com> wrote:


Hi, I posted here a couple of weeks ago some basic 'getting started' questions. 
I've just got back to this project and have started using some generated code - 
have created a bean and tried to convert to xml, but all I get is the namespace 
in the xml. I.e it is as if the document.toString() is just showing the top 
node, and not traversing its way through the object to generate all the xml.
Does this sound familiar to anyone? Any suggestions?

The next thing I thought I must be doing something wrong, so I've gone back to 
the getting started tutorial at 
http://xmlbeans.apache.org/documentation/tutorial_getstarted.html
However I cannot for the life of me find a tutorial folder (although I did find 
the easypo.xsd and have successfully generated an easypo.jar). I can't see the 
tutorial files on the apache xmlbeans website anywhere... where on earth do you 
get that from??

Thanks


Reply via email to