You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by ce...@apache.org on 2004/11/11 22:52:12 UTC
cvs commit: xml-xmlbeans/website/src/documentation/content/xdocs/documentation tutorial_getstarted.xml
cezar 2004/11/11 13:52:12
Modified: website/src/documentation/content/xdocs site.xml
website/src/documentation/content/xdocs/documentation
tutorial_getstarted.xml
Log:
Partial fixes to XMLBEANS-85 on Jira (http://nagoya.apache.org/jira/browse/XMLBEANS-85). Here are the issues and fixes:
- missing import statements in source code -- fixed.
- generated code won't compile because easypo.xsdconfig is present -- not an issue for the tutorial. This would be an issue if the tutorial asked users to scomp the entire contents of the schemas/easypo directory; instead, the tutorial does (and did) tell users to compile easypo.xsd within that folder -- ignoring the xsdconfig.
- release readme tells users to set XMLBEANS_HOME to the release lib folder -- not an issue for the tutorial. I agree that this is a readme problem. I added a line to the tutorial that users should use the environment described in the installation topic.
- compile statement is bad. And indeed it was a copy/paste mess. I fixed it, and also made the command more Windows-specific (percents, semicolons, backslashes), in keeping with the rest of the tutorial.
This mail includes a couple of other opportunistic fixes to the site.
- "V1 Javadoc" was appearing twice on the home page. I fixed this in the site.xml.
Contributed by: Steve Traut
Revision Changes Path
1.17 +0 -1 xml-xmlbeans/website/src/documentation/content/xdocs/site.xml
Index: site.xml
===================================================================
RCS file: /home/cvs/xml-xmlbeans/website/src/documentation/content/xdocs/site.xml,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- site.xml 29 Oct 2004 01:33:33 -0000 1.16
+++ site.xml 11 Nov 2004 21:52:12 -0000 1.17
@@ -79,7 +79,6 @@
<userdoc label="Tutorial: First Steps"
href="documentation/tutorial_getstarted.html" description="Write some XMLBeans code."/>
<userdoc label="V1 Javadoc" href="docs/reference/index.html" description="Look over references."/>
- <userdoc label="V1 Javadoc" href="docs/reference/index.html" description="Look over references."/>
<userdoc label="V2 Javadoc" href="docs/v2/reference/index.html" description="Look over references."/>
<sample label="Samples" href="samples/index.html" description="See a list of samples for download."/>
<explanation label="An Explanation"
1.3 +23 -9 xml-xmlbeans/website/src/documentation/content/xdocs/documentation/tutorial_getstarted.xml
Index: tutorial_getstarted.xml
===================================================================
RCS file: /home/cvs/xml-xmlbeans/website/src/documentation/content/xdocs/documentation/tutorial_getstarted.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- tutorial_getstarted.xml 29 Oct 2004 18:02:40 -0000 1.2
+++ tutorial_getstarted.xml 11 Nov 2004 21:52:12 -0000 1.3
@@ -8,8 +8,8 @@
<section>
<title/>
<p>This tutorial introduces XMLBeans basics. Through it, you'll get a hands on view of
- the three technologies that make up version 1 of XMLBeans: strongly-typed access to
- XML through compiled schema, type-agnostic access to XML through the XML cursor.
+ two of the three technologies that make up version 1 of XMLBeans: strongly-typed access to
+ XML through compiled schema and type-agnostic access to XML through the XML cursor.
This tutorial describes what XMLBeans is and introduces a few of the tools that come
with an XMLBeans installation.</p>
<p>To get started, you'll need the following:</p>
@@ -17,6 +17,7 @@
<li>JDK 1.4 for version 1 XMLBeans releases. You can download the JDK <jump href="http://java.sun.com/j2se/1.4.2/download.html">here</jump>.</li>
<li>An XMLBeans version 1 installation. If you don't have this yet, you'll find
installation instructions at <link href="conInstallGuide.html">Installing XMLBeans</link>.</li>
+ <li>An environment set up according to what's described in <link href="conInstallGuide.html">Installing XMLBeans</link>.</li>
<li>An editor for writing Java code. This could be a text editor or your favorite
Java IDE.</li>
</ul>
@@ -118,7 +119,7 @@
element that has four immediate children: <code><customer></code>,
<code><date></code>, <code><line-item></code>, and <code><shipper></code> —
in that sequence.</li>
- <li>Each of the four child elements has its own children in a particular structure,
+ <li>Three of the four child elements have their own children in a particular structure,
as defined in the schema's respective <code><complexType></code> elements.</li>
</ul>
<p>Now take a look at an XML document based on this schema. Copy the following XML from
@@ -308,7 +309,12 @@
<p>Start out by creating a POUpdater.java file in the
<code>tutorials\gettingstarted\src</code> directory. Add the following code to
that file:</p>
- <source>public class POUpdater
+ <source>import java.io.*;
+import java.math.*;
+import org.apache.xmlbeans.*;
+import org.apache.easypo.*;
+
+public class POUpdater
{
private static String addLineItem(File purchaseOrder, String itemDescription,
String perUnitOuncesString,
@@ -362,7 +368,12 @@
the schema. </p>
<p>Here's a full version of the <code>POUpdater</code> class, with the
<code>addLineItem</code> method accessible via a <code>main</code> method.</p>
- <source>public class POUpdater
+ <source>import java.io.*;
+import java.math.*;
+import org.apache.xmlbeans.*;
+import org.apache.easypo.*;
+
+public class POUpdater
{
public static void main(String[] args)
{
@@ -406,12 +417,12 @@
}</source>
<p>Now, compile the new class with a command such as the following (the line is
broken for readability):</p>
- <source>javac -classpath $XMLBEANS_HOME/lib/xbean.jar:tutorials/gettingstarted/lib/easypo.jar
- POUpdater instances/easypo/easypo.xml "a new item" 5.0 20.00 6</source>
+ <source>javac -classpath %XMLBEANS_HOME%\lib\xbean.jar;tutorials\gettingstarted\lib\easypo.jar
+ -d tutorials\gettingstarted\classes tutorials\gettingstarted\src\POUpdater.java</source>
<p>After you compile, you can try out the class with the following command (again,
broken for readability):</p>
- <source>java -cp tutorials/gettingstarted/classes:$XMLBEANS_HOME/lib/xbean.jar:tutorials/gettingstarted/lib/easypo.jar
- POUpdater tutorials/gettingstarted/instances/easypo.xml "a new item" 5.0 20.00 6</source>
+ <source>java -cp tutorials\gettingstarted\classes;%XMLBEANS_HOME%\lib\xbean.jar;tutorials\gettingstarted\lib\easypo.jar
+ POUpdater tutorials\gettingstarted\instances\easypo.xml "a new item" 5.0 20.00 6</source>
<p>The output should look like the instance output above, but with the following
added as the last <code><line-item></code> element, immediately
before the <code><shipper></code> element. </p>
@@ -638,6 +649,9 @@
args[3], args[4]);
System.out.println(updatedPoXml);
} </source>
+ <p>Finally, before compiling, you'll need to add two more import statements to support the alphabetization code:</p>
+ <source>import java.text.*;
+import java.util.*;</source>
<p>Test the <code>POUpdater</code> class just as you did before. This time, you
should see the new <code><line-item></code> element added as the
first in the set, rather than at the end.</p>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org