Johnny – The error you got means that executing the PurchaseOrderDocument.Factory.parse method requires that javax.xml.stream.XMLStreamReader be on your class path, and that it appears not to be. You’ll find XMLStreamReader in jsr173_api.jar, which is included with the XMLBeans distribution.

 

The parse (actually XmlObject.Factory.parse) method is inherited by all types generated from schema. Here’s a description from the tutorial at http://xmlbeans.apache.org/documentation/tutorial_getstarted.html:

 

“You bind the XML document — the root element and its children — to the PurchaseOrderDocument interface. This interface, like all types extending XmlObject (including all types generated from schema), provides a Factory class with which to create new instances. The Factory class provides various versions of the parse method, each receiving XML source as a different Java type.”

 

And one from an introductory topic here: http://xmlbeans.apache.org/docs/2.0.0/guide/conGettingStartedwithXMLBeans.html:

 

“Note that all types (including those generated from schema) inherit from XmlObject, and so provide a Factory class. For an overview of the type system in which XmlObject fits, see XMLBeans Support for Built-In Schema Types. For reference information, see XmlObject Interface.”

 

So you could generate and read Javadoc for the generated types if you like, or you could read the Javadoc for the XmlObject interface (which provides quite a lot of information) or XmlObject.Factory class.

In terms of knowing about the types generated from your schema, the topic you’re reading introduces the idea that they’re part of a hierarchy that includes types in the XMLBeans API:

“The generated types you saw used in the preceding example are actually part of a hierarchy of XMLBeans types. This hierarchy is one of the ways in which XMLBeans presents an intuitive view of schema. At the top of the hierarchy is XmlObject, the base interface for XMLBeans types. Beneath this level, there are two main type categories: generated types that represent user-derived schema types, and included types that represent built-in schema types.

This topic has already introduced generated types. For more information, see Java Types Generated from User-Derived Schema Types.

 

The topic linked at the end of that last sentence attempts to introduce how your schema types are translated into Java. And the following topic attempts to describe the kinds of methods those generated types will expose: http://xmlbeans.apache.org/docs/2.0.0/guide/conMethodsForGeneratedJavaTypes.html. Because schemas will differ from one another, so too will the Java types generated from them. These topics try to describe the rules by which the generated API is generated. Again, you could also get Javadoc for your generated types.

 

These and other documentation topics are available from the documentation page at the XMLBeans web site: http://xmlbeans.apache.org/documentation/index.html. Perhaps all of these information sources could be better connected in the tutorial and getting started topic, which new users are likely to see early on.

 

Steve

 

 


From: Johnny Tolliver [mailto:[EMAIL PROTECTED]
Sent: Friday, September 23, 2005 6:48 PM
To: [email protected]
Subject: javadoc for generated types

 

I have a really simple question, but first I'm just starting with XMLBeans. I got the 2.0.0 version. It appears that the tutorial was written or the 1.x branch since some things, like the location of the easypo.xsd sample schema, aren't quite where the tutorial says they are. Then, following the tutorial, and cutting and pasting the code so I'm sure it's correct, when I try to compile the POUpdate.java file, I get the following error:

 

file javax\xml\stream\XMLStreamReader.class not found
            poDoc = PurchaseOrderDocument.Factory.parse (purchaseOrder);

                                                                          ^

What does that mean?

 

In a normal Java code development environment, I would look up the javadoc for PurchaseOrderDocument.Factory.parse(). But where is that javadoc? The classes are in the generated easypo.jar file, but that's just compiled classes. Where is the source code that generated those classes?

 

I.e., HOW CAN I SEE JAVADOCS FOR THE GENERATED JAVA TYPES?

 

Looking through the XMLBeans documentation, it seems as though I'm just expected to just "know" what the Java types will be by examining the schema. Fine -- for the experienced user. But for the inexperienced, wouldn't it be so much easier to be able to look at the javadoc for the generated types?

 

This is such a simple concept, that I must be thinking about it all wrong. Will someone please help me understand why such a simple desire to see the javadocs is not so obvious that either I would find it easily or the FAQs or documentation or tutorial or *something* would address the issue?

 

Thanks!

Reply via email to