You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by dk...@apache.org on 2021/09/20 20:46:12 UTC

svn commit: r1893483 [6/6] - in /webservices/website/xmlschema/xmlschema-core: ./ css/ fonts/ images/ js/

Modified: webservices/website/xmlschema/xmlschema-core/writingExtensions.html
URL: http://svn.apache.org/viewvc/webservices/website/xmlschema/xmlschema-core/writingExtensions.html?rev=1893483&r1=1893482&r2=1893483&view=diff
==============================================================================
--- webservices/website/xmlschema/xmlschema-core/writingExtensions.html (original)
+++ webservices/website/xmlschema/xmlschema-core/writingExtensions.html Mon Sep 20 20:46:12 2021
@@ -1,250 +1,92 @@
 <!DOCTYPE html>
 <!--
- | Generated by Apache Maven Doxia at 2017-05-05
- | Rendered using Apache Maven Fluido Skin 1.3.0
+ | Generated by Apache Maven Doxia Site Renderer 1.9.2 from src/site/xdoc/writingExtensions.xml at 2021-09-14
+ | Rendered using Apache Maven Fluido Skin 1.9
 -->
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
   <head>
     <meta charset="UTF-8" />
-    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-    <meta name="Date-Revision-yyyymmdd" content="20170505" />
-    <meta http-equiv="Content-Language" content="en" />
+    <meta name="viewport" content="width=device-width, initial-scale=1" />
+    <meta name="generator" content="Apache Maven Doxia Site Renderer 1.9.2" />
     <title>Apache XmlSchema &#x2013; :: Apache XmlSchema Extension Tutorial ::</title>
-    <link rel="stylesheet" href="./css/apache-maven-fluido-1.3.0.min.css" />
+    <link rel="stylesheet" href="./css/apache-maven-fluido-1.9.min.css" />
     <link rel="stylesheet" href="./css/site.css" />
     <link rel="stylesheet" href="./css/print.css" media="print" />
+    <script src="./js/apache-maven-fluido-1.9.min.js"></script>
+<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /><meta content="text/html; charset=iso-8859-1" />  </head>
+  <body class="topBarDisabled">
+    <div class="container-fluid">
+      <header>
+        <div id="banner">
+          <div class="pull-left"><div id="bannerLeft"><h2>XmlSchema Core</h2>
+</div>
+</div>
+          <div class="pull-right"><a href="http://ws.apache.org/" id="bannerRight"><img src="http://ws.apache.org/images/project-logo.jpg"  alt=""/></a></div>
+          <div class="clear"><hr/></div>
+        </div>
 
-      
-    <script type="text/javascript" src="./js/apache-maven-fluido-1.3.0.min.js"></script>
-
-    
-    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /><meta content="text/html; charset=iso-8859-1" />        </head>
-        <body class="topBarDisabled">
-          
-                
-                    
-    
-        <div class="container-fluid">
-          <div id="banner">
-        <div class="pull-left">
-                                <div id="bannerLeft">
-                <h2>XmlSchema Core</h2>
-                </div>
-                      </div>
-        <div class="pull-right">                                <a href="../../../" id="bannerRight">
-                                                                                                <img src="../../../images/project-logo.jpg" />
-                </a>
-      </div>
-        <div class="clear"><hr/></div>
-      </div>
-
-      <div id="breadcrumbs">
-        <ul class="breadcrumb">
-                
-                    
-                  <li id="publishDate">Last Published: 2017-05-05</li>
-                      
-                
-                    
-      
-                                              
-    <li class="pull-right">              <a href="../../XmlSchema/" title="XmlSchema">
-        XmlSchema</a>
-  </li>
-
-        <li class="divider pull-right">|</li>
-      
-    <li class="pull-right">              <a href="../../../" title="WebServices">
-        WebServices</a>
-  </li>
-
-        <li class="divider pull-right">|</li>
-      
-    <li class="pull-right">              <a href="http://www.apache.org/" class="externalLink" title="Apache">
-        Apache</a>
-  </li>
-
-                        </ul>
-      </div>
-
-            
+        <div id="breadcrumbs">
+          <ul class="breadcrumb">
+        <li id="publishDate">Last Published: 2021-09-14</li>
+      <li class="pull-right"><span class="divider">|</span>
+<a href="http://ws.apache.org/commons/XmlSchema/" class="externalLink" title="XmlSchema">XmlSchema</a></li>
+      <li class="pull-right"><span class="divider">|</span>
+<a href="http://ws.apache.org/" class="externalLink" title="WebServices">WebServices</a></li>
+      <li class="pull-right"><a href="http://www.apache.org/" class="externalLink" title="Apache">Apache</a></li>
+          </ul>
+        </div>
+      </header>
       <div class="row-fluid">
-        <div id="leftColumn" class="span3">
+        <header id="leftColumn" class="span2">
+          <nav class="well sidebar-nav">
+  <ul class="nav nav-list">
+   <li class="nav-header">XML Schema</li>
+    <li><a href="../index.html" title="Home"><span class="none"></span>Home</a></li>
+    <li><a href="http://www.apache.org/dyn/closer.cgi/ws/xmlschema/" class="externalLink" title="Downloads"><span class="icon-chevron-down"></span>Downloads</a>
+     <ul class="nav nav-list">
+      <li><a href="scm.html" title="Source Code"><span class="none"></span>Source Code</a></li>
+     </ul></li>
+    <li><a href="" title="Documentation"><span class="icon-chevron-down"></span>Documentation</a>
+     <ul class="nav nav-list">
+      <li><a href="schematutorial.html" title="Tutorial"><span class="none"></span>Tutorial</a></li>
+      <li class="active"><a href="#"><span class="none"></span>Extensions</a></li>
+      <li><a href="apidocs/index.html" title="Javadocs"><span class="none"></span>Javadocs</a></li>
+      <li><a href="https://github.com/apache/ws-xmlschema" class="externalLink" title="View Source"><span class="none"></span>View Source</a></li>
+     </ul></li>
+    <li><a href="project-info.html" title="Project Information"><span class="icon-chevron-down"></span>Project Information</a>
+     <ul class="nav nav-list">
+      <li><a href="mailing-lists.html" title="Mailing Lists"><span class="none"></span>Mailing Lists</a></li>
+      <li><a href="issue-management.html" title="Issue Tracking"><span class="none"></span>Issue Tracking</a></li>
+     </ul></li>
+    <li><a href="licenses.html" title="License"><span class="none"></span>License</a></li>
+   <li class="nav-header">Project Documentation</li>
+    <li><a href="project-info.html" title="Project Information"><span class="icon-chevron-right"></span>Project Information</a></li>
+   <li class="nav-header">Apache</li>
+    <li><a href="http://www.apache.org/licenses/" class="externalLink" title="License"><span class="none"></span>License</a></li>
+    <li><a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsorship"><span class="none"></span>Sponsorship</a></li>
+    <li><a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks"><span class="none"></span>Thanks</a></li>
+    <li><a href="http://apache.org/security/" class="externalLink" title="Security"><span class="none"></span>Security</a></li>
+  </ul>
+          </nav>
           <div class="well sidebar-nav">
-                
-                    
-                <ul class="nav nav-list">
-                    <li class="nav-header">XML Schema</li>
-                                
-      <li>
-    
-                          <a href="../index.html" title="Home">
-          <i class="none"></i>
-        Home</a>
-            </li>
-                                                              
-      <li>
-    
-                          <a href="http://www.apache.org/dyn/closer.cgi/ws/xmlschema/" class="externalLink" title="Downloads">
-          <i class="icon-chevron-down"></i>
-        Downloads</a>
-                    <ul class="nav nav-list">
-                      
-      <li>
-    
-                          <a href="source-repository.html" title="Source Code">
-          <i class="none"></i>
-        Source Code</a>
-            </li>
-              </ul>
-        </li>
-                                                                                                                              
-      <li>
-    
-                          <a href="" title="Documentation">
-          <i class="icon-chevron-down"></i>
-        Documentation</a>
-                    <ul class="nav nav-list">
-                      
-      <li>
-    
-                          <a href="schematutorial.html" title="Tutorial">
-          <i class="none"></i>
-        Tutorial</a>
-            </li>
-                      
-      <li class="active">
-    
-            <a href="#"><i class="none"></i>Extensions</a>
-          </li>
-                      
-      <li>
-    
-                          <a href="apidocs/index.html" title="Javadocs">
-          <i class="none"></i>
-        Javadocs</a>
-            </li>
-                      
-      <li>
-    
-                          <a href="http://svn.apache.org/viewvc/webservices/xmlschema/trunk/?root=Apache-SVN" class="externalLink" title="View Source">
-          <i class="none"></i>
-        View Source</a>
-            </li>
-              </ul>
-        </li>
-                                                                                
-      <li>
-    
-                          <a href="project-info.html" title="Project Information">
-          <i class="icon-chevron-down"></i>
-        Project Information</a>
-                    <ul class="nav nav-list">
-                      
-      <li>
-    
-                          <a href="mail-lists.html" title="Mailing Lists">
-          <i class="none"></i>
-        Mailing Lists</a>
-            </li>
-                      
-      <li>
-    
-                          <a href="issue-tracking.html" title="Issue Tracking">
-          <i class="none"></i>
-        Issue Tracking</a>
-            </li>
-              </ul>
-        </li>
-                  
-      <li>
-    
-                          <a href="license.html" title="License">
-          <i class="none"></i>
-        License</a>
-            </li>
-                              <li class="nav-header">Project Documentation</li>
-                                                                                                                                                                                                                                                                                        
-      <li>
-    
-                          <a href="project-info.html" title="Project Information">
-          <i class="icon-chevron-right"></i>
-        Project Information</a>
-                  </li>
-                              <li class="nav-header">Apache</li>
-                                
-      <li>
-    
-                          <a href="http://www.apache.org/licenses/" class="externalLink" title="License">
-          <i class="none"></i>
-        License</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsorship">
-          <i class="none"></i>
-        Sponsorship</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks">
-          <i class="none"></i>
-        Thanks</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="http://apache.org/security/" class="externalLink" title="Security">
-          <i class="none"></i>
-        Security</a>
-            </li>
-            </ul>
-                
-                    
-                            <form id="search-form" action="http://www.google.com/search" method="get" >
-    
+<form id="search-form" action="https://www.google.com/search" method="get" >
   <input value="ws.apache.org" name="sitesearch" type="hidden"/>
   <input class="search-query" name="q" id="query" type="text" />
 </form>
-<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=search-form"></script>
-          
-          <hr class="divider" />
-
-           <div id="poweredBy">
-                            <div class="clear"></div>
-                            <div class="clear"></div>
-                            <div class="clear"></div>
-                             <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
-        <img class="builtBy" alt="Built by Maven" src="./images/logos/maven-feather.png" />
-      </a>
-                  </div>
+<script>asyncJs( 'https://cse.google.com/brand?form=search-form' )</script>
+            <hr />
+            <div id="poweredBy">
+              <div class="clear"></div>
+              <div class="clear"></div>
+              <div class="clear"></div>
+<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="./images/logos/maven-feather.png" /></a>
+            </div>
           </div>
-        </div>
-        
-                
-        <div id="bodyColumn"  class="span9" >
-                                  
-            <!-- ~ 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. -->
+        </header>
+        <main id="bodyColumn"  class="span10" >
+
     
-        
-<div class="section">
+        <section>
 <h2><a name="Contents"></a>Contents</h2>
             
 <ul>
@@ -260,28 +102,26 @@
 <li><a href="#ser">Code for a Serializer</a></li>
                 
 <li><a href="#reg">Registering types and using a custom extension registry</a></li>
-                <!-- <li><a href="#default">Default Behavior</a></li> -->
+                
                 
 <li><a href="#conclusion">Conclusion</a></li>
             </ul>
-        </div>
+        </section>
 
 
         <a name="intro"></a>
-        
-<div class="section">
+        <section>
 <h2><a name="Introduction"></a>Introduction</h2>
             
 <p>Usually when parsing a schema document, developers will prefer to make custom
                 objects for attribute and element extensions. XMLSchema supports this through
                 an extension registry mechanism. This document explains how this extension mechanism works by going through
                 two complete examples. These two examples are included as test cases with the source release.</p>
-        </div>
+        </section>
 
 
         <a name="example"></a>
-        
-<div class="section">
+        <section>
 <h2><a name="Example_Extension"></a>Example Extension</h2>
             
 <p>Following are two example schema documents that contain external attributes/elements</p>
@@ -348,36 +188,34 @@
         or customElt. This can be achieved by writing a custom extension deserializer and serializer and
         registering them with the extension registry. The next section briefly explains the important classes
         involved in this process.</p>
-        </div>
+        </section>
 
         <a name="iclasses"></a>
-        
-<div class="section">
+        <section>
 <h2><a name="Important_classes"></a>Important classes</h2>
            
 <p>Following are the important classes in writing an extension</p>
            
 <ul>
                
-<li><tt>org.apache.ws.commons.schema.extensions.ExtensionRegistry</tt></li>
+<li><code>org.apache.ws.commons.schema.extensions.ExtensionRegistry</code></li>
                
-<li><tt>org.apache.ws.commons.schema.extensions.ExtensionDeserializer</tt></li>
+<li><code>org.apache.ws.commons.schema.extensions.ExtensionDeserializer</code></li>
                
-<li><tt>org.apache.ws.commons.schema.extensions.ExtensionSerializer</tt></li>
+<li><code>org.apache.ws.commons.schema.extensions.ExtensionSerializer</code></li>
            </ul>
            
 <p>Last two classes are interfaces that should be implemented by the respective
            implementations.</p>
 
-         </div>
+         </section>
 
         <a name="deser"></a>
-        
-<div class="section">
+        <section>
 <h2><a name="Code_for_a_Deserializer"></a>Code for a Deserializer</h2>
            
 <p>The deserializer needs to implement the
-               <tt>org.apache.ws.commons.schema.extensions.ExtensionDeserializer</tt> interface.
+               <code>org.apache.ws.commons.schema.extensions.ExtensionDeserializer</code> interface.
            Following is a code fragment of the Extension deserializer that deserializes the extension
            attribute into a custom object. Note that once the custom object is made it is attached
            to the meta info map of the relevant XMLSchema object with the QName as the key</p>
@@ -387,7 +225,7 @@
              </p>
 <div>
 <pre>
-                 <tt>
+                 <code>
                  public void deserialize(XmlSchemaObject schemaObject, QName name, Node domNode) {
                  if (CustomAttribute.CUSTOM_ATTRIBUTE_QNAME.equals(name)){
                      Attr attrib = (Attr)domNode;
@@ -402,13 +240,13 @@
                      schemaObject.addMetaInfo(CustomAttribute.CUSTOM_ATTRIBUTE_QNAME,customAttrib);
                   }
                  }
-                 </tt>
+                 </code>
              </pre></div>
           
           
 <p>Note that prior knowledge is required about the format of the string of the attribute value.
           The complete custom attribute deserializer is available in
-          <tt>tests.customext.attrib.CustomAttributeDeserializer</tt></p>
+          <code>tests.customext.attrib.CustomAttributeDeserializer</code></p>
 
           
 <p> Following is a code fragment of the Extension deserializer that deserializes the extension
@@ -420,7 +258,7 @@
              </p>
 <div>
 <pre>
-                 <tt>
+                 <code>
                   public void deserialize(XmlSchemaObject schemaObject, QName name, Node domNode) {
                      if (CustomElement.CUSTOM_ELT_QNAME.equals(name)){
                          Element elt = (Element)domNode;
@@ -433,21 +271,20 @@
                          schemaObject.addMetaInfo(CustomElement.CUSTOM_ELT_QNAME,customElement);
                      }
     }
-                 </tt>
+                 </code>
              </pre></div>
           
           
 <p>The complete custom attribute deserializer is available in
-          <tt>tests.customext.elt.CustomElementDeserializer</tt></p>
-         </div>
+          <code>tests.customext.elt.CustomElementDeserializer</code></p>
+         </section>
 
            <a name="ser"></a>
-        
-<div class="section">
+        <section>
 <h2><a name="Code_for_a_Serializer"></a>Code for a Serializer</h2>
            
 <p>The serializer needs to implement the
-           <tt>org.apache.ws.commons.schema.extensions.ExtensionSerializer</tt> interface.
+           <code>org.apache.ws.commons.schema.extensions.ExtensionSerializer</code> interface.
            Following is a code fragment of the Extension serializer that serializes a given custom
            object into an  attributeObject. Note that XMLSchema serialization mechanism is to create
            a DOM tree and serialize it. Hence the custom serializers needs to create the
@@ -458,7 +295,7 @@
              </p>
 <div>
 <pre>
-                 <tt>
+                 <code>
                  public void serialize(XmlSchemaObject schemaObject, Class classOfType, Node domNode) {
                         Map metaInfoMap = schemaObject.getMetaInfoMap();
                         CustomAttribute att = (CustomAttribute)metaInfoMap.get(CustomAttribute.CUSTOM_ATTRIBUTE_QNAME);
@@ -469,13 +306,13 @@
                         att1.setValue(att.getPrefix() + &quot;:&quot; + att.getSuffix());
                         elt.setAttributeNodeNS(att1);
                     }
-                 </tt>
+                 </code>
              </pre></div>
           
           
 <p>Note that prior knowledge is required about the format of the string of the attribute value. DomNode
              passed in would be the parent node of the serialized DOM tree.The complete custom attribute serializer is available in
-          <tt>tests.customext.attrib.CustomAttributeSerializer</tt></p>
+          <code>tests.customext.attrib.CustomAttributeSerializer</code></p>
 
           
 <p> Following is a code fragment of the Extension serializer that serializes the custom object into
@@ -486,7 +323,7 @@
              </p>
 <div>
 <pre>
-                 <tt>
+                 <code>
                    public void serialize(XmlSchemaObject schemaObject, Class classOfType, Node domNode) {
                        Map metaInfoMap = schemaObject.getMetaInfoMap();
                        CustomElement customElt = (CustomElement)metaInfoMap.get(CustomElement.CUSTOM_ELT_QNAME);
@@ -500,17 +337,16 @@
                         elt.appendChild(extElt);
 
                     }
-                 </tt>
+                 </code>
              </pre></div>
           
           
 <p>The complete custom element serializer is available in
-          <tt>tests.customext.elt.CustomElementSerializer</tt></p>
-         </div>
+          <code>tests.customext.elt.CustomElementSerializer</code></p>
+         </section>
 
         <a name="reg"></a>
-        
-<div class="section">
+        <section>
 <h2><a name="Registering_Types_and_Using_a_Custom_Extension_Registry"></a>Registering Types and Using a Custom Extension Registry</h2>
          
 <p>Once the serilizers are made they need to be registered with the registry.
@@ -520,19 +356,19 @@
             </p>
 <div>
 <pre>
-                <tt>
+                <code>
                    //register our custom type
                     registerDeserializer(CustomElement.CUSTOM_ELT_QNAME,new CustomElementDeserializer());
                     registerSerializer(CustomElement.class,new CustomElementSerializer());
-                </tt>
+                </code>
             </pre></div>
          
           
 <p>It can be a more convenient if the extension types are registered inside a subclass
-          of the <tt>org.apache.ws.commons.schema.extensions.ExtensionRegistry</tt> to
+          of the <code>org.apache.ws.commons.schema.extensions.ExtensionRegistry</code> to
           avoid any confusions.</p>
           
-<p>If the system property<tt>&quot;org.apache.ws.commons.extensions.ExtensionRegistry&quot;</tt> is present
+<p>If the system property<code>&quot;org.apache.ws.commons.extensions.ExtensionRegistry&quot;</code> is present
           the extension registry will be instantiated with the class specified. Following is an example of
           how this can be done</p>
            
@@ -540,44 +376,38 @@
                </p>
 <div>
 <pre>
-                   <tt>
+                   <code>
                        System.setProperty(Constants.SystemConstants.EXTENSION_REGISTRY_KEY,
                                     CustomExtensionRegistry.class.getName());
-                   </tt>
+                   </code>
                </pre></div>
            
             
 <p>This behavior is quite useful when the XMlSchema object models are used internally with
             no direct access to the extension registry.</p>
-        </div>
+        </section>
 
          <a name="conclusion"></a>
-        
-<div class="section">
+        <section>
 <h2><a name="Conclusion"></a>Conclusion</h2>
              The extension mechanism of the XMLSchema object model allows the users to add their custom
              objects to the standard XMLSchema objects.
-         </div>
+         </section>
     
 
 
-                  </div>
-            </div>
-          </div>
-
+        </main>
+      </div>
+    </div>
     <hr/>
-
     <footer>
-            <div class="container-fluid">
-              <div class="row span12">Copyright &copy;                    2004-2017
-                        <a href="http://www.apache.org/">The Apache Software Foundation</a>.
-            All Rights Reserved.      
-                    
+      <div class="container-fluid">
+        <div class="row-fluid">
+            <p>&#169;      2004&#x2013;2021
+<a href="https://www.apache.org/">The Apache Software Foundation</a>
+</p>
+        </div>
       </div>
-
-        
-        
-                </div>
     </footer>
   </body>
 </html>