You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by di...@apache.org on 2003/09/23 21:28:02 UTC

cvs commit: ws-site/targets/jaxme/xs generic.html index.html logical.html syntax.html generic.pdf index.pdf logical.pdf syntax.pdf

dims        2003/09/23 12:28:02

  Added:       targets/jaxme/xs generic.html index.html logical.html
                        syntax.html generic.pdf index.pdf logical.pdf
                        syntax.pdf
  Log:
  jaxme website
  
  Revision  Changes    Path
  1.1                  ws-site/targets/jaxme/xs/generic.html
  
  Index: generic.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  <html>
  <head>
  <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>The generic parser</title>
  <link type="text/css" href="../skin/page.css" rel="stylesheet">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
  <!--================= start Navigation Path ==================-->
  <table summary="navigation path" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td nowrap="nowrap" valign="middle" bgcolor="#CFDCED" height="20"><img height="1" width="5" alt="" src="../skin/images/spacer.gif" class="spacer"><!--===== breadcrumb trail (javascript-generated) ====--><font size="2" face="Arial, Helvetica, Sans-serif"><script src="../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script></font></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" height="2"><img height="2" width="2" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Navigation Path ==================-->
  <!--================= start Banner ==================-->
  <table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <!--================= start Group Logo ==================-->
  <td bgcolor="#294563"><a href="http://ws.apache.org/JaxMe/"><img border="0" class="logoImage" alt="JaxMe 2" src="../images/group-logo.gif"></a></td>
  <!--================= end Group Logo ==================-->
  <!--================= start Project Logo ==================--><td width="100%" align="center" bgcolor="#294563"><a href="http://ws.apache.org/JaxMe/">JaxMe 2</a></td>
  <!--================= end Project Logo ==================-->
  <!--================= start Search ==================--><td valign="top" rowspan="2" bgcolor="#294563">
  <form target="_blank" action="http://www.google.com/search" method="get">
  <table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
  <tr>
  <td colspan="3"><img height="10" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img height="1" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap"><input value="ws.apache.org/JaxMe/" name="sitesearch" type="hidden"><input size="15" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../skin/images/spacer.gif" class="spacer"><input name="Search" value="Search" type="submit">
  <br>
  <font face="Arial, Helvetica, Sans-serif" size="2" color="white">
                        the JaxMe 2 site
                        
                        
                      </font></td><td><img height="1" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img alt="" border="0" height="10" width="9" src="../skin/images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td><img alt="" border="0" height="10" width="9" src="../skin/images/search-right.gif"></td>
  </tr>
  </table>
  </form>
  </td>
  <!--================= start Search ==================--><td bgcolor="#294563"><img height="10" width="10" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" bgcolor="#294563" colspan="2">
  <!--================= start Tabs ==================-->
  <div class="tab">
  <table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td width="6"><img alt="" height="8" width="6" src="../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="non selected tab" style="height: 1.6em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-left.gif"></td><td valign="middle" bgcolor="#B2C4E0"><a class="base-not-selected" href="../index.html">JaxMe 2</a></td><td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-right.gif"></td>
  </tr>
  <tr>
  <td colspan="3" height="1"></td>
  </tr>
  </table>
  </td><td width="6"><img alt="" height="8" width="6" src="../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="non selected tab" style="height: 1.6em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-left.gif"></td><td valign="middle" bgcolor="#B2C4E0"><a class="base-not-selected" href="../api/index.html">JAXB API</a></td><td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-right.gif"></td>
  </tr>
  <tr>
  <td colspan="3" height="1"></td>
  </tr>
  </table>
  </td><td width="6"><img alt="" height="8" width="6" src="../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="non selected tab" style="height: 1.6em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-left.gif"></td><td valign="middle" bgcolor="#B2C4E0"><a class="base-not-selected" href="../js/index.html">JaxMeJS</a></td><td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-right.gif"></td>
  </tr>
  <tr>
  <td colspan="3" height="1"></td>
  </tr>
  </table>
  </td><td width="6"><img alt="" height="8" width="6" src="../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="selected tab" style="height: 1.8em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../skin/images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b><a class="base-selected" href="../xs/index.html">JaxMeXS</a></b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../skin/images/tabSel-right.gif"></td>
  </tr>
  </table>
  </td>
  </tr>
  </table>
  </div>
  <!--================= end Tabs ==================-->
  </td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Banner ==================-->
  <!--================= start Menu, NavBar, Content ==================-->
  <table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top">
  <table summary="menu" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <!--================= start left top NavBar ==================-->
  <td rowspan="3" valign="top">
  <table summary="blue line" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif">&nbsp;</font></td>
  </tr>
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td>
  <!--================= end left top NavBar ==================--><td bgcolor="#294563"><img width="1" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F">
  <!--================= start Menu items ==================-->
  <div class="menu">
  <ul>
  <li>
  <font color="#CFDCED">JaxMeXS</font>
  <ul>
  	
  <li>
  <a href="index.html">Introduction</a>
  </li>
      
  <li>
  <span class="sel"><font color="#ffcc00">Generic XML Parser</font></span>
  </li>
      
  <li>
  <a href="syntax.html">Syntax Parser</a>
  </li>
      
  <li>
  <a href="logical.html">Logical Parser</a>
  </li>
    
  </ul>
  </li>
  </ul>
  </div>
  <!--================= end Menu items ==================-->
  </td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../skin/images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../skin/images/menu-right.gif"></td>
  </tr>
  <tr>
  <td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td><td valign="top" width="100%">
  <table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0">
  <!--================= start middle NavBar ==================-->
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end middle NavBar ==================-->
  <!--================= start Content==================-->
  <tr>
  <td align="left" width="10"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td align="left" width="100%">
  <div xmlns:xhtml="http://www.w3.org/1999/xhtml" class="content">
  <table class="title" summary="">
  <tr>
  <td valign="middle">
  <h1>The generic parser</h1>
  </td><td nowrap="nowrap" width="40" align="center"><a class="dida" href="generic.pdf"><img alt="PDF" src="../skin/images/pdfdoc.gif" class="skin"><br>
            PDF</a></td>
  </tr>
  </table>
  <ul class="minitoc">
  <li>
  <a href="#The+generic+parser">The generic parser</a>
  </li>
  <li>
  <a href="#The+AttributeSetter+interface">The AttributeSetter interface</a>
  </li>
  <li>
  <a href="#The+TextSetter+interface">The TextSetter interface</a>
  </li>
  <li>
  <a href="#Handling+child+elements">Handling child elements</a>
  </li>
  </ul>
      
  <a name="N1000A"></a><a name="The+generic+parser"></a>
  <h3>The generic parser</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>The most basic part of JaxMeXS is its generic parser. This part is suited
          for arbitrary XML document types, for example configuration files and the
          like. The actual XML Schema parsers (the
          <a href="syntax.html">syntax parser</a> and the
          <a href="logical.html">logical parser</a>) are sitting on top of
          the generic parser. If you aren't interested in the generic part, you may
          safely skip to the <a href="syntax.html">next section</a>, which is basically
          self contained. However, some details are best described here.</p>
  <p>The generic parser follows an idea from the
          <a href="http://ant.apache.org/">Ant</a> project: A SAX parser is responsible for the
          configuration of a bean. Any XML element is mapped to a Java bean. The XML
          elements attributes are mapped to properties of the bean and the child
          elements are mapped to other beans, which are part of the parent bean. If
          you know <a href="http://ant.apache.org/manual/develop.html#writingowntask">how to write an Ant task</a>,
          you know how the generic parser works.</p>
  <p>The generic parser is specified by the interface
          <a href="../apidocs/org/apache/ws/jaxme/xs/parser/XsSAXParser.html">XsSAXParser</a> and
          implemented by the class
          <a href="../apidocs/org/apache/ws/jaxme/xs/parser/XsSAXParserImpl.html">XsSAXParserImpl</a>.
          There's few things to know about that. The most important parts are some other
          interfaces and classes which you might like to implement or extend:</p>
  <ol>
          
  <li>The <a href="#AttributeSetter">AttributeSetter</a>
            interface is responsible for mapping XML attributes to bean properties.</li>
          
  <li>The <a href="#TextSetter">TextSetter</a> handles character data contained
            in elements.</li>
          
  <li>And, finally, the <a href="#ChildSetter">ChildSetter</a> creates new beans
            for any child element.</li>
        
  </ol>
  </div>
  
      
  <a name="AttributeSetter"></a>
      <a name="N10050"></a><a name="The+AttributeSetter+interface"></a>
  <h3>The AttributeSetter interface</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>The <a href="../apidocs/org/apache/ws/jaxme/xs/parser/AttributeSetter.html">AttributeSetter</a>
          interface consists of a single method:</p>
  <pre class="code">
    public void setAttribute(String pQName, String pNamespaceURI,
                             String pLocalName, String pValue) throws SAXException;
        </pre>
  <p>This method is invoked for any attribute that the SAX parser finds.</p>
  <p>The AttributeSetters main idea is as follows: Suggest, that the attributes local
          name is <span class="codefrag">foo</span>. A method <span class="codefrag">setFoo(SomeClass pValue)</span> is searched.
          f such a method is found, the attribute value is converted into an instance of
          <span class="codefrag">SomeClass</span> and the method is invoked. More formally, the default
          implementation <a href="../apidocs/org/apache/ws/jaxme/xs/parser/impl/AttributeSetterImpl.html">
          AttributeSetterImpl</a> behaves as follows:</p>
  <ol>
          
  <li>If the bean has a method <span class="codefrag">setAttribute(String, String, String, String)</span>,
            it is invoked with the same arguments <span class="codefrag">pQName</span>, <span class="codefrag">pNamespaceURI</span>,
            <span class="codefrag">pLocalName</span>, <span class="codefrag">pValue</span>. If this method does not have
            the result types <span class="codefrag">boolean</span> or <span class="codefrag">Boolean</span>, or if the result
            is <span class="codefrag">true</span>, then the <span class="codefrag">AttributeSetterImpl</span> assumes that the
            property is set.</li>
          
  <li>If the property is not set, and the bean has a method
            <span class="codefrag">setProperty(String)</span>, then this method is invoked
            with the attribute value.</li>
          
  <li>Otherwise, if the bean has a method <span class="codefrag">setProperty(T)</span>, and
            the class <span class="codefrag">T</span> has either of a method
            <span class="codefrag">public static T valueOf(String)</span> or a constructor
            <span class="codefrag">public T(String)</span> (in that order), then the method
            <span class="codefrag">setProperty(T)</span> is invoked with the value obtained
            by an invocation of the method <span class="codefrag">valueOf()</span>, or
            the constructor, respectively. Note, that this applies in
            particular to the classes Long, Integer, Short, Byte, Double,
            Float, java.math.BigInteger, java.math.BigDecimal,
            java.io.File, and StringBuffer.</li>
          
  <li>If the bean has a method <span class="codefrag">setProperty(boolean)</span>,
            the method will be invoked with the value <span class="codefrag">true</span>
            (the value specified in the XML file is either of
            <span class="codefrag">true</span>, or <span class="codefrag">1</span>) or <span class="codefrag">false</span>
            (the attribute has any other value).</li>
         
  <li>If the bean has a method <span class="codefrag">setProperty(char)</span>,
           or <span class="codefrag">setProperty(Character)</span>, the method will be
           invoked with the first character of the value specified in
           the XML file. If the value contains zero or multiple characters,
           an IllegalArgumentException is thrown.</li>
         
  <li>If the bean has either of the following methods, in that order:
           <ul>
             
  <li>
  <span class="codefrag">setProperty(long)</span>
  </li>
             
  <li>
  <span class="codefrag">setProperty(int)</span>
  </li>
             
  <li>
  <span class="codefrag">setProperty(short)</span>
  </li>
             
  <li>
  <span class="codefrag">setProperty(byte)</span>
  </li>
             
  <li>
  <span class="codefrag">setProperty(double)</span>
  </li>
             
  <li>
  <span class="codefrag">setProperty(float)</span>
  </li>
           
  </ul>
           then the attribute value is converted into the respective type
           and the method is invoked. An IllegalArgumentException
           is thrown, if the conversion fails.</li>
         
  <li>If the bean has a method <span class="codefrag">java.lang.Class</span>, the
           <span class="codefrag">XsSAXParser</span> will interpret the value given in the
           XML file as a Java class name and load the named class from its
           class loader. If the class cannot be loaded, it will also try
           to use the current threads context class loader. An
           exception is thrown, if neither of the class loaders can
           load the class.</li>
        
  </ol>
  </div>
  
      
  <a name="TextSetter"></a>
      <a name="N100F6"></a><a name="The+TextSetter+interface"></a>
  <h3>The TextSetter interface</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>The <a href="../apidocs/org/apache/ws/jaxme/xs/parser/TextSetter.html">TextSetter</a>
          interface is invoked from within the SAX ContentHandlers method
          <span class="codefrag">characters(char[] pBuffer, int pOffset, int pLen)</span>.
          It's task is to fill the bean with character data. Note, that the latter
          method may very well be called multiple times, even for a single
          character sequence in the XML file. For example, if the XML reader
          loads the XML file in blocks of 1024 characters and a block stops
          right within an elements character data, then it is valid behaviour
          to call the <span class="codefrag">character(char[], int, int)</span> method twice:
          Once for the first part, which sits at the end of the 1024 characters
          and once for the remaining part. The same holds for the <span class="codefrag">addText()</span>
          method:</p>
  <pre class="code">
    public void addText(String pValue) throws SAXException;
        </pre>
  <p>The default implementation is
          <a href="../apidocs/org/apache/ws/jaxme/xs/parser/impl/TextSetterImpl.html">
            TextSetterImpl</a>, which behaves as follows:</p>
  <ol>
          
  <li>If the bean has a method with the same signature
            <span class="codefrag">public void addText(String)</span>, then the method is invoked.</li>
          
  <li>If the bean doesn't have such a method and the supplied text is
            all whitespace, then the text is ignored. Otherwise an exception
            is thrown.</li>
        
  </ol>
  </div>
  
      
  <a name="ChildSetter"></a>
      <a name="N10127"></a><a name="Handling+child+elements"></a>
  <h3>Handling child elements</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>Embedded child elements are handled by the interface
          <a href="../apidocs/org/apache/ws/jaxme/xs/parser/ChildSetter.html">ChildSetter</a> and
          its default implementation
          <a href="../apidocs/org/apache/ws/jaxme/xs/parser/impl/ChildSetterImpl.html">ChildSetterImpl</a>.
          The interface exposes a single method:</p>
  <pre class="code">
    public ContentHandler getChildHandler(String pQName, String pNamespaceURI,
                                          String pLocalName) throws SAXException;
          </pre>
  <p>The purpose of the method is to create a SAX handler for this element.
          If such a handler is returned, then it receives the SAX events generated
          for the element. The default implementation works as follows:</p>
  <ol>
          
  <li>If the bean has a method with the same signature
            <span class="codefrag">public ContentHandler getChildHandler(String, String, String, String)</span>,
            then this method is invoked. A non-null result will be used as a ContentHandler
            for the child element.</li>
          
  <li>If the bean doesn't have such a method or if the method returned null,
            and the local name is <span class="codefrag">foo</span>, then a method
            <span class="codefrag">public T createFoo()</span> is searched, with an arbitrary result type T.
            If there is such a method it is invoked and a new instance of
            <a href="../apidocs/org/apache/ws/jaxme/xs/parser/impl/XsSAXParserImpl.html">XsSAXParserImpl</a>
            is created to configure the bean.</li>
          
  <li>An exception is thrown otherwise.</li>
        
  </ol>
  </div>
    
  <div class="attribution"></div>
  </div>
  </td><td width="10"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end Content==================-->
  </table>
  </td>
  </tr>
  </table>
  <!--================= end Menu, NavBar, Content ==================-->
  <!--================= start Footer ==================-->
  <table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0">
  <tr>
  <td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"><a href="../skin/images/label.gif"></a><a href="../skin/images/page.gif"></a><a href="../skin/images/chapter.gif"></a><a href="../skin/images/chapter_open.gif"></a><a href="../skin/images/current.gif"></a><a href="/favicon.ico"></a></td>
  </tr>
  <tr>
  <td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright &copy;
            2003&nbsp;Apache Software Foundation All rights reserved.<script type="text/javascript" language="JavaScript"><!--
                document.write(" - "+"Last Published: " + document.lastModified);
              //  --></script></font></td>
  </tr>
  <tr>
  <td colspan="2" align="left" bgcolor="#CFDCED" class="logos"></td>
  </tr>
  </table>
  <!--================= end Footer ==================-->
  </body>
  </html>
  
  
  
  1.1                  ws-site/targets/jaxme/xs/index.html
  
  Index: index.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  <html>
  <head>
  <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>The JaxMe paparser for XML Schema</title>
  <link type="text/css" href="../skin/page.css" rel="stylesheet">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
  <!--================= start Navigation Path ==================-->
  <table summary="navigation path" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td nowrap="nowrap" valign="middle" bgcolor="#CFDCED" height="20"><img height="1" width="5" alt="" src="../skin/images/spacer.gif" class="spacer"><!--===== breadcrumb trail (javascript-generated) ====--><font size="2" face="Arial, Helvetica, Sans-serif"><script src="../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script></font></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" height="2"><img height="2" width="2" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Navigation Path ==================-->
  <!--================= start Banner ==================-->
  <table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <!--================= start Group Logo ==================-->
  <td bgcolor="#294563"><a href="http://ws.apache.org/JaxMe/"><img border="0" class="logoImage" alt="JaxMe 2" src="../images/group-logo.gif"></a></td>
  <!--================= end Group Logo ==================-->
  <!--================= start Project Logo ==================--><td width="100%" align="center" bgcolor="#294563"><a href="http://ws.apache.org/JaxMe/">JaxMe 2</a></td>
  <!--================= end Project Logo ==================-->
  <!--================= start Search ==================--><td valign="top" rowspan="2" bgcolor="#294563">
  <form target="_blank" action="http://www.google.com/search" method="get">
  <table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
  <tr>
  <td colspan="3"><img height="10" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img height="1" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap"><input value="ws.apache.org/JaxMe/" name="sitesearch" type="hidden"><input size="15" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../skin/images/spacer.gif" class="spacer"><input name="Search" value="Search" type="submit">
  <br>
  <font face="Arial, Helvetica, Sans-serif" size="2" color="white">
                        the JaxMe 2 site
                        
                        
                      </font></td><td><img height="1" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img alt="" border="0" height="10" width="9" src="../skin/images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td><img alt="" border="0" height="10" width="9" src="../skin/images/search-right.gif"></td>
  </tr>
  </table>
  </form>
  </td>
  <!--================= start Search ==================--><td bgcolor="#294563"><img height="10" width="10" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" bgcolor="#294563" colspan="2">
  <!--================= start Tabs ==================-->
  <div class="tab">
  <table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td width="6"><img alt="" height="8" width="6" src="../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="non selected tab" style="height: 1.6em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-left.gif"></td><td valign="middle" bgcolor="#B2C4E0"><a class="base-not-selected" href="../index.html">JaxMe 2</a></td><td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-right.gif"></td>
  </tr>
  <tr>
  <td colspan="3" height="1"></td>
  </tr>
  </table>
  </td><td width="6"><img alt="" height="8" width="6" src="../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="non selected tab" style="height: 1.6em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-left.gif"></td><td valign="middle" bgcolor="#B2C4E0"><a class="base-not-selected" href="../api/index.html">JAXB API</a></td><td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-right.gif"></td>
  </tr>
  <tr>
  <td colspan="3" height="1"></td>
  </tr>
  </table>
  </td><td width="6"><img alt="" height="8" width="6" src="../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="non selected tab" style="height: 1.6em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-left.gif"></td><td valign="middle" bgcolor="#B2C4E0"><a class="base-not-selected" href="../js/index.html">JaxMeJS</a></td><td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-right.gif"></td>
  </tr>
  <tr>
  <td colspan="3" height="1"></td>
  </tr>
  </table>
  </td><td width="6"><img alt="" height="8" width="6" src="../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="selected tab" style="height: 1.8em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../skin/images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b><a class="base-selected" href="../xs/index.html">JaxMeXS</a></b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../skin/images/tabSel-right.gif"></td>
  </tr>
  </table>
  </td>
  </tr>
  </table>
  </div>
  <!--================= end Tabs ==================-->
  </td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Banner ==================-->
  <!--================= start Menu, NavBar, Content ==================-->
  <table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top">
  <table summary="menu" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <!--================= start left top NavBar ==================-->
  <td rowspan="3" valign="top">
  <table summary="blue line" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif">&nbsp;</font></td>
  </tr>
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td>
  <!--================= end left top NavBar ==================--><td bgcolor="#294563"><img width="1" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F">
  <!--================= start Menu items ==================-->
  <div class="menu">
  <ul>
  <li>
  <font color="#CFDCED">JaxMeXS</font>
  <ul>
  <li>
  <span class="sel"><font color="#ffcc00">Introduction</font></span>
  </li>
  <li>
  <a href="generic.html">Generic XML Parser</a>
  </li>
  <li>
  <a href="syntax.html">Syntax Parser</a>
  </li>
  <li>
  <a href="logical.html">Logical Parser</a>
  </li>
  </ul>
  </li>
  </ul>
  </div>
  <!--================= end Menu items ==================-->
  </td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../skin/images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../skin/images/menu-right.gif"></td>
  </tr>
  <tr>
  <td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td><td valign="top" width="100%">
  <table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0">
  <!--================= start middle NavBar ==================-->
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end middle NavBar ==================-->
  <!--================= start Content==================-->
  <tr>
  <td align="left" width="10"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td align="left" width="100%">
  <div xmlns:xhtml="http://www.w3.org/1999/xhtml" class="content">
  <table class="title" summary="">
  <tr>
  <td valign="middle">
  <h1>The JaxMe paparser for XML Schema</h1>
  </td><td nowrap="nowrap" width="40" align="center"><a class="dida" href="index.pdf"><img alt="PDF" src="../skin/images/pdfdoc.gif" class="skin"><br>
            PDF</a></td>
  </tr>
  </table>
  <ul class="minitoc">
  <li>
  <a href="#The+JaxMe+parser+for+XML+Schema">The JaxMe parser for XML Schema</a>
  </li>
  </ul>
      
  <a name="N1000A"></a><a name="The+JaxMe+parser+for+XML+Schema"></a>
  <h3>The JaxMe parser for XML Schema</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>This is JaxMeXS, a parser for XML schema. Yet another one, to be precise. As there
          are a lot of other parsers around, the question arises: What makes it different?
          What advantages does it have?</p>
  <p>Let's begin with a disadvantage: This one is not a strict parser. In other words,
          it was not written to detect any possible invalid schema. Strictness is a secondary
          goal.</p>
  <p>The main purpose of JaxMeXS is being extensible. It is written with XML languages
          in mind, that extend XML schema. The best example is <a href="http://java.sun.com/xml/jaxb/">JAXB</a>,
          the XML binding specification for Java. It extends XML schema by adding some more tags,
          for example like this:</p>
  <pre class="code">
    &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://ws.apache.org/jaxme/examples/misc/jaxb"
        xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"&gt;
      &lt;xs:annotation&gt;
        &lt;xs:appinfo&gt;
          &lt;jaxb:schemaBindings&gt;
            &lt;jaxb:package name="com.mycompany.xml"/&gt;
          &lt;/jaxb:schemaBindings&gt;
        &lt;/xs:appinfo&gt;
      &lt;/xs:annotation&gt;
      ...
        </pre>
  <p>JAXB is a Java source generator, which converts an XML schema into Java classes.
          These Java classes have the ability to read an XML document conforming to the
          original schema and return its information. As usual for Java classes, they
          have to be located in some package, <span class="codefrag">com.mycompany.xml</span> in our case.
          The above example demonstrates how JAXB uses an additional tag
          <span class="codefrag">jaxb:package</span> to specify it.</p>
  <p>This is exactly where JaxMeXS fits in. Quite unsurprising, because it was
          written as the XML schema parser for <a href="http://ws.apache.org/jaxme/">JaxMe</a>,
          which aims to be a JAXB implementation and extends the JAXB language by even
          more tags. The main idea of JaxMeXS is:</p>
  <ul>
          
  <li>Write a parser for XML schema.</li>
          
  <li>Extend the parser with the JAXB tags. This is simple: Any additional
            element is implemented by a standard Java bean. The attributes are
            mapped to properties and the property setters are called almost automagically.</li>
          
  <li>Extend the JAXB parser with the JaxMe tags by adding more beans.</li>
        
  </ul>
  </div>
    
  <div class="attribution"></div>
  </div>
  </td><td width="10"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end Content==================-->
  </table>
  </td>
  </tr>
  </table>
  <!--================= end Menu, NavBar, Content ==================-->
  <!--================= start Footer ==================-->
  <table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0">
  <tr>
  <td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"><a href="../skin/images/label.gif"></a><a href="../skin/images/page.gif"></a><a href="../skin/images/chapter.gif"></a><a href="../skin/images/chapter_open.gif"></a><a href="../skin/images/current.gif"></a><a href="/favicon.ico"></a></td>
  </tr>
  <tr>
  <td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright &copy;
            2003&nbsp;Apache Software Foundation All rights reserved.<script type="text/javascript" language="JavaScript"><!--
                document.write(" - "+"Last Published: " + document.lastModified);
              //  --></script></font></td>
  </tr>
  <tr>
  <td colspan="2" align="left" bgcolor="#CFDCED" class="logos">
  <div>
  <a href="http://validator.w3.org/check/referer"><img width="88" height="31" alt="Valid HTML 4.01!" src="../skin/images/valid-html401.png" class="logoImage"></a><a href="http://jigsaw.w3.org/css-validator/"><img width="88" height="31" alt="Valid CSS!" src="../skin/images/vcss.png" class="logoImage"></a><img alt="" height="1" width="10" src="../skin/images/spacer.gif"><a href="http://xml.apache.org/forrest/"><img border="0" alt="Built with Apache Forrest logo" src="../images/built-with-forrest-button.png" width="88" height="31"><img height="1" width="5" alt="" src="../skin/images/spacer.gif" class="spacer"></a>
  </div>
  </td>
  </tr>
  </table>
  <!--================= end Footer ==================-->
  </body>
  </html>
  
  
  
  1.1                  ws-site/targets/jaxme/xs/logical.html
  
  Index: logical.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  <html>
  <head>
  <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>The logical parser</title>
  <link type="text/css" href="../skin/page.css" rel="stylesheet">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
  <!--================= start Navigation Path ==================-->
  <table summary="navigation path" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td nowrap="nowrap" valign="middle" bgcolor="#CFDCED" height="20"><img height="1" width="5" alt="" src="../skin/images/spacer.gif" class="spacer"><!--===== breadcrumb trail (javascript-generated) ====--><font size="2" face="Arial, Helvetica, Sans-serif"><script src="../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script></font></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" height="2"><img height="2" width="2" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Navigation Path ==================-->
  <!--================= start Banner ==================-->
  <table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <!--================= start Group Logo ==================-->
  <td bgcolor="#294563"><a href="http://ws.apache.org/JaxMe/"><img border="0" class="logoImage" alt="JaxMe 2" src="../images/group-logo.gif"></a></td>
  <!--================= end Group Logo ==================-->
  <!--================= start Project Logo ==================--><td width="100%" align="center" bgcolor="#294563"><a href="http://ws.apache.org/JaxMe/">JaxMe 2</a></td>
  <!--================= end Project Logo ==================-->
  <!--================= start Search ==================--><td valign="top" rowspan="2" bgcolor="#294563">
  <form target="_blank" action="http://www.google.com/search" method="get">
  <table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
  <tr>
  <td colspan="3"><img height="10" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img height="1" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap"><input value="ws.apache.org/JaxMe/" name="sitesearch" type="hidden"><input size="15" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../skin/images/spacer.gif" class="spacer"><input name="Search" value="Search" type="submit">
  <br>
  <font face="Arial, Helvetica, Sans-serif" size="2" color="white">
                        the JaxMe 2 site
                        
                        
                      </font></td><td><img height="1" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img alt="" border="0" height="10" width="9" src="../skin/images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td><img alt="" border="0" height="10" width="9" src="../skin/images/search-right.gif"></td>
  </tr>
  </table>
  </form>
  </td>
  <!--================= start Search ==================--><td bgcolor="#294563"><img height="10" width="10" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" bgcolor="#294563" colspan="2">
  <!--================= start Tabs ==================-->
  <div class="tab">
  <table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td width="6"><img alt="" height="8" width="6" src="../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="non selected tab" style="height: 1.6em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-left.gif"></td><td valign="middle" bgcolor="#B2C4E0"><a class="base-not-selected" href="../index.html">JaxMe 2</a></td><td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-right.gif"></td>
  </tr>
  <tr>
  <td colspan="3" height="1"></td>
  </tr>
  </table>
  </td><td width="6"><img alt="" height="8" width="6" src="../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="non selected tab" style="height: 1.6em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-left.gif"></td><td valign="middle" bgcolor="#B2C4E0"><a class="base-not-selected" href="../api/index.html">JAXB API</a></td><td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-right.gif"></td>
  </tr>
  <tr>
  <td colspan="3" height="1"></td>
  </tr>
  </table>
  </td><td width="6"><img alt="" height="8" width="6" src="../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="non selected tab" style="height: 1.6em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-left.gif"></td><td valign="middle" bgcolor="#B2C4E0"><a class="base-not-selected" href="../js/index.html">JaxMeJS</a></td><td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-right.gif"></td>
  </tr>
  <tr>
  <td colspan="3" height="1"></td>
  </tr>
  </table>
  </td><td width="6"><img alt="" height="8" width="6" src="../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="selected tab" style="height: 1.8em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../skin/images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b><a class="base-selected" href="../xs/index.html">JaxMeXS</a></b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../skin/images/tabSel-right.gif"></td>
  </tr>
  </table>
  </td>
  </tr>
  </table>
  </div>
  <!--================= end Tabs ==================-->
  </td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Banner ==================-->
  <!--================= start Menu, NavBar, Content ==================-->
  <table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top">
  <table summary="menu" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <!--================= start left top NavBar ==================-->
  <td rowspan="3" valign="top">
  <table summary="blue line" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif">&nbsp;</font></td>
  </tr>
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td>
  <!--================= end left top NavBar ==================--><td bgcolor="#294563"><img width="1" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F">
  <!--================= start Menu items ==================-->
  <div class="menu">
  <ul>
  <li>
  <font color="#CFDCED">JaxMeXS</font>
  <ul>
  	
  <li>
  <a href="index.html">Introduction</a>
  </li>
      
  <li>
  <a href="generic.html">Generic XML Parser</a>
  </li>
      
  <li>
  <a href="syntax.html">Syntax Parser</a>
  </li>
      
  <li>
  <span class="sel"><font color="#ffcc00">Logical Parser</font></span>
  </li>
    
  </ul>
  </li>
  </ul>
  </div>
  <!--================= end Menu items ==================-->
  </td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../skin/images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../skin/images/menu-right.gif"></td>
  </tr>
  <tr>
  <td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td><td valign="top" width="100%">
  <table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0">
  <!--================= start middle NavBar ==================-->
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end middle NavBar ==================-->
  <!--================= start Content==================-->
  <tr>
  <td align="left" width="10"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td align="left" width="100%">
  <div xmlns:xhtml="http://www.w3.org/1999/xhtml" class="content">
  <table class="title" summary="">
  <tr>
  <td valign="middle">
  <h1>The logical parser</h1>
  </td><td nowrap="nowrap" width="40" align="center"><a class="dida" href="logical.pdf"><img alt="PDF" src="../skin/images/pdfdoc.gif" class="skin"><br>
            PDF</a></td>
  </tr>
  </table>
  <ul class="minitoc">
  <li>
  <a href="#The+logical+parser">The logical parser</a>
  </li>
  <li>
  <a href="#Using+the+logical+parser">Using the logical parser</a>
  </li>
  <li>
  <a href="#Accessing+logical+context+information">Accessing logical context information</a>
  </li>
  </ul>
      
  <a name="N1000A"></a><a name="The+logical+parser"></a>
  <h3>The logical parser</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>As we have <a href="syntax.html">already said</a>, the JaxMe
          parser for XML Schema, is an application of multiple layers. There is a
          <a href="generic.html">generic parser</a>,
          which is mostly independent of a certain XML language. The second layer
          is the <a href="syntax.html">syntax parser</a>, which you typically
          do not want to use. Most probably you are mainly interested in the topmost
          layer: The logical parser.</p>
  <p>The logical parser presents the XML Schema in a way, which you will
          definitely like, because it is easy to use and frees you from the burden
          to understand XML Schema. It handles groups, restrictions, extensions,
          redefinitions and all that kind of stuff for you. Ideally you do not even
          notice, that they are in use.</p>
  <ul>
          
  <li>
  <a href="#use">Using</a> the logical parser</li>
          
  <li>Accessing locical <a href="#context">context information</a>
  </li>
        
  </ul>
  </div>
  
      
  <a name="N10031"></a><a name="Using+the+logical+parser"></a>
  <h3>Using the logical parser</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>The logical parser is used as follows:</p>
  <pre class="code">
      import java.io.FileInputStream;
      import org.apache.ws.jaxme.xs.XSParser;
      import org.apache.ws.jaxme.xs.XSSchema;
      import org.xml.sax.InputSource;
  
      XSParser xsp = new XSParser();
      InputSource isource = new InputSource(new FileInputStream("myschema.xsd"));
      isource.setSystemId(f.toURL().toString());
      XSSchema schema = xsp.parse(isource);  
  
      // Print the names of all global elements:
      XSElement[] elements = schema.getElements();
      for (int i = 0;  i &lt; elements.length;  i++) {
        System.out.println(elements[i].getName());
      }
     </pre>
  </div>
  
  	
  <a name="context"></a>
      <a name="N10042"></a><a name="Accessing+logical+context+information"></a>
  <h3>Accessing logical context information</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>Within your own beans or bean methods, it might be interesting from
          time to time, whether you are currently within an imported or included
          schema. If so, you might also want to know about the outer schemas.
          Access to these items is provided through</p>
  <pre class="code">
  	getXSSchema().getContext().getXSLogicalParser().getSyntaxSchemas()
        </pre>
  </div>
    
  <div class="attribution"></div>
  </div>
  </td><td width="10"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end Content==================-->
  </table>
  </td>
  </tr>
  </table>
  <!--================= end Menu, NavBar, Content ==================-->
  <!--================= start Footer ==================-->
  <table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0">
  <tr>
  <td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"><a href="../skin/images/label.gif"></a><a href="../skin/images/page.gif"></a><a href="../skin/images/chapter.gif"></a><a href="../skin/images/chapter_open.gif"></a><a href="../skin/images/current.gif"></a><a href="/favicon.ico"></a></td>
  </tr>
  <tr>
  <td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright &copy;
            2003&nbsp;Apache Software Foundation All rights reserved.<script type="text/javascript" language="JavaScript"><!--
                document.write(" - "+"Last Published: " + document.lastModified);
              //  --></script></font></td>
  </tr>
  <tr>
  <td colspan="2" align="left" bgcolor="#CFDCED" class="logos"></td>
  </tr>
  </table>
  <!--================= end Footer ==================-->
  </body>
  </html>
  
  
  
  1.1                  ws-site/targets/jaxme/xs/syntax.html
  
  Index: syntax.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  <html>
  <head>
  <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>The syntax parser</title>
  <link type="text/css" href="../skin/page.css" rel="stylesheet">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
  <!--================= start Navigation Path ==================-->
  <table summary="navigation path" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td nowrap="nowrap" valign="middle" bgcolor="#CFDCED" height="20"><img height="1" width="5" alt="" src="../skin/images/spacer.gif" class="spacer"><!--===== breadcrumb trail (javascript-generated) ====--><font size="2" face="Arial, Helvetica, Sans-serif"><script src="../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script></font></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" height="2"><img height="2" width="2" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Navigation Path ==================-->
  <!--================= start Banner ==================-->
  <table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <!--================= start Group Logo ==================-->
  <td bgcolor="#294563"><a href="http://ws.apache.org/JaxMe/"><img border="0" class="logoImage" alt="JaxMe 2" src="../images/group-logo.gif"></a></td>
  <!--================= end Group Logo ==================-->
  <!--================= start Project Logo ==================--><td width="100%" align="center" bgcolor="#294563"><a href="http://ws.apache.org/JaxMe/">JaxMe 2</a></td>
  <!--================= end Project Logo ==================-->
  <!--================= start Search ==================--><td valign="top" rowspan="2" bgcolor="#294563">
  <form target="_blank" action="http://www.google.com/search" method="get">
  <table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
  <tr>
  <td colspan="3"><img height="10" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img height="1" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap"><input value="ws.apache.org/JaxMe/" name="sitesearch" type="hidden"><input size="15" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../skin/images/spacer.gif" class="spacer"><input name="Search" value="Search" type="submit">
  <br>
  <font face="Arial, Helvetica, Sans-serif" size="2" color="white">
                        the JaxMe 2 site
                        
                        
                      </font></td><td><img height="1" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td><img alt="" border="0" height="10" width="9" src="../skin/images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td><img alt="" border="0" height="10" width="9" src="../skin/images/search-right.gif"></td>
  </tr>
  </table>
  </form>
  </td>
  <!--================= start Search ==================--><td bgcolor="#294563"><img height="10" width="10" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" bgcolor="#294563" colspan="2">
  <!--================= start Tabs ==================-->
  <div class="tab">
  <table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td width="6"><img alt="" height="8" width="6" src="../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="non selected tab" style="height: 1.6em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-left.gif"></td><td valign="middle" bgcolor="#B2C4E0"><a class="base-not-selected" href="../index.html">JaxMe 2</a></td><td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-right.gif"></td>
  </tr>
  <tr>
  <td colspan="3" height="1"></td>
  </tr>
  </table>
  </td><td width="6"><img alt="" height="8" width="6" src="../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="non selected tab" style="height: 1.6em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-left.gif"></td><td valign="middle" bgcolor="#B2C4E0"><a class="base-not-selected" href="../api/index.html">JAXB API</a></td><td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-right.gif"></td>
  </tr>
  <tr>
  <td colspan="3" height="1"></td>
  </tr>
  </table>
  </td><td width="6"><img alt="" height="8" width="6" src="../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="non selected tab" style="height: 1.6em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-left.gif"></td><td valign="middle" bgcolor="#B2C4E0"><a class="base-not-selected" href="../js/index.html">JaxMeJS</a></td><td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../skin/images/tab-right.gif"></td>
  </tr>
  <tr>
  <td colspan="3" height="1"></td>
  </tr>
  </table>
  </td><td width="6"><img alt="" height="8" width="6" src="../skin/images/spacer.gif"></td><td valign="bottom">
  <table summary="selected tab" style="height: 1.8em" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../skin/images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b><a class="base-selected" href="../xs/index.html">JaxMeXS</a></b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../skin/images/tabSel-right.gif"></td>
  </tr>
  </table>
  </td>
  </tr>
  </table>
  </div>
  <!--================= end Tabs ==================-->
  </td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  <!--================= end Banner ==================-->
  <!--================= start Menu, NavBar, Content ==================-->
  <table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td valign="top">
  <table summary="menu" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <!--================= start left top NavBar ==================-->
  <td rowspan="3" valign="top">
  <table summary="blue line" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif">&nbsp;</font></td>
  </tr>
  <tr>
  <td bgcolor="#294563"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td>
  <!--================= end left top NavBar ==================--><td bgcolor="#294563"><img width="1" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F">
  <!--================= start Menu items ==================-->
  <div class="menu">
  <ul>
  <li>
  <font color="#CFDCED">JaxMeXS</font>
  <ul>
  	
  <li>
  <a href="index.html">Introduction</a>
  </li>
      
  <li>
  <a href="generic.html">Generic XML Parser</a>
  </li>
      
  <li>
  <span class="sel"><font color="#ffcc00">Syntax Parser</font></span>
  </li>
      
  <li>
  <a href="logical.html">Logical Parser</a>
  </li>
    
  </ul>
  </li>
  </ul>
  </div>
  <!--================= end Menu items ==================-->
  </td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../skin/images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../skin/images/menu-right.gif"></td>
  </tr>
  <tr>
  <td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  </table>
  </td><td valign="top" width="100%">
  <table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0">
  <!--================= start middle NavBar ==================-->
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
                  &nbsp;
                  
                  </font><img width="10" height="8" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <tr>
  <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end middle NavBar ==================-->
  <!--================= start Content==================-->
  <tr>
  <td align="left" width="10"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td><td align="left" width="100%">
  <div xmlns:xhtml="http://www.w3.org/1999/xhtml" class="content">
  <table class="title" summary="">
  <tr>
  <td valign="middle">
  <h1>The syntax parser</h1>
  </td><td nowrap="nowrap" width="40" align="center"><a class="dida" href="syntax.pdf"><img alt="PDF" src="../skin/images/pdfdoc.gif" class="skin"><br>
            PDF</a></td>
  </tr>
  </table>
  <ul class="minitoc">
  <li>
  <a href="#The+syntax+parser">The syntax parser</a>
  </li>
  <li>
  <a href="#Using+the+syntax+parser">Using the syntax parser</a>
  </li>
  <li>
  <a href="#Forcing+the+schema+parser+to+use+your+own+beans">Forcing the schema parser to use your own beans</a>
  </li>
  <li>
  <a href="#Adding+new+attributes+to+an+existing+schema+element.">Adding new attributes to an existing schema element.</a>
  </li>
  <li>
  <a href="#Handling+different+namespaces">Handling different namespaces</a>
  </li>
  <li>
  <a href="#Adding+new+child+elements">Adding new child elements</a>
  </li>
  </ul>
      
  <a name="N1000A"></a><a name="The+syntax+parser"></a>
  <h3>The syntax parser</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>JaxMeXS mainly consists of three parts: A
          <a href="generic.html">generic parser</a>, which is by no means
          restricted to XML schema, a syntax parser, which is is dedicated to the
          syntactical aspects of XML schema, and a structure parser, which understands
          the logic. Extending JaxMeXS will always imply extending the syntax parser. In the
          most cases this will even be sufficient: Who's interested in creating a language as
          complex as XML schema?</p>
  <p>The syntax parser is an application of the
          <a href="generic.html">generic parser</a>. This means, that it converts
          any element in the XML schema into a Java bean. The attributes and elements are
          mapped to bean properties. Attributes have simple values like strings or integers,
          but a child element is yet another bean. In what follows, we'll discuss the following
          aspects:</p>
  <ol>
          
  <li>
  <a href="#using">Using</a> the syntax parser.</li>
          
  <li>Making the schema parser to use <a href="#objectFactory">your own beans</a>.</li>
          
  <li>Adding new <a href="#attributes">attributes</a> to an existing schema element.</li>
          
  <li>Handling <a href="#namespaces">different namespaces</a>.</li>
          
  <li>Adding new <a href="#childElements">child elements</a>.</li>
        
  </ol>
  </div>
  
      
  <a name="using"></a>
      <a name="N10046"></a><a name="Using+the+syntax+parser"></a>
  <h3>Using the syntax parser</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>To use the syntax parser, instantiate the class
  	    <a href="../apidocs/org/apache/ws/jaxme/xs/XSParser.html">XSParser</a> and invoke
  	    its <span class="codefrag">parse()</span> method, for example like this:</p>
  <pre class="code">
    import java.io.FileInputStream;
    import org.xml.sax.InputSource;
    import org.apache.ws.jaxme.xs.XSParser:
  
    public class MyParser {
      public static void main(String[] args) throws Exception {
        FileInputStream fs = new FileInputStream(args[0]);
        InputSource is = new InputSource(fs);
        is.setSystemId(fs.toURL().toString()); // This is important, if you use a DTD,
                                               // external entities, schema validation, ...
                                               // in other words: Other files
        XSParser parser = new XSParser();
        XsESchema schema = parser.parseSyntax(is);
      }
    }
        </pre>
  <p>That's it! The returned instance of
          <a href="../apidocs/org/apache/ws/jaxme/xs/xml/XsESchema.html">XsESchema</a> is a
          standard schema with methods like <span class="codefrag">getTargetNamespace()</span> or
          <span class="codefrag">getChilds()</span>. For example, the list of global types can be retrieved
          as follows:</p>
  <pre class="code">
    Object[] childs = schema.getChilds();
    for (int i = 0;  i &lt; childs.length;  i++) {
      Object o = childs[i];
      if (o instanceof XsETopLevelSimpleType) {
        XsETopLevelSimpleType t = (XsETopLevelSimpleType) o;
        System.out.println("Simple type: " + t.getName());
      } else if (o instanceof XsTComplexType) {
        XsTComplexType t = (XsTComplexType) o;
        System.out.println("Complex type: " + t.getName());
      }
    }
     </pre>
  <p>This is not very comfortable, but the intent of the syntax parser is simplicity,
          and not comfort.</p>
  </div>
  
      
  <a name="XsObjectFactory"></a>
      <a name="N10073"></a><a name="Forcing+the+schema+parser+to+use+your+own+beans"></a>
  <h3>Forcing the schema parser to use your own beans</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>The beans returned by the schema parser are instances of
          <a href="../apidocs/org/apache/ws/jaxme/xs/xml/impl/XsObjectImpl.html">XsObjectImpl</a>,
          implementing the interface
          <a href="../apidocs/org/apache/ws/jaxme/xs/xml/XsObject.html">XsObject</a>.
          The <span class="codefrag">XsObject</span> interface allows access to the SAX location.</p>
  <p>However, you might replace these completely with own implementations:
          The <a href="../apidocs/org/apache/ws/jaxme/xs/xml/XsObjectFactory.html">object factory</a>
          makes it possible.</p>
  <p>Any of the standard XML schema beans is created by the object factory.
          For example, the method <span class="codefrag">newXSESchema()</span> is invoked to create
          the schema bean. We take this bean as an example and change the behaviour
          of its attribute <span class="codefrag">targetNamespace</span>. For compatibility reasons
          we want to replace the namespace <span class="codefrag">http://company.com/namespaces/version1</span>
          with <span class="codefrag">http://company.com/namespaces/version2</span>. To achieve that,
          we have to create three classes:</p>
  <ol>
          
  <li>A subclass of
            <a href="../apidocs/org/apache/ws/jaxme/xs/xml/impl/XsESchemaImpl.html">XsESchemaImpl</a>
            with a modified <span class="codefrag">setTargetNamespace()</span> method,</li>
          
  <li>an updated object factory, that doesn't create an instance of the base class,
            but an instance of our subclass,</li>
          
  <li>and, finally, a parser that uses our own object factory.</li>
        
  </ol>
  <p>Let's begin with the first task:</p>
  <pre class="code">
    import org.xml.sax.Locator;
    import org.apache.ws.jaxme.xs.xml.XsObjectFactory;
    import org.apache.ws.jaxme.xs.xml.impl.XsESchemaImpl;
  
    public class MySchema extends XsESchemaImpl {
      protected MySchema(XsObjectFactory pFactory, Locator pLocator) {
        super(pFactory, pLocator);
      }
      public void setTargetNamespace(XsAnyURI pURI) {
        if (pURI.equals("http://company.com/namespaces/version1")) {
          pURI = "http://company.com/namespaces/version2";
        }
        super.setTargetNamespace(pURI);
      }
    }
        </pre>
  <p>Neat, isn't it? Now, here's the object factory:</p>
  <pre class="code">
    import org.apache.ws.jaxme.xs.xml.XsESchema;
    import org.apache.ws.jaxme.xs.xml.impl.XsObjectFactoryImpl;
  
    public class MyXsObjectFactory extends XsObjectFactoryImpl {
      public XsESchema newXsESchema() {
        return new MySchema(this, getLocator());
      }
    }
        </pre>
  <p>You probably already guess how the parser looks like:</p>
  <pre class="code">
    import org.apache.ws.jaxme.xs.XSParser;
  
    public class MyParser extends XSParser {
      public MyParser() {
        getData().setXsObjectFactory(new MyXsObjectFactory());
      }
    }
        </pre>
  <p>Now we have a parser, which does no longer distinguish between
          <span class="codefrag">http://company.com/namespaces/version2</span> and
          <span class="codefrag">http://company.com/namespaces/version1</span> in the
          target namespace.</p>
  </div>
  
      
  <a name="attributes"></a>
      <a name="N100D4"></a><a name="Adding+new+attributes+to+an+existing+schema+element."></a>
  <h3>Adding new attributes to an existing schema element.</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>We already know how to extend the parser.This knowledge will be
          applied in the following example: We'll have an an additional
          attribute "ignore" in the element definition. It ought to have a
          boolean value. (For example, the attribute might indicate that
          a custom program should ignore the element.)</p>
  <p>The attribute is introduced by adding a property "ignore" to
          the "element" bean. This might look like this:</p>
  <pre class="code">
    import org.xml.sax.Locator;
    import org.apache.ws.jaxme.xs.xml.XsObjectFactory;
    import org.apache.ws.jaxme.xs.xml.impl.XsTElementImpl;
  
    public class MyElement extends XsTElementImpl {
      private boolean ignoreMe;
  
      protected MyElement(XsObjectFactory pFactory, Locator pLocator) {
        super(pFactory, pLocator);
      }
      public void setIgnore(boolean pIgnore) {
        ignoreMe = pIgnore;
      }
      public boolean getIgnore() {
        return ignoreMe;
      }
    }
        </pre>
  <p>We are not yet done. As we are using an own bean, we have to extend
          the object factory to return this bean, if the method
          <span class="codefrag">newXsTElementImpl()</span> is invoked. We also have to extend
          the parser to use the extended object factory. These steps have already
          been described in the <a href="#XsObjectFactory">previous section</a>,
          so we omit it here.</p>
  </div>
  
      
  <a name="namespaces"></a>
      <a name="N100F2"></a><a name="Handling+different+namespaces"></a>
  <h3>Handling different namespaces</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>What we did in the <a href="#attributes">previous</a> section on
          <a href="#attributes">adding attributes</a>, wasn't really conforming
          to XML Schema. Our attribute had the default namespace, as the standard
          XML Schema attributes do. Any other namespace had been a better choice.
          XML Schema allows to include arbitrary attributes into a schema, as long
          as they do not have the XML schema namespace. Surprisingly, the default
          namespace isn't implicitly forbidden. Anyways, such behaviour cannot be
          recommended.</p>
  <p>To support attributes from other namespaces, we'll have to add another
          method to our bean. The method is called</p>
  <pre class="code">
    public boolean setAttribute(String pQName, String pNamespaceURI,
                                String pLocalName, String pValue)
      throws SAXException;
        </pre>
  <p>The boolean return value allows the method a decision to handle an
          attribute (for example, if it is defined in a particular additional
          namespace) by returning <span class="codefrag">true</span> or to leave the attribute
          to the standard mechanisms by returning <span class="codefrag">false</span>. A typical
          implementation might look like this:</p>
  <pre class="code">
      if (!"http://company.com/namespaces/mynamespace".equals(pNamespaceURI)) {
        return false;
      }
      if ("ignore".equals(pLocalName)) {
        setIgnore(Boolean.valueOf(pValue).booleanValue());
      } else {
        throw new SaxParseException("Invalid attribute: " + pValue, getLocation());
      }
        </pre>
  <p>The meaning is obvious: We feel responsible for the namespace
          <span class="codefrag">http://company.com/namespaces/mynamespace</span>. If the attributes
          namespace is different, we simply return false. If the namespace matches,
          we accept the attribute "ignore", and refuse all others by throwing a
          <span class="codefrag">SAXException</span>.</p>
  </div>
  
      
  <a name="childElements"></a>
      <a name="N10125"></a><a name="Adding+new+child+elements"></a>
  <h3>Adding new child elements</h3>
  <div style="margin-left: 0 ; border: 2px">
  <p>The handling of a new child is no more complex than the handling of
          attributes. In fact, it works quite the same. Basically one creates a
          new bean and adds a bean property to the parent element, as in the following
          example:</p>
  <pre class="code">
    MyChildBean childBean;
  
    public MyChildBean createMyChild() {
      if (childBean != null) {
        throw new IllegalStateException("Multiple 'myChild' elements are forbidden.");
      }
      childBean = new MyChildBean();
    }
  
    public MyChildBean getMyChild() {
      return childBean;
    }
        </pre>
  <p>This code is added to the parent bean. For example, if we want to have a new
          element <span class="codefrag">xs:schema/xs:myChild</span>, we could create a new subclass of
          <a href="../apidocs/org/apache/ws/jaxme/xs/xml/impl/XsESchemaImpl.html">XsESchemaImpl</a>
          with the above code. By extending the object factory to use our updated schema
          bean and extending the parser to use our private object factory, we would be
          done. (The latter steps are as in the first example section on
          <a href="#XsObjectFactory">using our own beans</a>.)</p>
  <p>There are two possible reasons, why the above code might be insufficient:
          First of all, the example obviously doesn't care for namespaces. Second,
          there's a chance that we do not want to create a simple bean. For example,
          the standard behaviour of
          <a href="../apidocs/org/apache/ws/jaxme/xs/xml/impl/XsEAppinfoImpl.html">XsEAppinfo</a>
          is to convert child elements into DOM documents.</p>
  <p>Both becomes possible by the following example:</p>
  <pre class="code">
    import org.xml.sax.ContentHandler;
    import org.apache.ws.jaxme.xs.parser.impl.XsSAXParserImpl;
  
    MyChildBean childBean;
  
    public ContentHandler getChildHandler(String pQName, String pNamespaceURI,
                                          String pLocalName) throws SAXException {
      if (!"http://company.com/namespaces/mynamespace".equals(pNamespaceURI)) {
        return null;
      }
      if ("myChild".equals(pLocalName)) {
  	  if (childBean != null) {
  	    throw new IllegalStateException("Multiple 'myChild' child elements are forbidden.");
  	  }
  	  childBean = new MyChildBean();
  	  return new XsSAXParserImpl(childBean);
      } else {
        throw new IllegalStateException("Unknown child element: " + pQName);
      }
    }
  
    public MyChildBean getMyChild() {
      return childBean;
    }
        </pre>
  <p>Besides the different namespace, the example is functionally equivalent to
          the previous example.</p>
  </div>
    
  <div class="attribution"></div>
  </div>
  </td><td width="10"><img width="10" height="1" alt="" src="../skin/images/spacer.gif" class="spacer"></td>
  </tr>
  <!--================= end Content==================-->
  </table>
  </td>
  </tr>
  </table>
  <!--================= end Menu, NavBar, Content ==================-->
  <!--================= start Footer ==================-->
  <table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0">
  <tr>
  <td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../skin/images/spacer.gif" class="spacer"><a href="../skin/images/label.gif"></a><a href="../skin/images/page.gif"></a><a href="../skin/images/chapter.gif"></a><a href="../skin/images/chapter_open.gif"></a><a href="../skin/images/current.gif"></a><a href="/favicon.ico"></a></td>
  </tr>
  <tr>
  <td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright &copy;
            2003&nbsp;Apache Software Foundation All rights reserved.<script type="text/javascript" language="JavaScript"><!--
                document.write(" - "+"Last Published: " + document.lastModified);
              //  --></script></font></td>
  </tr>
  <tr>
  <td colspan="2" align="left" bgcolor="#CFDCED" class="logos"></td>
  </tr>
  </table>
  <!--================= end Footer ==================-->
  </body>
  </html>
  
  
  
  1.1                  ws-site/targets/jaxme/xs/generic.pdf
  
  	<<Binary file>>
  
  
  1.1                  ws-site/targets/jaxme/xs/index.pdf
  
  	<<Binary file>>
  
  
  1.1                  ws-site/targets/jaxme/xs/logical.pdf
  
  	<<Binary file>>
  
  
  1.1                  ws-site/targets/jaxme/xs/syntax.pdf
  
  	<<Binary file>>