<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
<document>
    <header>
        <title>Sample Template</title>
    </header>
    <body>
        <section>
            <title>Description</title>
            <p>Available: 2004-09-15</p>
            <p>This sample template is the recommended way of writing a
              sample.  If you'd like to contribute, please do!
              Once you've written it, post a new
              <a href="http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10436">Jira</a>
              bug with component=Samples. For ideas, see
              <a
                href="ext:wiki/XmlBeansSampleSuggestions">XmlBeansSampleSuggestions</a>
              on the wiki.  Thanks for submitting!
            </p>
        </section>
        <section>
            <title>Files</title>
            <ul>
              <li><a href="SampleTemplate.zip">Zip of all files (SampleTemplate.zip)</a></li>
              <li><a href="SampleTemplate.tgz">Tar gzip of all files
                (SampleTemplate.tgz)</a></li>
              <li><a href="http://svn.apache.org/viewcvs.cgi/*checkout*/xmlbeans/trunk/samples/SampleTemplate/README.txt">Readme file</a></li>
            </ul>
        </section>
        <section>
          <title>Authoring Samples</title>


          <p>
            If you have an idea for a sample that you'd like to share with the
            community, we'd be happy to review and add it to the collection!
            Because we want all of the samples available from this site to be
            useful (and you probably do, too), we'd like you to follow the
            guidelines on this page when writing an XMLBeans sample.
          </p>
          <p>
            To contrubute the sample, please create a new Jira bug with
            component=Samples and attach the sample zip to the bug.
          </p>
          <note>
            All sample code accepted for use on the XMLBeans web site becomes
            the property of the Apache Software Foundation. In other words,
            thanks for donating a sample!
          </note>

          <section>
            <title>Sample scope</title>
            <p>
              Try to keep your sample reasonably small and well-defined. It's
              going to be more useful, and more easily found, if it's about
              something specific -- handling schema enums (or some other
              particular aspect of schema), handling validation errors,
              constructing mixed content with a cursor, and so on.  Large
              samples that do lots of things are often hard to get to know and
              learn something useful from. </p>
            <p>
              Your code will be most useful if it can be copied and pasted
              into someone else's app. However, schema dependencies will
              differ greatly from user to user, so samples that use generated
              types will tend to be fairly specific. Moreover, code that
              effectively demonstrates how a particular aspect of XMLBeans
              works is a good teacher, even if would take quite a bit of
              massaging to coerce it to another application.
            </p>
          </section>

          <section>
            <title>Code comments</title>
            <p>
              Obviously, comments are an essential part of making a sample
              useful. In general, the more comments your code has, the better.
              But here are a few guidelines that we ask you to keep in mind:
            </p>
            <ul>
              <li>
                Each sample file (including non-Java files) must include the
                Apache copyright notice. If it's not there when it's accepted,
                we'll add it.
              </li>
              <li>
                Each class and method should include a comment in the Javadoc
                style. It's not necessary to include specific Javadoc
                annotations (@param, @return, and so on), but your sample
                isn't as useful to others unless it's commented well.
              </li>
              <li>
                Class-level comments should describe what the class
                demonstrates. In particular, the comments should be sure to
                describe the XMLBeans technologies that the class includes.
                Other description text should describe what the sample's user
                should expect to see when they run the sample.
              </li>
              <li>
                Method-level comments should describe what the method does.
                Comments should focus on the role of XMLBeans technologies.
              </li>
              <li>
                Where useful, add more comments!
              </li>
            </ul>
          </section>

          <section>
            <title>Code conventions</title>
            <p>
              To help make XMLBeans samples as a set easier for others to use,
              we encourage you to follow a few simple code conventions. In
              this way, users can spend less time deciphering code and more
              time getting the things it demonstrates. Most of these are
              common practice anyway.
            </p>
            <ul>
              <li>Package name words should all be lower-case.</li>
              <li>
                Package names should begin with 'org.apache.xmlbeans.samples'
                and end with the sample's name, and should
                indicate what the sample illustrates. Examples are
                'org.apache.xmlbeans.samples.anytype.*' or '
                'org.apache.xmlbeans.samples.dynamiccompilation.*'
              </li>
            </ul>
          </section>
        </section>
    </body>
</document>
