Tagging for Axiom 1.1.1
diff --git a/axiom/LICENSE.txt b/axiom/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/axiom/LICENSE.txt
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+
diff --git a/axiom/NOTICE.txt b/axiom/NOTICE.txt
new file mode 100644
index 0000000..4f8483c
--- /dev/null
+++ b/axiom/NOTICE.txt
@@ -0,0 +1,12 @@
+   =========================================================================

+   ==  NOTICE file corresponding to the section 4 d of                    ==

+   ==  the Apache License, Version 2.0,                                   ==

+   ==  in this case for the Apache AXIOM distribution.                    ==

+   =========================================================================

+

+   This product includes software developed by

+   The Apache Software Foundation (http://www.apache.org/).

+   Portions Copyright 2006 International Business Machines Corp.

+

+   Please read the different LICENSE files present in the licenses directory of

+   this distribution.

diff --git a/axiom/README.txt b/axiom/README.txt
new file mode 100644
index 0000000..ca85520
--- /dev/null
+++ b/axiom/README.txt
@@ -0,0 +1,25 @@
+======================================================

+Apache AXIOM 1.1.1 (September 18, 2006)

+

+http://ws.apache.org/commons/axiom/

+------------------------------------------------------

+

+___________________

+Documentation

+===================

+ 

+Documentation can be found in the 'docs' distribution of this release and in the main site.

+

+___________________

+Support

+===================

+ 

+Any problem with this release can be reported to ws-commons mailing list. 

+If you are sending an email to the mailing list make sure to add the [AXIOM] prefix to the subject.

+

+Mailing list subscription:

+    commons-dev-subscribe@ws.apache.org

+

+Thank you for using AXIOM!

+

+The Apache AXIOM Team.

diff --git a/axiom/RELEASE-NOTE.txt b/axiom/RELEASE-NOTE.txt
new file mode 100644
index 0000000..0f9051b
--- /dev/null
+++ b/axiom/RELEASE-NOTE.txt
@@ -0,0 +1,46 @@
+===========================================

+

+     Apache AXIOM 1.1.1 Release Note

+

+===========================================

+

+http://ws.apache.org/commons/axiom

+

+Note : AXIOM 1.1 release was compiled in JDK1.5. But AXIOM has a minimum requirement for it to have jdk 1.4 compatible

+distributables. This is a minor release, which has all the features in AXIOM 1.1 but compiles with JDK 1.4.

+

+Apache AXIOM is a StAX-based, XML Infoset compliant object model which supports on-demand building

+of the object tree. It supports a novel "pull-through" model which allows one to turn off the tree

+building and directly access the underlying pull event stream. It also has built-in support for XML

+Optimized Packaging (XOP) and MTOM, the combination of which allows XML to carry binary data

+efficiently and in a transparent manner. The combination of these results in a easy to use API with a very

+high performant architecture!

+

+Developed as part of Apache Axis2, Apache AXIOM (AXIs Object Model)is the core of Apache Axis2. However, it is a pure

+standalone XML Infoset model with novel features and can be used independently of Apache Axis2.

+

+Key Features

+============

+

+    * Full XML Infoset compliant XML object model

+    * StAX based builders with on-demand building and pull-through

+    * XOP/MTOM support offering direct binary support

+    * Convenient SOAP Infoset API on top of AXIOM

+    * Two implementations included:

+          o Linked list based implementation

+          o W3C DOM supporting implementation

+    * High performant

+

+What's New in This Release

+==========================

+

+    * Improved XML serialization

+    * DOM Hash implementation

+    * Improved MTOM handling

+    * Improved tree handling with multiple partial built elements

+    * Numerous bug fixes

+

+Thanks for your interest in Apache AXIOM!

+

+

+-The Apache AXIOM Development Team
\ No newline at end of file
diff --git a/axiom/TODO-m2.txt b/axiom/TODO-m2.txt
new file mode 100644
index 0000000..0a7cbf8
--- /dev/null
+++ b/axiom/TODO-m2.txt
@@ -0,0 +1,7 @@
+TODO List for Completing Build with Maven 2:

+============================================

+

+* Create axiom.jar (bundle of axiom-api.jar, axiom-dom.jar and

+  axiom-impl.jar) or decide to drop it.

+* Add LICENSE and NOTICE files to the generated jar files.

+  See http://jira.codehaus.org/browse/MJAR-42.

diff --git a/axiom/legal/activation-LICENSE.txt b/axiom/legal/activation-LICENSE.txt
new file mode 100644
index 0000000..3be7a13
--- /dev/null
+++ b/axiom/legal/activation-LICENSE.txt
@@ -0,0 +1,119 @@
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0

+

+1. Definitions.

+

+1.1. Contributor means each individual or entity that creates or contributes to the creation of Modifications.

+

+1.2. Contributor Version means the combination of the Original Software, prior Modifications used by a Contributor (if any), and the Modifications made by that particular Contributor.

+

+1.3. Covered Software means (a) the Original Software, or (b) Modifications, or (c) the combination of files containing Original Software with files containing Modifications, in each case including portions thereof.

+

+1.4. Executable means the Covered Software in any form other than Source Code.

+

+1.5. Initial Developer means the individual or entity that first makes Original Software available under this License.

+

+1.6. Larger Work means a work which combines Covered Software or portions thereof with code not governed by the terms of this License.

+

+1.7. License means this document.

+

+1.8. Licensable means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein.

+

+1.9. Modifications means the Source Code and Executable form of any of the following:

+

+A. Any file that results from an addition to, deletion from or modification of the contents of a file containing Original Software or previous Modifications;

+

+B. Any new file that contains any part of the Original Software or previous Modification; or

+

+C. Any new file that is contributed or otherwise made available under the terms of this License.

+

+1.10. Original Software means the Source Code and Executable form of computer software code that is originally released under this License.

+

+1.11. Patent Claims means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor.

+

+1.12. Source Code means (a) the common form of computer software code in which modifications are made and (b) associated documentation included in or with such code.

+

+1.13. You (or Your) means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, You includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, control means (a)áthe power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b)áownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.

+

+2. License Grants.

+

+2.1. The Initial Developer Grant.

+Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, the Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license:

+(a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer, to use, reproduce, modify, display, perform, sublicense and distribute the Original Software (or portions thereof), with or without Modifications, and/or as part of a Larger Work; and

+(b) under Patent Claims infringed by the making, using or selling of Original Software, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Software (or portions thereof).

+(c) The licenses granted in Sectionsá2.1(a) and (b) are effective on the date Initial Developer first distributes or otherwise makes the Original Software available to a third party under the terms of this License.

+(d) Notwithstanding Sectioná2.1(b) above, no patent license is granted: (1)áfor code that You delete from the Original Software, or (2)áfor infringements caused by: (i)áthe modification of the Original Software, or (ii)áthe combination of the Original Software with other software or devices.

+

+2.2. Contributor Grant.

+Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license:

+(a) under intellectual property rights (other than patent or trademark) Licensable by Contributor to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof), either on an unmodified basis, with other Modifications, as Covered Software and/or as part of a Larger Work; and

+(b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: (1)áModifications made by that Contributor (or portions thereof); and (2)áthe combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination).

+(c) The licenses granted in Sectionsá2.2(a) and 2.2(b) are effective on the date Contributor first distributes or otherwise makes the Modifications available to a third party.

+(d) Notwithstanding Sectioná2.2(b) above, no patent license is granted: (1)áfor any code that Contributor has deleted from the Contributor Version; (2)áfor infringements caused by: (i)áthird party modifications of Contributor Version, or (ii)áthe combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or (3)áunder Patent Claims infringed by Covered Software in the absence of Modifications made by that Contributor.

+

+3. Distribution Obligations.

+

+3.1. Availability of Source Code.

+

+Any Covered Software that You distribute or otherwise make available in Executable form must also be made available in Source Code form and that Source Code form must be distributed only under the terms of this License. You must include a copy of this License with every copy of the Source Code form of the Covered Software You distribute or otherwise make available. You must inform recipients of any such Covered Software in Executable form as to how they can obtain such Covered Software in Source Code form in a reasonable manner on or through a medium customarily used for software exchange.

+

+3.2. Modifications.

+

+The Modifications that You create or to which You contribute are governed by the terms of this License. You represent that You believe Your Modifications are Your original creation(s) and/or You have sufficient rights to grant the rights conveyed by this License.

+

+3.3. Required Notices.

+You must include a notice in each of Your Modifications that identifies You as the Contributor of the Modification. You may not remove or alter any copyright, patent or trademark notices contained within the Covered Software, or any notices of licensing or any descriptive text giving attribution to any Contributor or the Initial Developer.

+

+3.4. Application of Additional Terms.

+You may not offer or impose any terms on any Covered Software in Source Code form that alters or restricts the applicable version of this License or the recipients rights hereunder. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, you may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear that any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer.

+

+3.5. Distribution of Executable Versions.

+You may distribute the Executable form of the Covered Software under the terms of this License or under the terms of a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable form does not attempt to limit or alter the recipients rights in the Source Code form from the rights set forth in this License. If You distribute the Covered Software in Executable form under a different license, You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer.

+

+3.6. Larger Works.

+You may create a Larger Work by combining Covered Software with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Software.

+

+4. Versions of the License.

+

+4.1. New Versions.

+Sun Microsystems, Inc. is the initial license steward and may publish revised and/or new versions of this License from time to time. Each version will be given a distinguishing version number. Except as provided in Section 4.3, no one other than the license steward has the right to modify this License.

+

+4.2. Effect of New Versions.

+

+You may always continue to use, distribute or otherwise make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. If the Initial Developer includes a notice in the Original Software prohibiting it from being distributed or otherwise made available under any subsequent version of the License, You must distribute and make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. Otherwise, You may also choose to use, distribute or otherwise make the Covered Software available under the terms of any subsequent version of the License published by the license steward.

+4.3. Modified Versions.

+

+When You are an Initial Developer and You want to create a new license for Your Original Software, You may create and use a modified version of this License if You: (a)árename the license and remove any references to the name of the license steward (except to note that the license differs from this License); and (b)áotherwise make it clear that the license contains terms which differ from this License.

+

+5. DISCLAIMER OF WARRANTY.

+

+COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN AS IS BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.

+

+6. TERMINATION.

+

+6.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive.

+

+6.2. If You assert a patent infringement claim (excluding declaratory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You assert such claim is referred to as Participant) alleging that the Participant Software (meaning the Contributor Version where the Participant is a Contributor or the Original Software where the Participant is the Initial Developer) directly or indirectly infringes any patent, then any and all rights granted directly or indirectly to You by such Participant, the Initial Developer (if the Initial Developer is not the Participant) and all Contributors under Sectionsá2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively and automatically at the expiration of such 60 day notice period, unless if within such 60 day period You withdraw Your claim with respect to the Participant Software against such Participant either unilaterally or pursuant to a written agreement with Participant.

+

+6.3. In the event of termination under Sectionsá6.1 or 6.2 above, all end user licenses that have been validly granted by You or any distributor hereunder prior to termination (excluding licenses granted to You by any distributor) shall survive termination.

+

+7. LIMITATION OF LIABILITY.

+

+UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTYS NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.

+

+8. U.S. GOVERNMENT END USERS.

+

+The Covered Software is a commercial item, as that term is defined in 48áC.F.R.á2.101 (Oct. 1995), consisting of commercial computer software (as that term is defined at 48 C.F.R. á252.227-7014(a)(1)) and commercial computer software documentation as such terms are used in 48áC.F.R.á12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Software with only those rights set forth herein. This U.S. Government Rights clause is in lieu of, and supersedes, any other FAR, DFAR, or other clause or provision that addresses Government rights in computer software under this License.

+

+9. MISCELLANEOUS.

+

+This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by the law of the jurisdiction specified in a notice contained within the Original Software (except to the extent applicable law, if any, provides otherwise), excluding such jurisdictions conflict-of-law provisions. Any litigation relating to this License shall be subject to the jurisdiction of the courts located in the jurisdiction and venue specified in a notice contained within the Original Software, with the losing party responsible for costs, including, without limitation, court costs and reasonable attorneys fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. You agree that You alone are responsible for compliance with the United States export administration regulations (and the export control laws and regulation of any other countries) when You use, distribute or otherwise make available any Covered Software.

+

+10. RESPONSIBILITY FOR CLAIMS.

+

+As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability.

+

+NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL)

+The GlassFish code released under the CDDL shall be governed by the laws of the State of California (excluding conflict-of-law provisions). Any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California and the state courts of the State of California, with venue lying in Santa Clara County, California. 

+

+

+

diff --git a/axiom/legal/commons-logging-LICENSE.txt b/axiom/legal/commons-logging-LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/axiom/legal/commons-logging-LICENSE.txt
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+
diff --git a/axiom/legal/jaxen-LICENSE.txt b/axiom/legal/jaxen-LICENSE.txt
new file mode 100644
index 0000000..fef8c29
--- /dev/null
+++ b/axiom/legal/jaxen-LICENSE.txt
@@ -0,0 +1,202 @@
+                                 Apache License

+                           Version 2.0, January 2004

+                        http://www.apache.org/licenses/

+

+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

+

+   1. Definitions.

+

+      "License" shall mean the terms and conditions for use, reproduction,

+      and distribution as defined by Sections 1 through 9 of this document.

+

+      "Licensor" shall mean the copyright owner or entity authorized by

+      the copyright owner that is granting the License.

+

+      "Legal Entity" shall mean the union of the acting entity and all

+      other entities that control, are controlled by, or are under common

+      control with that entity. For the purposes of this definition,

+      "control" means (i) the power, direct or indirect, to cause the

+      direction or management of such entity, whether by contract or

+      otherwise, or (ii) ownership of fifty percent (50%) or more of the

+      outstanding shares, or (iii) beneficial ownership of such entity.

+

+      "You" (or "Your") shall mean an individual or Legal Entity

+      exercising permissions granted by this License.

+

+      "Source" form shall mean the preferred form for making modifications,

+      including but not limited to software source code, documentation

+      source, and configuration files.

+

+      "Object" form shall mean any form resulting from mechanical

+      transformation or translation of a Source form, including but

+      not limited to compiled object code, generated documentation,

+      and conversions to other media types.

+

+      "Work" shall mean the work of authorship, whether in Source or

+      Object form, made available under the License, as indicated by a

+      copyright notice that is included in or attached to the work

+      (an example is provided in the Appendix below).

+

+      "Derivative Works" shall mean any work, whether in Source or Object

+      form, that is based on (or derived from) the Work and for which the

+      editorial revisions, annotations, elaborations, or other modifications

+      represent, as a whole, an original work of authorship. For the purposes

+      of this License, Derivative Works shall not include works that remain

+      separable from, or merely link (or bind by name) to the interfaces of,

+      the Work and Derivative Works thereof.

+

+      "Contribution" shall mean any work of authorship, including

+      the original version of the Work and any modifications or additions

+      to that Work or Derivative Works thereof, that is intentionally

+      submitted to Licensor for inclusion in the Work by the copyright owner

+      or by an individual or Legal Entity authorized to submit on behalf of

+      the copyright owner. For the purposes of this definition, "submitted"

+      means any form of electronic, verbal, or written communication sent

+      to the Licensor or its representatives, including but not limited to

+      communication on electronic mailing lists, source code control systems,

+      and issue tracking systems that are managed by, or on behalf of, the

+      Licensor for the purpose of discussing and improving the Work, but

+      excluding communication that is conspicuously marked or otherwise

+      designated in writing by the copyright owner as "Not a Contribution."

+

+      "Contributor" shall mean Licensor and any individual or Legal Entity

+      on behalf of whom a Contribution has been received by Licensor and

+      subsequently incorporated within the Work.

+

+   2. Grant of Copyright License. Subject to the terms and conditions of

+      this License, each Contributor hereby grants to You a perpetual,

+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable

+      copyright license to reproduce, prepare Derivative Works of,

+      publicly display, publicly perform, sublicense, and distribute the

+      Work and such Derivative Works in Source or Object form.

+

+   3. Grant of Patent License. Subject to the terms and conditions of

+      this License, each Contributor hereby grants to You a perpetual,

+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable

+      (except as stated in this section) patent license to make, have made,

+      use, offer to sell, sell, import, and otherwise transfer the Work,

+      where such license applies only to those patent claims licensable

+      by such Contributor that are necessarily infringed by their

+      Contribution(s) alone or by combination of their Contribution(s)

+      with the Work to which such Contribution(s) was submitted. If You

+      institute patent litigation against any entity (including a

+      cross-claim or counterclaim in a lawsuit) alleging that the Work

+      or a Contribution incorporated within the Work constitutes direct

+      or contributory patent infringement, then any patent licenses

+      granted to You under this License for that Work shall terminate

+      as of the date such litigation is filed.

+

+   4. Redistribution. You may reproduce and distribute copies of the

+      Work or Derivative Works thereof in any medium, with or without

+      modifications, and in Source or Object form, provided that You

+      meet the following conditions:

+

+      (a) You must give any other recipients of the Work or

+          Derivative Works a copy of this License; and

+

+      (b) You must cause any modified files to carry prominent notices

+          stating that You changed the files; and

+

+      (c) You must retain, in the Source form of any Derivative Works

+          that You distribute, all copyright, patent, trademark, and

+          attribution notices from the Source form of the Work,

+          excluding those notices that do not pertain to any part of

+          the Derivative Works; and

+

+      (d) If the Work includes a "NOTICE" text file as part of its

+          distribution, then any Derivative Works that You distribute must

+          include a readable copy of the attribution notices contained

+          within such NOTICE file, excluding those notices that do not

+          pertain to any part of the Derivative Works, in at least one

+          of the following places: within a NOTICE text file distributed

+          as part of the Derivative Works; within the Source form or

+          documentation, if provided along with the Derivative Works; or,

+          within a display generated by the Derivative Works, if and

+          wherever such third-party notices normally appear. The contents

+          of the NOTICE file are for informational purposes only and

+          do not modify the License. You may add Your own attribution

+          notices within Derivative Works that You distribute, alongside

+          or as an addendum to the NOTICE text from the Work, provided

+          that such additional attribution notices cannot be construed

+          as modifying the License.

+

+      You may add Your own copyright statement to Your modifications and

+      may provide additional or different license terms and conditions

+      for use, reproduction, or distribution of Your modifications, or

+      for any such Derivative Works as a whole, provided Your use,

+      reproduction, and distribution of the Work otherwise complies with

+      the conditions stated in this License.

+

+   5. Submission of Contributions. Unless You explicitly state otherwise,

+      any Contribution intentionally submitted for inclusion in the Work

+      by You to the Licensor shall be under the terms and conditions of

+      this License, without any additional terms or conditions.

+      Notwithstanding the above, nothing herein shall supersede or modify

+      the terms of any separate license agreement you may have executed

+      with Licensor regarding such Contributions.

+

+   6. Trademarks. This License does not grant permission to use the trade

+      names, trademarks, service marks, or product names of the Licensor,

+      except as required for reasonable and customary use in describing the

+      origin of the Work and reproducing the content of the NOTICE file.

+

+   7. Disclaimer of Warranty. Unless required by applicable law or

+      agreed to in writing, Licensor provides the Work (and each

+      Contributor provides its Contributions) on an "AS IS" BASIS,

+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or

+      implied, including, without limitation, any warranties or conditions

+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A

+      PARTICULAR PURPOSE. You are solely responsible for determining the

+      appropriateness of using or redistributing the Work and assume any

+      risks associated with Your exercise of permissions under this License.

+

+   8. Limitation of Liability. In no event and under no legal theory,

+      whether in tort (including negligence), contract, or otherwise,

+      unless required by applicable law (such as deliberate and grossly

+      negligent acts) or agreed to in writing, shall any Contributor be

+      liable to You for damages, including any direct, indirect, special,

+      incidental, or consequential damages of any character arising as a

+      result of this License or out of the use or inability to use the

+      Work (including but not limited to damages for loss of goodwill,

+      work stoppage, computer failure or malfunction, or any and all

+      other commercial damages or losses), even if such Contributor

+      has been advised of the possibility of such damages.

+

+   9. Accepting Warranty or Additional Liability. While redistributing

+      the Work or Derivative Works thereof, You may choose to offer,

+      and charge a fee for, acceptance of support, warranty, indemnity,

+      or other liability obligations and/or rights consistent with this

+      License. However, in accepting such obligations, You may act only

+      on Your own behalf and on Your sole responsibility, not on behalf

+      of any other Contributor, and only if You agree to indemnify,

+      defend, and hold each Contributor harmless for any liability

+      incurred by, or claims asserted against, such Contributor by reason

+      of your accepting any such warranty or additional liability.

+

+   END OF TERMS AND CONDITIONS

+

+   APPENDIX: How to apply the Apache License to your work.

+

+      To apply the Apache License to your work, attach the following

+      boilerplate notice, with the fields enclosed by brackets "[]"

+      replaced with your own identifying information. (Don't include

+      the brackets!)  The text should be enclosed in the appropriate

+      comment syntax for the file format. We also recommend that a

+      file or class name and description of purpose be included on the

+      same "printed page" as the copyright notice for easier

+      identification within third-party archives.

+

+   Copyright [yyyy] [name of copyright owner]

+

+   Licensed 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.

+

diff --git a/axiom/legal/log4j-LICENSE.txt b/axiom/legal/log4j-LICENSE.txt
new file mode 100644
index 0000000..fef8c29
--- /dev/null
+++ b/axiom/legal/log4j-LICENSE.txt
@@ -0,0 +1,202 @@
+                                 Apache License

+                           Version 2.0, January 2004

+                        http://www.apache.org/licenses/

+

+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

+

+   1. Definitions.

+

+      "License" shall mean the terms and conditions for use, reproduction,

+      and distribution as defined by Sections 1 through 9 of this document.

+

+      "Licensor" shall mean the copyright owner or entity authorized by

+      the copyright owner that is granting the License.

+

+      "Legal Entity" shall mean the union of the acting entity and all

+      other entities that control, are controlled by, or are under common

+      control with that entity. For the purposes of this definition,

+      "control" means (i) the power, direct or indirect, to cause the

+      direction or management of such entity, whether by contract or

+      otherwise, or (ii) ownership of fifty percent (50%) or more of the

+      outstanding shares, or (iii) beneficial ownership of such entity.

+

+      "You" (or "Your") shall mean an individual or Legal Entity

+      exercising permissions granted by this License.

+

+      "Source" form shall mean the preferred form for making modifications,

+      including but not limited to software source code, documentation

+      source, and configuration files.

+

+      "Object" form shall mean any form resulting from mechanical

+      transformation or translation of a Source form, including but

+      not limited to compiled object code, generated documentation,

+      and conversions to other media types.

+

+      "Work" shall mean the work of authorship, whether in Source or

+      Object form, made available under the License, as indicated by a

+      copyright notice that is included in or attached to the work

+      (an example is provided in the Appendix below).

+

+      "Derivative Works" shall mean any work, whether in Source or Object

+      form, that is based on (or derived from) the Work and for which the

+      editorial revisions, annotations, elaborations, or other modifications

+      represent, as a whole, an original work of authorship. For the purposes

+      of this License, Derivative Works shall not include works that remain

+      separable from, or merely link (or bind by name) to the interfaces of,

+      the Work and Derivative Works thereof.

+

+      "Contribution" shall mean any work of authorship, including

+      the original version of the Work and any modifications or additions

+      to that Work or Derivative Works thereof, that is intentionally

+      submitted to Licensor for inclusion in the Work by the copyright owner

+      or by an individual or Legal Entity authorized to submit on behalf of

+      the copyright owner. For the purposes of this definition, "submitted"

+      means any form of electronic, verbal, or written communication sent

+      to the Licensor or its representatives, including but not limited to

+      communication on electronic mailing lists, source code control systems,

+      and issue tracking systems that are managed by, or on behalf of, the

+      Licensor for the purpose of discussing and improving the Work, but

+      excluding communication that is conspicuously marked or otherwise

+      designated in writing by the copyright owner as "Not a Contribution."

+

+      "Contributor" shall mean Licensor and any individual or Legal Entity

+      on behalf of whom a Contribution has been received by Licensor and

+      subsequently incorporated within the Work.

+

+   2. Grant of Copyright License. Subject to the terms and conditions of

+      this License, each Contributor hereby grants to You a perpetual,

+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable

+      copyright license to reproduce, prepare Derivative Works of,

+      publicly display, publicly perform, sublicense, and distribute the

+      Work and such Derivative Works in Source or Object form.

+

+   3. Grant of Patent License. Subject to the terms and conditions of

+      this License, each Contributor hereby grants to You a perpetual,

+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable

+      (except as stated in this section) patent license to make, have made,

+      use, offer to sell, sell, import, and otherwise transfer the Work,

+      where such license applies only to those patent claims licensable

+      by such Contributor that are necessarily infringed by their

+      Contribution(s) alone or by combination of their Contribution(s)

+      with the Work to which such Contribution(s) was submitted. If You

+      institute patent litigation against any entity (including a

+      cross-claim or counterclaim in a lawsuit) alleging that the Work

+      or a Contribution incorporated within the Work constitutes direct

+      or contributory patent infringement, then any patent licenses

+      granted to You under this License for that Work shall terminate

+      as of the date such litigation is filed.

+

+   4. Redistribution. You may reproduce and distribute copies of the

+      Work or Derivative Works thereof in any medium, with or without

+      modifications, and in Source or Object form, provided that You

+      meet the following conditions:

+

+      (a) You must give any other recipients of the Work or

+          Derivative Works a copy of this License; and

+

+      (b) You must cause any modified files to carry prominent notices

+          stating that You changed the files; and

+

+      (c) You must retain, in the Source form of any Derivative Works

+          that You distribute, all copyright, patent, trademark, and

+          attribution notices from the Source form of the Work,

+          excluding those notices that do not pertain to any part of

+          the Derivative Works; and

+

+      (d) If the Work includes a "NOTICE" text file as part of its

+          distribution, then any Derivative Works that You distribute must

+          include a readable copy of the attribution notices contained

+          within such NOTICE file, excluding those notices that do not

+          pertain to any part of the Derivative Works, in at least one

+          of the following places: within a NOTICE text file distributed

+          as part of the Derivative Works; within the Source form or

+          documentation, if provided along with the Derivative Works; or,

+          within a display generated by the Derivative Works, if and

+          wherever such third-party notices normally appear. The contents

+          of the NOTICE file are for informational purposes only and

+          do not modify the License. You may add Your own attribution

+          notices within Derivative Works that You distribute, alongside

+          or as an addendum to the NOTICE text from the Work, provided

+          that such additional attribution notices cannot be construed

+          as modifying the License.

+

+      You may add Your own copyright statement to Your modifications and

+      may provide additional or different license terms and conditions

+      for use, reproduction, or distribution of Your modifications, or

+      for any such Derivative Works as a whole, provided Your use,

+      reproduction, and distribution of the Work otherwise complies with

+      the conditions stated in this License.

+

+   5. Submission of Contributions. Unless You explicitly state otherwise,

+      any Contribution intentionally submitted for inclusion in the Work

+      by You to the Licensor shall be under the terms and conditions of

+      this License, without any additional terms or conditions.

+      Notwithstanding the above, nothing herein shall supersede or modify

+      the terms of any separate license agreement you may have executed

+      with Licensor regarding such Contributions.

+

+   6. Trademarks. This License does not grant permission to use the trade

+      names, trademarks, service marks, or product names of the Licensor,

+      except as required for reasonable and customary use in describing the

+      origin of the Work and reproducing the content of the NOTICE file.

+

+   7. Disclaimer of Warranty. Unless required by applicable law or

+      agreed to in writing, Licensor provides the Work (and each

+      Contributor provides its Contributions) on an "AS IS" BASIS,

+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or

+      implied, including, without limitation, any warranties or conditions

+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A

+      PARTICULAR PURPOSE. You are solely responsible for determining the

+      appropriateness of using or redistributing the Work and assume any

+      risks associated with Your exercise of permissions under this License.

+

+   8. Limitation of Liability. In no event and under no legal theory,

+      whether in tort (including negligence), contract, or otherwise,

+      unless required by applicable law (such as deliberate and grossly

+      negligent acts) or agreed to in writing, shall any Contributor be

+      liable to You for damages, including any direct, indirect, special,

+      incidental, or consequential damages of any character arising as a

+      result of this License or out of the use or inability to use the

+      Work (including but not limited to damages for loss of goodwill,

+      work stoppage, computer failure or malfunction, or any and all

+      other commercial damages or losses), even if such Contributor

+      has been advised of the possibility of such damages.

+

+   9. Accepting Warranty or Additional Liability. While redistributing

+      the Work or Derivative Works thereof, You may choose to offer,

+      and charge a fee for, acceptance of support, warranty, indemnity,

+      or other liability obligations and/or rights consistent with this

+      License. However, in accepting such obligations, You may act only

+      on Your own behalf and on Your sole responsibility, not on behalf

+      of any other Contributor, and only if You agree to indemnify,

+      defend, and hold each Contributor harmless for any liability

+      incurred by, or claims asserted against, such Contributor by reason

+      of your accepting any such warranty or additional liability.

+

+   END OF TERMS AND CONDITIONS

+

+   APPENDIX: How to apply the Apache License to your work.

+

+      To apply the Apache License to your work, attach the following

+      boilerplate notice, with the fields enclosed by brackets "[]"

+      replaced with your own identifying information. (Don't include

+      the brackets!)  The text should be enclosed in the appropriate

+      comment syntax for the file format. We also recommend that a

+      file or class name and description of purpose be included on the

+      same "printed page" as the copyright notice for easier

+      identification within third-party archives.

+

+   Copyright [yyyy] [name of copyright owner]

+

+   Licensed 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.

+

diff --git a/axiom/legal/mail-LICENSE.txt b/axiom/legal/mail-LICENSE.txt
new file mode 100644
index 0000000..3be7a13
--- /dev/null
+++ b/axiom/legal/mail-LICENSE.txt
@@ -0,0 +1,119 @@
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0

+

+1. Definitions.

+

+1.1. Contributor means each individual or entity that creates or contributes to the creation of Modifications.

+

+1.2. Contributor Version means the combination of the Original Software, prior Modifications used by a Contributor (if any), and the Modifications made by that particular Contributor.

+

+1.3. Covered Software means (a) the Original Software, or (b) Modifications, or (c) the combination of files containing Original Software with files containing Modifications, in each case including portions thereof.

+

+1.4. Executable means the Covered Software in any form other than Source Code.

+

+1.5. Initial Developer means the individual or entity that first makes Original Software available under this License.

+

+1.6. Larger Work means a work which combines Covered Software or portions thereof with code not governed by the terms of this License.

+

+1.7. License means this document.

+

+1.8. Licensable means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein.

+

+1.9. Modifications means the Source Code and Executable form of any of the following:

+

+A. Any file that results from an addition to, deletion from or modification of the contents of a file containing Original Software or previous Modifications;

+

+B. Any new file that contains any part of the Original Software or previous Modification; or

+

+C. Any new file that is contributed or otherwise made available under the terms of this License.

+

+1.10. Original Software means the Source Code and Executable form of computer software code that is originally released under this License.

+

+1.11. Patent Claims means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor.

+

+1.12. Source Code means (a) the common form of computer software code in which modifications are made and (b) associated documentation included in or with such code.

+

+1.13. You (or Your) means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, You includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, control means (a)áthe power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b)áownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.

+

+2. License Grants.

+

+2.1. The Initial Developer Grant.

+Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, the Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license:

+(a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer, to use, reproduce, modify, display, perform, sublicense and distribute the Original Software (or portions thereof), with or without Modifications, and/or as part of a Larger Work; and

+(b) under Patent Claims infringed by the making, using or selling of Original Software, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Software (or portions thereof).

+(c) The licenses granted in Sectionsá2.1(a) and (b) are effective on the date Initial Developer first distributes or otherwise makes the Original Software available to a third party under the terms of this License.

+(d) Notwithstanding Sectioná2.1(b) above, no patent license is granted: (1)áfor code that You delete from the Original Software, or (2)áfor infringements caused by: (i)áthe modification of the Original Software, or (ii)áthe combination of the Original Software with other software or devices.

+

+2.2. Contributor Grant.

+Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license:

+(a) under intellectual property rights (other than patent or trademark) Licensable by Contributor to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof), either on an unmodified basis, with other Modifications, as Covered Software and/or as part of a Larger Work; and

+(b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: (1)áModifications made by that Contributor (or portions thereof); and (2)áthe combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination).

+(c) The licenses granted in Sectionsá2.2(a) and 2.2(b) are effective on the date Contributor first distributes or otherwise makes the Modifications available to a third party.

+(d) Notwithstanding Sectioná2.2(b) above, no patent license is granted: (1)áfor any code that Contributor has deleted from the Contributor Version; (2)áfor infringements caused by: (i)áthird party modifications of Contributor Version, or (ii)áthe combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or (3)áunder Patent Claims infringed by Covered Software in the absence of Modifications made by that Contributor.

+

+3. Distribution Obligations.

+

+3.1. Availability of Source Code.

+

+Any Covered Software that You distribute or otherwise make available in Executable form must also be made available in Source Code form and that Source Code form must be distributed only under the terms of this License. You must include a copy of this License with every copy of the Source Code form of the Covered Software You distribute or otherwise make available. You must inform recipients of any such Covered Software in Executable form as to how they can obtain such Covered Software in Source Code form in a reasonable manner on or through a medium customarily used for software exchange.

+

+3.2. Modifications.

+

+The Modifications that You create or to which You contribute are governed by the terms of this License. You represent that You believe Your Modifications are Your original creation(s) and/or You have sufficient rights to grant the rights conveyed by this License.

+

+3.3. Required Notices.

+You must include a notice in each of Your Modifications that identifies You as the Contributor of the Modification. You may not remove or alter any copyright, patent or trademark notices contained within the Covered Software, or any notices of licensing or any descriptive text giving attribution to any Contributor or the Initial Developer.

+

+3.4. Application of Additional Terms.

+You may not offer or impose any terms on any Covered Software in Source Code form that alters or restricts the applicable version of this License or the recipients rights hereunder. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, you may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear that any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer.

+

+3.5. Distribution of Executable Versions.

+You may distribute the Executable form of the Covered Software under the terms of this License or under the terms of a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable form does not attempt to limit or alter the recipients rights in the Source Code form from the rights set forth in this License. If You distribute the Covered Software in Executable form under a different license, You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer.

+

+3.6. Larger Works.

+You may create a Larger Work by combining Covered Software with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Software.

+

+4. Versions of the License.

+

+4.1. New Versions.

+Sun Microsystems, Inc. is the initial license steward and may publish revised and/or new versions of this License from time to time. Each version will be given a distinguishing version number. Except as provided in Section 4.3, no one other than the license steward has the right to modify this License.

+

+4.2. Effect of New Versions.

+

+You may always continue to use, distribute or otherwise make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. If the Initial Developer includes a notice in the Original Software prohibiting it from being distributed or otherwise made available under any subsequent version of the License, You must distribute and make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. Otherwise, You may also choose to use, distribute or otherwise make the Covered Software available under the terms of any subsequent version of the License published by the license steward.

+4.3. Modified Versions.

+

+When You are an Initial Developer and You want to create a new license for Your Original Software, You may create and use a modified version of this License if You: (a)árename the license and remove any references to the name of the license steward (except to note that the license differs from this License); and (b)áotherwise make it clear that the license contains terms which differ from this License.

+

+5. DISCLAIMER OF WARRANTY.

+

+COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN AS IS BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.

+

+6. TERMINATION.

+

+6.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive.

+

+6.2. If You assert a patent infringement claim (excluding declaratory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You assert such claim is referred to as Participant) alleging that the Participant Software (meaning the Contributor Version where the Participant is a Contributor or the Original Software where the Participant is the Initial Developer) directly or indirectly infringes any patent, then any and all rights granted directly or indirectly to You by such Participant, the Initial Developer (if the Initial Developer is not the Participant) and all Contributors under Sectionsá2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively and automatically at the expiration of such 60 day notice period, unless if within such 60 day period You withdraw Your claim with respect to the Participant Software against such Participant either unilaterally or pursuant to a written agreement with Participant.

+

+6.3. In the event of termination under Sectionsá6.1 or 6.2 above, all end user licenses that have been validly granted by You or any distributor hereunder prior to termination (excluding licenses granted to You by any distributor) shall survive termination.

+

+7. LIMITATION OF LIABILITY.

+

+UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTYS NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.

+

+8. U.S. GOVERNMENT END USERS.

+

+The Covered Software is a commercial item, as that term is defined in 48áC.F.R.á2.101 (Oct. 1995), consisting of commercial computer software (as that term is defined at 48 C.F.R. á252.227-7014(a)(1)) and commercial computer software documentation as such terms are used in 48áC.F.R.á12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Software with only those rights set forth herein. This U.S. Government Rights clause is in lieu of, and supersedes, any other FAR, DFAR, or other clause or provision that addresses Government rights in computer software under this License.

+

+9. MISCELLANEOUS.

+

+This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by the law of the jurisdiction specified in a notice contained within the Original Software (except to the extent applicable law, if any, provides otherwise), excluding such jurisdictions conflict-of-law provisions. Any litigation relating to this License shall be subject to the jurisdiction of the courts located in the jurisdiction and venue specified in a notice contained within the Original Software, with the losing party responsible for costs, including, without limitation, court costs and reasonable attorneys fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. You agree that You alone are responsible for compliance with the United States export administration regulations (and the export control laws and regulation of any other countries) when You use, distribute or otherwise make available any Covered Software.

+

+10. RESPONSIBILITY FOR CLAIMS.

+

+As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability.

+

+NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL)

+The GlassFish code released under the CDDL shall be governed by the laws of the State of California (excluding conflict-of-law provisions). Any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California and the state courts of the State of California, with venue lying in Santa Clara County, California. 

+

+

+

diff --git a/axiom/legal/stax-api-LICENSE.txt b/axiom/legal/stax-api-LICENSE.txt
new file mode 100644
index 0000000..fef8c29
--- /dev/null
+++ b/axiom/legal/stax-api-LICENSE.txt
@@ -0,0 +1,202 @@
+                                 Apache License

+                           Version 2.0, January 2004

+                        http://www.apache.org/licenses/

+

+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

+

+   1. Definitions.

+

+      "License" shall mean the terms and conditions for use, reproduction,

+      and distribution as defined by Sections 1 through 9 of this document.

+

+      "Licensor" shall mean the copyright owner or entity authorized by

+      the copyright owner that is granting the License.

+

+      "Legal Entity" shall mean the union of the acting entity and all

+      other entities that control, are controlled by, or are under common

+      control with that entity. For the purposes of this definition,

+      "control" means (i) the power, direct or indirect, to cause the

+      direction or management of such entity, whether by contract or

+      otherwise, or (ii) ownership of fifty percent (50%) or more of the

+      outstanding shares, or (iii) beneficial ownership of such entity.

+

+      "You" (or "Your") shall mean an individual or Legal Entity

+      exercising permissions granted by this License.

+

+      "Source" form shall mean the preferred form for making modifications,

+      including but not limited to software source code, documentation

+      source, and configuration files.

+

+      "Object" form shall mean any form resulting from mechanical

+      transformation or translation of a Source form, including but

+      not limited to compiled object code, generated documentation,

+      and conversions to other media types.

+

+      "Work" shall mean the work of authorship, whether in Source or

+      Object form, made available under the License, as indicated by a

+      copyright notice that is included in or attached to the work

+      (an example is provided in the Appendix below).

+

+      "Derivative Works" shall mean any work, whether in Source or Object

+      form, that is based on (or derived from) the Work and for which the

+      editorial revisions, annotations, elaborations, or other modifications

+      represent, as a whole, an original work of authorship. For the purposes

+      of this License, Derivative Works shall not include works that remain

+      separable from, or merely link (or bind by name) to the interfaces of,

+      the Work and Derivative Works thereof.

+

+      "Contribution" shall mean any work of authorship, including

+      the original version of the Work and any modifications or additions

+      to that Work or Derivative Works thereof, that is intentionally

+      submitted to Licensor for inclusion in the Work by the copyright owner

+      or by an individual or Legal Entity authorized to submit on behalf of

+      the copyright owner. For the purposes of this definition, "submitted"

+      means any form of electronic, verbal, or written communication sent

+      to the Licensor or its representatives, including but not limited to

+      communication on electronic mailing lists, source code control systems,

+      and issue tracking systems that are managed by, or on behalf of, the

+      Licensor for the purpose of discussing and improving the Work, but

+      excluding communication that is conspicuously marked or otherwise

+      designated in writing by the copyright owner as "Not a Contribution."

+

+      "Contributor" shall mean Licensor and any individual or Legal Entity

+      on behalf of whom a Contribution has been received by Licensor and

+      subsequently incorporated within the Work.

+

+   2. Grant of Copyright License. Subject to the terms and conditions of

+      this License, each Contributor hereby grants to You a perpetual,

+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable

+      copyright license to reproduce, prepare Derivative Works of,

+      publicly display, publicly perform, sublicense, and distribute the

+      Work and such Derivative Works in Source or Object form.

+

+   3. Grant of Patent License. Subject to the terms and conditions of

+      this License, each Contributor hereby grants to You a perpetual,

+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable

+      (except as stated in this section) patent license to make, have made,

+      use, offer to sell, sell, import, and otherwise transfer the Work,

+      where such license applies only to those patent claims licensable

+      by such Contributor that are necessarily infringed by their

+      Contribution(s) alone or by combination of their Contribution(s)

+      with the Work to which such Contribution(s) was submitted. If You

+      institute patent litigation against any entity (including a

+      cross-claim or counterclaim in a lawsuit) alleging that the Work

+      or a Contribution incorporated within the Work constitutes direct

+      or contributory patent infringement, then any patent licenses

+      granted to You under this License for that Work shall terminate

+      as of the date such litigation is filed.

+

+   4. Redistribution. You may reproduce and distribute copies of the

+      Work or Derivative Works thereof in any medium, with or without

+      modifications, and in Source or Object form, provided that You

+      meet the following conditions:

+

+      (a) You must give any other recipients of the Work or

+          Derivative Works a copy of this License; and

+

+      (b) You must cause any modified files to carry prominent notices

+          stating that You changed the files; and

+

+      (c) You must retain, in the Source form of any Derivative Works

+          that You distribute, all copyright, patent, trademark, and

+          attribution notices from the Source form of the Work,

+          excluding those notices that do not pertain to any part of

+          the Derivative Works; and

+

+      (d) If the Work includes a "NOTICE" text file as part of its

+          distribution, then any Derivative Works that You distribute must

+          include a readable copy of the attribution notices contained

+          within such NOTICE file, excluding those notices that do not

+          pertain to any part of the Derivative Works, in at least one

+          of the following places: within a NOTICE text file distributed

+          as part of the Derivative Works; within the Source form or

+          documentation, if provided along with the Derivative Works; or,

+          within a display generated by the Derivative Works, if and

+          wherever such third-party notices normally appear. The contents

+          of the NOTICE file are for informational purposes only and

+          do not modify the License. You may add Your own attribution

+          notices within Derivative Works that You distribute, alongside

+          or as an addendum to the NOTICE text from the Work, provided

+          that such additional attribution notices cannot be construed

+          as modifying the License.

+

+      You may add Your own copyright statement to Your modifications and

+      may provide additional or different license terms and conditions

+      for use, reproduction, or distribution of Your modifications, or

+      for any such Derivative Works as a whole, provided Your use,

+      reproduction, and distribution of the Work otherwise complies with

+      the conditions stated in this License.

+

+   5. Submission of Contributions. Unless You explicitly state otherwise,

+      any Contribution intentionally submitted for inclusion in the Work

+      by You to the Licensor shall be under the terms and conditions of

+      this License, without any additional terms or conditions.

+      Notwithstanding the above, nothing herein shall supersede or modify

+      the terms of any separate license agreement you may have executed

+      with Licensor regarding such Contributions.

+

+   6. Trademarks. This License does not grant permission to use the trade

+      names, trademarks, service marks, or product names of the Licensor,

+      except as required for reasonable and customary use in describing the

+      origin of the Work and reproducing the content of the NOTICE file.

+

+   7. Disclaimer of Warranty. Unless required by applicable law or

+      agreed to in writing, Licensor provides the Work (and each

+      Contributor provides its Contributions) on an "AS IS" BASIS,

+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or

+      implied, including, without limitation, any warranties or conditions

+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A

+      PARTICULAR PURPOSE. You are solely responsible for determining the

+      appropriateness of using or redistributing the Work and assume any

+      risks associated with Your exercise of permissions under this License.

+

+   8. Limitation of Liability. In no event and under no legal theory,

+      whether in tort (including negligence), contract, or otherwise,

+      unless required by applicable law (such as deliberate and grossly

+      negligent acts) or agreed to in writing, shall any Contributor be

+      liable to You for damages, including any direct, indirect, special,

+      incidental, or consequential damages of any character arising as a

+      result of this License or out of the use or inability to use the

+      Work (including but not limited to damages for loss of goodwill,

+      work stoppage, computer failure or malfunction, or any and all

+      other commercial damages or losses), even if such Contributor

+      has been advised of the possibility of such damages.

+

+   9. Accepting Warranty or Additional Liability. While redistributing

+      the Work or Derivative Works thereof, You may choose to offer,

+      and charge a fee for, acceptance of support, warranty, indemnity,

+      or other liability obligations and/or rights consistent with this

+      License. However, in accepting such obligations, You may act only

+      on Your own behalf and on Your sole responsibility, not on behalf

+      of any other Contributor, and only if You agree to indemnify,

+      defend, and hold each Contributor harmless for any liability

+      incurred by, or claims asserted against, such Contributor by reason

+      of your accepting any such warranty or additional liability.

+

+   END OF TERMS AND CONDITIONS

+

+   APPENDIX: How to apply the Apache License to your work.

+

+      To apply the Apache License to your work, attach the following

+      boilerplate notice, with the fields enclosed by brackets "[]"

+      replaced with your own identifying information. (Don't include

+      the brackets!)  The text should be enclosed in the appropriate

+      comment syntax for the file format. We also recommend that a

+      file or class name and description of purpose be included on the

+      same "printed page" as the copyright notice for easier

+      identification within third-party archives.

+

+   Copyright [yyyy] [name of copyright owner]

+

+   Licensed 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.

+

diff --git a/axiom/legal/wstx-LICENSE.txt b/axiom/legal/wstx-LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/axiom/legal/wstx-LICENSE.txt
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+
diff --git a/axiom/legal/xml-apis-LICENSE.txt b/axiom/legal/xml-apis-LICENSE.txt
new file mode 100644
index 0000000..57bc88a
--- /dev/null
+++ b/axiom/legal/xml-apis-LICENSE.txt
@@ -0,0 +1,202 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+
diff --git a/axiom/maven.xml b/axiom/maven.xml
new file mode 100644
index 0000000..b9b983d
--- /dev/null
+++ b/axiom/maven.xml
@@ -0,0 +1,241 @@
+<?xml version="1.0" encoding="UTF-8"?>

+

+<!-- $Revision: 1.21 $ $Date: 2004-10-27 20:54:09 +0600 (Wed, 27 Oct 2004) $ -->

+

+<project default="jar"

+         xmlns:j="jelly:core"

+         xmlns:u="jelly:util"

+         xmlns:maven="jelly:maven"

+         xmlns:util="jelly:util"

+         xmlns:deploy="deploy"

+         xmlns:ant="jelly:ant">

+

+        <preGoal name="itest:compile">

+        <u:file var="file" name="${maven.itest.src}"/>

+        <j:if test="${!file.exists()}">

+            <j:expr value="${context.setVariable('maven.itest.skip', 'true')}"/>

+        </j:if>

+    </preGoal>

+

+    <preGoal name="test:test">

+        <copy todir="test-resources">

+            <fileset dir="modules/axiom-tests/test-resources"/>

+        </copy>

+    </preGoal>

+

+    <postGoal name="test:test">

+        <delete dir="test-resources"/>

+    </postGoal>

+

+    <postGoal name="java:compile">

+        <javac destdir="${basedir}/target/classes/" srcdir="${basedir}/modules"

+               debug="true"

+               source="1.3"

+               classpathref="maven.dependency.classpath">

+            <include name="axiom-api/src/**/*.java"/>

+            <include name="axiom-dom/src/**/*.java"/>

+            <include name="axiom-impl/src/**/*.java"/>

+        </javac>

+    </postGoal>

+

+    <postGoal name="jar">

+        <mkdir dir="target/classes/META-INF"/>

+        <jar destfile="target/axiom-api-${axiom.version}.jar">

+            <ant:fileset dir="target/classes">

+                <ant:exclude name="org/apache/axiom/soap/impl/llom/**"/>

+                <ant:exclude name="org/apache/axiom/om/impl/llom/**"/>

+                <ant:exclude name="org/apache/axiom/soap/impl/dom/**"/>

+                <ant:exclude name="org/apache/axiom/om/impl/dom/**"/>

+                <ant:include name="org/**"/>

+            </ant:fileset>

+            <ant:fileset dir="${basedir}">

+                <ant:include name="LICENSE.txt"/>

+                <ant:include name="NOTICE.txt"/>

+            </ant:fileset>

+        </jar>

+        <jar destfile="target/axiom-impl-${axiom.version}.jar">

+            <ant:fileset dir="target/classes">

+                <ant:include name="org/apache/axiom/soap/impl/llom/**"/>

+                <ant:include name="org/apache/axiom/om/impl/llom/**"/>

+            </ant:fileset>

+            <ant:fileset dir="${basedir}">

+                <ant:include name="LICENSE.txt"/>

+                <ant:include name="NOTICE.txt"/>

+            </ant:fileset>

+        </jar>

+        <jar destfile="target/axiom-dom-${axiom.version}.jar">

+            <ant:fileset dir="target/classes">

+                <ant:include name="org/apache/axiom/soap/impl/dom/**"/>

+                <ant:include name="org/apache/axiom/om/impl/dom/**"/>

+            </ant:fileset>

+            <ant:fileset dir="${basedir}">

+                <ant:include name="LICENSE.txt"/>

+                <ant:include name="NOTICE.txt"/>

+            </ant:fileset>

+        </jar>

+        <ant:copy toDir="${maven.repo.local}/ws-commons/jars">

+            <ant:fileset file="target/axiom-api-${axiom.version}.jar"/>

+            <ant:fileset file="target/axiom-impl-${axiom.version}.jar"/>

+            <ant:fileset file="target/axiom-dom-${axiom.version}.jar"/>

+        </ant:copy>

+

+    </postGoal>

+

+    <goal name="jar">

+        <attainGoal name="jar:install"/>

+

+    </goal>

+

+    <goal name="release" prereqs="dist-bin,dist-src">

+

+

+    </goal>

+

+    <goal name="dist-bin" prereqs="jar">

+

+        <ant:echo>+----------------------------------------------</ant:echo>

+        <ant:echo>| Creating: Axiom Binary Distribution</ant:echo>

+        <ant:echo>+----------------------------------------------</ant:echo>

+

+

+        <property name="dist" value="target/dist/temp"/>

+

+        <mkdir dir="${dist}"/>

+        <mkdir dir="${dist}/apidocs"/>

+        <mkdir dir="${dist}/build"/>

+        <mkdir dir="${dist}/lib"/>

+

+        <!--copy dependent jars-->

+        <maven:reactor basedir="${basedir}"

+                       postProcessing="true"

+                       includes="project.xml"

+                       banner="Executing (${goals}):"

+                       ignoreFailures="false"/>

+        <j:forEach var="x" items="${reactorProjects}">

+            <ant:echo message="Copying ${x} to ${dist}"/>

+            <deploy:copy-deps todir="${dist}/lib"

+                              projectDescriptor="${x.getFile()}"/>

+        </j:forEach>

+        <ant:delete file="${dist}/lib/xmlunit-${xmlunit.version}.jar"/>

+

+        <!--Add the licenses of jars-->

+        <ant:copy toDir="${dist}/lib">

+            <ant:fileset dir="legal"/>

+        </ant:copy>

+

+        <!--add api docs-->

+

+        <ant:javadoc packagenames="org.apache.axiom.*"

+                     defaultexcludes="yes"

+                     destdir="${dist}/apidocs"

+                     author="true"

+                     breakiterator="true"

+                     version="true"

+                     use="true"

+                     windowtitle="AXIOM API">

+            <ant:arg

+                    line="-J-Dhttp.proxy.port=${maven.proxy.port} -J-Dhttp.proxy.host=${maven.proxy.host}"/>

+

+            <ant:sourcepath>

+                <ant:pathelement location="modules/axiom-impl/src/main/java"/>

+                <ant:pathelement location="modules/axiom-dom/src/main/java"/>

+                <ant:pathelement location="modules/axiom-api/src/main/java"/>

+            </ant:sourcepath>

+            <ant:classpath>

+                <ant:fileset dir="${dist}/lib">

+                    <ant:include name="*.jar"/>

+                </ant:fileset>

+            </ant:classpath>

+        </ant:javadoc>

+

+        <!--add jars-->

+        <ant:copy toDir="${dist}/build">

+            <ant:fileset file="target/axiom-api-${axiom.version}.jar"/>

+            <ant:fileset file="target/axiom-impl-${axiom.version}.jar"/>

+            <ant:fileset file="target/axiom-dom-${axiom.version}.jar"/>

+        </ant:copy>

+

+        <!--add documents-->

+        <ant:copy toDir="${dist}/docs">

+            <ant:fileset dir="src/site">

+                <ant:exclude name="**/.svn/**"/>

+                <ant:include name="resources/*"/>

+                <ant:include name="xdoc/**/*"/>

+            </ant:fileset>

+        </ant:copy>

+

+        <!--copy release notes, etc-->

+        <ant:copy toDir="${dist}">

+            <ant:fileset file="RELEASE-NOTE.txt"/>

+            <ant:fileset file="README.txt"/>

+            <ant:fileset file="NOTICE.txt"/>

+            <ant:fileset file="LICENSE.txt"/>

+        </ant:copy>

+

+

+        <!--create the zip-->

+        <ant:zip file="target/dist/axiom-${axiom.version}-bin.zip">

+            <ant:fileset dir="${dist}/"/>

+        </ant:zip>

+

+        <ant:delete dir="${dist}"/>

+

+    </goal>

+

+    <goal name="dist-src" prereqs="jar">

+

+        <ant:echo>+----------------------------------------------</ant:echo>

+        <ant:echo>| Creating: Axiom Source Distribution</ant:echo>

+        <ant:echo>+----------------------------------------------</ant:echo>

+

+        <ant:property name="${dist}" value="target/dist/temp"/>

+

+        <ant:copy toDir="${dist}">

+            <ant:fileset dir=".">

+                <ant:exclude name="**/.svn/**"/>

+                <ant:exclude name="**/target/**"/>

+                <ant:include name="**/src/**"/>

+                <ant:include name="**/test/**"/>

+                <ant:include name="**/test-resources/**/*.*"/>

+                <ant:include name="**/pom.xml"/>

+            </ant:fileset>

+        </ant:copy>

+

+        <!-- Copy the master maven files for the standard src distro -->

+        <ant:copy toDir="${dist}">

+            <ant:fileset file="maven.xml"/>

+            <ant:fileset file="project.xml"/>

+            <ant:fileset file="project.properties"/>

+            <ant:fileset file="pom.xml"/>

+            <ant:fileset file="RELEASE-NOTE.txt"/>

+            <ant:fileset file="NOTICE.txt"/>

+            <ant:fileset file="LICENSE.txt"/>

+        </ant:copy>

+

+        <ant:zip file="target/dist/axiom-${axiom.version}-src.zip">

+            <ant:fileset dir="${dist}/"/>

+        </ant:zip>

+        <ant:delete dir="${dist}"/>

+    </goal>

+

+    <goal name="javadocs">

+

+        <mkdir dir="target/apidocs"/>

+

+        <ant:javadoc packagenames="org.apache.axiom.*"

+                     defaultexcludes="yes"

+                     destdir="target/apidocs"

+                     author="true"

+                     breakiterator="true"

+                     version="true"

+                     use="true"

+                     windowtitle="AXIOM API">

+            <ant:arg

+                    line="-J-Dhttp.proxy.port=${maven.proxy.port} -J-Dhttp.proxy.host=${maven.proxy.host}"/>

+            <ant:sourcepath>

+                <ant:pathelement location="src"/>

+            </ant:sourcepath>

+        </ant:javadoc>

+    </goal>

+

+</project>

diff --git a/axiom/modules/axiom-api/pom.xml b/axiom/modules/axiom-api/pom.xml
new file mode 100644
index 0000000..e564350
--- /dev/null
+++ b/axiom/modules/axiom-api/pom.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+    xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.ws.commons.axiom</groupId>
+    <artifactId>axiom-parent</artifactId>
+    <version>SNAPSHOT</version> <!-- Should better be ${axiom.version} -->
+  </parent>
+  <artifactId>axiom-api</artifactId>
+  <name>Axiom API</name>
+  <description>The Axiom API</description>
+  <dependencies>
+    <dependency>
+      <groupId>javax.mail</groupId>
+      <artifactId>mail</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>jaxen</groupId>
+      <artifactId>jaxen</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>xml-apis</groupId>
+      <artifactId>xml-apis</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>stax</groupId>
+      <artifactId>stax-api</artifactId>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java
new file mode 100644
index 0000000..b54d8ea
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java
@@ -0,0 +1,499 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.attachments;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PushbackInputStream;
+import java.util.Set;
+import java.util.TreeMap;
+
+import javax.activation.DataHandler;
+import javax.mail.MessagingException;
+import javax.mail.internet.ContentType;
+import javax.mail.internet.ParseException;
+
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.impl.MTOMConstants;
+import org.apache.axiom.om.util.UUIDGenerator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class Attachments {
+
+    /**
+     * <code>ContentType</code> of the MIME message
+     */
+    ContentType contentType;
+
+    /**
+     * Mime <code>boundary</code> which separates mime parts
+     */
+    byte[] boundary;
+
+    /**
+     * <code>applicationType</code> used to distinguish between MTOM & SWA If
+     * the message is MTOM optimised type is application/xop+xml If the message
+     * is SWA, type is ??have to find out
+     */
+    String applicationType;
+
+    /**
+     * <code>pushbackInStream</code> stores the reference to the incoming
+     * stream A PushbackStream has the ability to "push back" or "unread" one
+     * byte.
+     */
+    PushbackInputStream pushbackInStream;
+
+    /**
+     * <code>attachmentsMap</code> stores the Data Handlers of the already parsed Mime Body
+     * Parts. This ordered Map is keyed using the content-ID's. 
+     */
+    TreeMap attachmentsMap;
+    
+    /**
+     * <code>partIndex</code>- Number of Mime parts parsed
+     */
+    int partIndex = 0;
+    
+    /** Container to hold streams for direct access */
+    IncomingAttachmentStreams streams = null;
+    
+    /** <code>boolean</code> Indicating if any streams have been directly requested */
+    private boolean streamsRequested = false;
+    
+    /** <code>boolean</code> Indicating if any data handlers have been directly requested */
+    private boolean partsRequested = false;
+
+    /**
+     * <code>endOfStreamReached</code> flag which is to be set by
+     * MIMEBodyPartStream when MIME message terminator is found.
+     */
+    private boolean endOfStreamReached;
+    
+    
+    /**
+	 * <code>noStreams</code> flag which is to be set when this class is
+	 * instantiated by the SwA API to handle programatic added attachements. An
+	 * InputStream with attachments is not present at that occation.
+	 */
+    private boolean noStreams = false;
+
+    private String firstPartId;
+
+    private boolean fileCacheEnable;
+
+    private String attachmentRepoDir;
+
+    private int fileStorageThreshold;
+
+    protected Log log = LogFactory.getLog(getClass());
+
+
+    /**
+     * Moves the pointer to the beginning of the first MIME part. Reads
+     * till first MIME boundary is found or end of stream is reached.
+     *
+     * @param inStream
+     * @param contentTypeString
+     * @param fileCacheEnable
+     * @param attachmentRepoDir
+     * @throws OMException
+     */
+    public Attachments(InputStream inStream, String contentTypeString,
+                       boolean fileCacheEnable, String attachmentRepoDir,
+                       String fileThreshold) throws OMException {
+        this.attachmentRepoDir = attachmentRepoDir;
+        this.fileCacheEnable = fileCacheEnable;
+        if (fileThreshold != null && (!"".equals(fileThreshold))) {
+            this.fileStorageThreshold = Integer.parseInt(fileThreshold);
+        } else {
+            this.fileStorageThreshold = 1;
+        }
+        attachmentsMap = new TreeMap();
+        try {
+            contentType = new ContentType(contentTypeString);
+        } catch (ParseException e) {
+            throw new OMException(
+                    "Invalid Content Type Field in the Mime Message"
+                    , e);
+        }
+        // Boundary always have the prefix "--".
+        this.boundary = ("--" + contentType.getParameter("boundary"))
+                .getBytes();
+
+        // do we need to wrap InputStream from a BufferedInputStream before
+        // wrapping from PushbackStream
+        pushbackInStream = new PushbackInputStream(inStream,
+                                                   (this.boundary.length + 2));
+
+        // Move the read pointer to the beginning of the first part
+        // read till the end of first boundary
+        while (true) {
+            int value;
+            try {
+                value = pushbackInStream.read();
+                if ((byte) value == boundary[0]) {
+                    int boundaryIndex = 0;
+                    while ((boundaryIndex < boundary.length)
+                           && ((byte) value == boundary[boundaryIndex])) {
+                        value = pushbackInStream.read();
+                        if (value == -1) {
+                            throw new OMException(
+                                    "Unexpected End of Stream while searching for first Mime Boundary");
+                        }
+                        boundaryIndex++;
+                    }
+                    if (boundaryIndex == boundary.length) { // boundary found
+                        pushbackInStream.read();
+                        break;
+                    }
+                } else if ((byte) value == -1) {
+                    throw new OMException(
+                            "Mime parts not found. Stream ended while searching for the boundary");
+                }
+            } catch (IOException e1) {
+                throw new OMException("Stream Error" + e1.toString(), e1);
+            }
+        }
+        
+        // Read the SOAP part and cache it
+        getDataHandler(getSOAPPartContentID());
+        
+        // Now reset partsRequested. SOAP part is a special case which is always 
+        // read beforehand, regardless of request.
+        partsRequested = false;
+    }
+
+    /**
+     * Sets file cache to false.
+     *
+     * @param inStream
+     * @param contentTypeString
+     * @throws OMException
+     */
+    public Attachments(InputStream inStream, String contentTypeString)
+            throws OMException {
+        this(inStream, contentTypeString, false, null, null);
+    }
+    
+    /**
+     * Use this constructor when instantiating this to store the attachments set programatically through the SwA API.
+     */
+    public Attachments()
+    {
+    	attachmentsMap = new TreeMap();
+    	noStreams= true;
+    }
+
+    /**
+     * @return whether Message Type is SOAP with Attachments or MTOM optimized,
+     *         by checking the application type parameter in the Content Type.
+     */
+    public String getAttachmentSpecType() {
+        if (this.applicationType == null) {
+            applicationType = contentType.getParameter("type");
+            if ((MTOMConstants.MTOM_TYPE).equalsIgnoreCase(applicationType)) {
+                this.applicationType = MTOMConstants.MTOM_TYPE;
+            } else if ((MTOMConstants.SWA_TYPE).equalsIgnoreCase(applicationType)) {
+                this.applicationType = MTOMConstants.SWA_TYPE;
+            } else {
+                throw new OMException(
+                        "Invalid Application type. Support available for MTOM & SwA/SOAP 1.l only.");
+            }
+        }
+        return this.applicationType;
+    }
+    
+    /**
+     * Checks whether the MIME part is already parsed by checking the
+     * attachments HashMap. If it is not parsed yet then call the getNextPart()
+     * till the required part is found.
+     * 
+     * @param blobContentID (without the surrounding angle brackets and "cid:" prefix)
+     * @return The DataHandler of the mime part referred by the Content-Id or 
+     *   *null* if the mime part referred by the content-id does not exist
+     */
+    public DataHandler getDataHandler(String blobContentID) {
+        DataHandler dataHandler;
+        if (attachmentsMap.containsKey(blobContentID)) {
+            dataHandler = (DataHandler) attachmentsMap.get(blobContentID);
+            return dataHandler;
+        } else if (!noStreams){
+            //This loop will be terminated by the Exceptions thrown if the Mime
+            // part searching was not found
+            while ((dataHandler = this.getNextPartDataHandler())!=null) {
+                if (attachmentsMap.containsKey(blobContentID)) {
+                    dataHandler = (DataHandler) attachmentsMap.get(blobContentID);
+                    return dataHandler;
+                }
+            }
+        }
+        return null;
+    }
+    
+    /**
+	 * Programatically adding an SOAP with Attachments(SwA) Attachment. These
+	 * attachments will get serialized only if SOAP with Attachments is enabled.
+	 * 
+	 * @param contentID
+	 * @param dataHandler
+	 */
+    public void addDataHandler(String contentID, DataHandler dataHandler)
+    {
+    	attachmentsMap.put(contentID,dataHandler);
+    }
+
+    /**
+     * @return the InputStream which includes the SOAP Envelope. It assumes that
+     *         the root mime part is always pointed by "start" parameter in
+     *         content-type.
+     */
+    public InputStream getSOAPPartInputStream() throws OMException {
+        DataHandler dh;
+        if (noStreams)
+        {
+        	throw new OMException("Invalid operation. Attachments are created programatically.");
+        }
+        try {
+            dh = getDataHandler(getSOAPPartContentID());
+            if (dh == null) {
+                throw new OMException(
+                        "Mandatory Root MIME part containing the SOAP Envelope is missing");
+            }
+            return dh.getInputStream();
+        } catch (IOException e) {
+            throw new OMException(
+                    "Problem with DataHandler of the Root Mime Part. ", e);
+        }
+    }
+
+    /**
+     * @return the Content-ID of the SOAP part It'll be the value Start
+     *         Parameter of Content-Type header if given in the Content type of
+     *         the MIME message. Else it'll be the content-id of the first MIME
+     *         part of the MIME message
+     */
+    private String getSOAPPartContentID() {
+        String rootContentID = contentType.getParameter("start");
+
+        // to handle the Start parameter not mentioned situation
+        if (rootContentID == null) {
+            if (partIndex == 0) {
+                getNextPartDataHandler();
+            }
+            rootContentID = firstPartId;
+        } else {
+            rootContentID = rootContentID.trim();
+
+            if ((rootContentID.indexOf("<") > -1)
+                & (rootContentID.indexOf(">") > -1)) {
+                rootContentID = rootContentID.substring(1, (rootContentID
+                        .length() - 1));
+            }
+        }
+        // Strips off the "cid" part from content-id
+        if ("cid".equalsIgnoreCase(rootContentID.substring(0, 3))) {
+            rootContentID = rootContentID.substring(4);
+        }
+        return rootContentID;
+    }
+
+    public String getSOAPPartContentType() {
+    	if (!noStreams) {
+			DataHandler soapPart = getDataHandler(getSOAPPartContentID());
+			return soapPart.getContentType();
+		}else
+		{
+			throw new OMException("The attachments map was created programatically. Unsupported operation.");
+		}
+    }
+
+    /**
+	 * Stream based access
+	 * 
+	 * @return The stream container of type
+	 *         <code>IncomingAttachmentStreams</code>
+	 * @throws IllegalStateException
+	 *             if application has alreadt started using Part's directly
+	 */
+    public IncomingAttachmentStreams getIncomingAttachmentStreams() throws IllegalStateException {
+    	if (partsRequested) {
+    		throw new IllegalStateException("The attachments stream can only be accessed once; either by using the IncomingAttachmentStreams class or by getting a collection of AttachmentPart objects. They cannot both be called within the life time of the same service request.");
+    	}
+    	if (noStreams)
+    	{
+    		throw new IllegalStateException("The attachments map was created programatically. No streams are available.");
+    	}
+
+    	streamsRequested = true;
+
+    	if (this.streams == null) {
+       		BoundaryDelimitedStream boundaryDelimitedStream =
+                new BoundaryDelimitedStream(pushbackInStream,
+                        boundary, 1024);
+
+       		this.streams = new MultipartAttachmentStreams(boundaryDelimitedStream);
+    	}
+
+    	return this.streams;
+    }
+
+    public String[] getAllContentIDs() {
+        Set keys = getContentIDSet();
+        return (String[]) keys.toArray(new String[keys.size()]);
+    }
+    
+    public Set getContentIDSet() {
+        DataHandler dataHandler;
+        while (!noStreams & true) {
+            dataHandler = this.getNextPartDataHandler();
+            if (dataHandler == null) {
+                break;
+            }
+        }
+        return attachmentsMap.keySet();
+    }
+
+    /**
+	 * endOfStreamReached will be set to true if the message ended in MIME Style
+	 * having "--" suffix with the last mime boundary
+	 * 
+	 * @param value
+	 */
+    protected void setEndOfStream(boolean value) {
+        this.endOfStreamReached = value;
+    }
+
+    /**
+     * @return the Next valid MIME part + store the Part in the Parts List
+     * @throws OMException throw if content id is null or if two MIME parts contain the
+     *                     same content-ID & the exceptions throws by getPart()
+     */
+    private DataHandler getNextPartDataHandler() throws OMException {
+    	if (endOfStreamReached)
+    	{
+    		return null;
+    	}
+        Part nextPart;
+        nextPart = getPart();
+        if (nextPart==null)
+        {
+        	return null;
+        } else
+			try {
+				if (nextPart.getSize()>0) {
+				    String partContentID;
+				    try {
+				        partContentID = nextPart.getContentID();
+
+				        if (partContentID == null & partIndex == 1) {
+				        	String id = "firstPart_"+UUIDGenerator.getUUID();
+				            attachmentsMap.put(id, nextPart);
+				            firstPartId = id;
+				            return nextPart.getDataHandler();
+				        }
+				        if (partContentID == null) {
+				            throw new OMException(
+				                    "Part content ID cannot be blank for non root MIME parts");
+				        }
+				        if ((partContentID.indexOf("<") > -1)
+				            & (partContentID.indexOf(">") > -1)) {
+				            partContentID = partContentID.substring(1, (partContentID
+				                    .length() - 1));
+
+				        } else if (partIndex == 1) {
+				            firstPartId = partContentID;
+				        }
+				        if (attachmentsMap.containsKey(partContentID)) {
+				            throw new OMException(
+				                    "Two MIME parts with the same Content-ID not allowed.");
+				        }
+				        attachmentsMap.put(partContentID, nextPart.getDataHandler());
+				        return nextPart.getDataHandler();
+				    } catch (MessagingException e) {
+				        throw new OMException("Error reading Content-ID from the Part."
+				                              + e);
+				    }
+				} // This will take care if stream ended without having MIME
+				// message terminator
+				else {
+					return null;
+				}
+			} catch (MessagingException e) {
+				throw new OMException(e);
+			}
+    }
+
+    /**
+     * @return This will return the next available MIME part in the stream.
+     * @throws OMException if Stream ends while reading the next part...
+     */
+    private Part getPart() throws OMException {
+
+    	if (streamsRequested) {
+    		throw new IllegalStateException("The attachments stream can only be accessed once; either by using the IncomingAttachmentStreams class or by getting a collection of AttachmentPart objects. They cannot both be called within the life time of the same service request.");
+    	}
+    	
+    	partsRequested = true;
+
+        Part part;
+
+        try {
+            if (fileCacheEnable) {
+                try {
+                    MIMEBodyPartInputStream partStream;
+                    byte[] buffer = new byte[fileStorageThreshold];
+                    partStream = new MIMEBodyPartInputStream(pushbackInStream,
+                                                             boundary, this);
+                    int count = 0;
+                    int value;
+                    // Make sure *not* to modify this to a Short Circuit "&". If
+                    // removed a byte will be lost
+                    while (count != fileStorageThreshold
+                           && (!partStream.getBoundaryStatus())) {
+                        value = partStream.read();
+                        buffer[count] = (byte) value;
+                        count++;
+                    }
+                    if (count == fileStorageThreshold) {
+                        PushbackFilePartInputStream filePartStream = new PushbackFilePartInputStream(
+                                partStream, buffer);
+                        part = new PartOnFile(filePartStream, attachmentRepoDir);
+                    } else {
+                        ByteArrayInputStream byteArrayInStream = new ByteArrayInputStream(
+                                buffer, 0, count - 1);
+                        part = new PartOnMemory(byteArrayInStream);
+                    }
+                } catch (Exception e) {
+                    throw new OMException("Error creating temporary File.", e);
+                }
+            } else {
+                MIMEBodyPartInputStream partStream;
+                partStream = new MIMEBodyPartInputStream(pushbackInStream,
+                                                         boundary, this);
+                part = new PartOnMemory(partStream);
+            }
+
+        } catch (MessagingException e) {
+            throw new OMException(e);
+        }
+        partIndex++;
+        return part;
+    }
+}
\ No newline at end of file
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/BoundaryDelimitedStream.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/BoundaryDelimitedStream.java
new file mode 100644
index 0000000..b4171a0
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/BoundaryDelimitedStream.java
@@ -0,0 +1,578 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ */
+
+package org.apache.axiom.attachments;
+
+import org.apache.axiom.om.OMException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * This class takes the input stream and turns it multiple streams.
+ */
+public class BoundaryDelimitedStream extends java.io.FilterInputStream {
+
+    /** The <code>Log</code> that this class should log all events to. */
+    protected static Log log =
+            LogFactory.getLog(BoundaryDelimitedStream.class.getName());
+
+    protected byte[] boundary = null;
+
+    /** The boundary length. */
+    int boundaryLen = 0;
+
+    /** The boundary length plus crlf. */
+    int boundaryBufLen = 0;
+
+    /** The source input stream. */
+    java.io.InputStream is = null;
+
+    /** The stream has been closed. */
+    boolean closed = true;
+
+    /** eof has been detected. */
+    boolean eos = false;
+
+    /** There are no more streams left. */
+    boolean theEnd = false;
+
+    /** Minimum to read at one time. */
+    int readbufsz = 0;
+
+    /** The buffer we are reading. */
+    byte[] readbuf = null;
+
+    /** Where we have read so far in the stream. */
+    int readBufPos = 0;
+
+    /** The number of bytes in array. */
+    int readBufEnd = 0;
+
+    /** Field BOUNDARY_NOT_FOUND.           */
+    protected static final int BOUNDARY_NOT_FOUND = Integer.MAX_VALUE;
+
+    // Where in the stream a boundary is located.
+
+    /** Field boundaryPos.           */
+    int boundaryPos = BOUNDARY_NOT_FOUND;
+
+    /** The number of streams produced. */
+    static int streamCount = 0;
+
+    /**
+     * Signal that a new stream has been created.
+     *
+     */
+    protected static synchronized int newStreamNo() {
+
+        log.debug("streamNo" + (streamCount + 1));
+
+        return ++streamCount;
+    }
+
+    /** Field streamNo.           */
+    protected int streamNo = -1;    // Keeps track of stream
+
+    /** Field isDebugEnabled.           */
+    static boolean isDebugEnabled = false;
+
+    /**
+     * Gets the next stream. From the previous using the same buffer size to
+     * read.
+     *
+     * @return the boundary delmited stream, null if there are no more streams.
+     * @throws java.io.IOException if there was an error loading the data for
+     *              the next stream
+     */
+    public synchronized BoundaryDelimitedStream getNextStream()  throws java.io.IOException  {
+        return getNextStream(readbufsz);
+    }
+
+    /**
+     * Gets the next stream. From the previous using  new buffer reading size.
+     *
+     * @param readbufsz
+     * @return the boundary delmited stream, null if there are no more streams.
+     * @throws java.io.IOException if there was an error loading the data for
+     *              the next stream
+     */
+    protected synchronized BoundaryDelimitedStream getNextStream(
+            int readbufsz)  throws java.io.IOException  {
+
+        BoundaryDelimitedStream ret = null;
+
+        if (!theEnd) {
+
+            // Create an new boundary stream  that comes after this one.
+            ret = new BoundaryDelimitedStream(this, readbufsz);
+        }
+
+        return ret;
+    }
+
+    /**
+     *  Constructor to create the next stream from the previous one.
+     *
+     * @param prev      the previous stream
+     * @param readbufsz how many bytes to make the read buffer
+     * @throws java.io.IOException if there was a problem reading data from
+     *              <code>prev</code>
+     */
+    protected BoundaryDelimitedStream(BoundaryDelimitedStream prev,
+                                      int readbufsz)
+            throws java.io.IOException
+    {
+        super(null);
+
+        streamNo = newStreamNo();
+        boundary = prev.boundary;
+        boundaryLen = prev.boundaryLen;
+        boundaryBufLen = prev.boundaryBufLen;
+        skip = prev.skip;
+        is = prev.is;
+        closed = false;    // The new one is not closed.
+        eos = false;    // Its not at th EOS.
+        this.readbufsz = readbufsz;
+        readbuf = prev.readbuf;
+
+        // Move past the old boundary.
+        readBufPos = prev.readBufPos + boundaryBufLen;
+        readBufEnd = prev.readBufEnd;
+
+        // find the new boundary.
+        boundaryPos = boundaryPosition(readbuf, readBufPos, readBufEnd);
+        prev.theEnd = theEnd;      // The stream.
+    }
+
+    /**
+     * Create a new boundary stream.
+     *
+     * @param is
+     * @param boundary is the boundary that separates the individual streams.
+     * @param readbufsz lets you have some control over the amount of buffering.
+     *   by buffering you can some effiency in searching.
+     *
+     * @throws OMException
+     */
+    BoundaryDelimitedStream(
+            java.io.InputStream is, byte[] boundary, int readbufsz)
+            throws OMException {
+
+        // super (is);
+        super(null);    // we handle everything so this is not necessary, don't won't to hang on to a reference.
+
+        isDebugEnabled = log.isDebugEnabled();
+        streamNo = newStreamNo();
+        closed = false;
+        this.is = is;
+
+        // Copy the boundary array to make certain it is never altered.
+        this.boundary = new byte[boundary.length];
+
+        System.arraycopy(boundary, 0, this.boundary, 0, boundary.length);
+
+        this.boundaryLen = this.boundary.length;
+
+        // 2 for preceeding, and 2 for proceeding CRLF's
+        this.boundaryBufLen = boundaryLen + 4;
+
+        // allways leave room for at least a 2x boundary
+        // Most mime boundaries are 40 bytes or so.
+        this.readbufsz = Math.max((boundaryBufLen) * 2, readbufsz);
+    }
+
+    private int readFromStream(final byte[] b)
+            throws java.io.IOException {
+        return readFromStream(b, 0, b.length);
+    }
+
+    private int readFromStream(
+            final byte[] b, final int start, final int length)
+            throws java.io.IOException {
+
+        int minRead = Math.max(boundaryBufLen * 2, length);
+
+        minRead = Math.min(minRead, length - start);
+
+        int br = 0;
+        int brTotal = 0;
+
+        do {
+
+       		br = is.read(b, brTotal + start, length - brTotal);
+
+            if (br > 0) {
+                brTotal += br;
+            }
+        } while ((br > -1) && (brTotal < minRead));
+
+        return (brTotal != 0)
+                ? brTotal
+                : br;
+    }
+
+    /**
+     * Read from the boundary delimited stream.
+     * @param b is the array to read into.
+     * @param off is the offset
+     * @param len
+     * @return the number of bytes read. -1 if endof stream.
+     *
+     * @throws java.io.IOException
+     */
+    public synchronized int read(byte[] b, final int off, final int len)
+            throws java.io.IOException {
+
+        if (closed) {
+            throw new java.io.IOException("streamClosed");
+        }
+
+        if (eos) {
+            return -1;
+        }
+
+        if (readbuf == null) {    // Allocate the buffer.
+            readbuf = new byte[Math.max(len, readbufsz)];
+            readBufEnd = readFromStream(readbuf);
+
+            if (readBufEnd < 0) {
+                readbuf = null;
+                closed = true;
+                finalClose();
+
+                throw new java.io.IOException("eosBeforeMarker");
+            }
+
+            readBufPos = 0;
+
+            // Finds the boundary pos.
+            boundaryPos = boundaryPosition(readbuf, 0, readBufEnd);
+        }
+
+        int bwritten = -1;    // Number of bytes written.
+
+        // read and copy bytes in.
+        do {                                // Always allow to have a boundary length left in the buffer.
+
+        	bwritten = 0;
+            int bcopy = Math.min(readBufEnd - readBufPos - boundaryBufLen,
+                    len - bwritten);
+
+            // never go past the boundary.
+            bcopy = Math.min(bcopy, boundaryPos - readBufPos);
+
+            if (bcopy > 0) {
+                System.arraycopy(readbuf, readBufPos, b, off + bwritten, bcopy);
+
+                bwritten += bcopy;
+                readBufPos += bcopy;
+            }
+
+            if (readBufPos == boundaryPos) {
+                eos = true;                 // hit the boundary so it the end of the stream.
+
+                log.debug("atEOS" + streamNo);
+            } else if (bwritten < len) {    // need to get more data.
+
+                byte[] dstbuf = readbuf;
+
+                if (readbuf.length < len) {
+                    dstbuf = new byte[len];
+                }
+
+                int movecnt = readBufEnd - readBufPos;
+
+                // copy what was left over.
+                System.arraycopy(readbuf, readBufPos, dstbuf, 0, movecnt);
+
+                // Read in the new data.
+                int readcnt = readFromStream(dstbuf, movecnt,
+                        dstbuf.length - movecnt);
+
+                if (readcnt < 0) {
+                    readbuf = null;
+                    closed = true;
+                    finalClose();
+
+                    throw new java.io.IOException("eosBeforeMarker");
+                }
+
+                readBufEnd = readcnt + movecnt;
+                readbuf = dstbuf;
+                readBufPos = 0;             // start at the begining.
+
+                // just move the boundary by what we moved
+                if (BOUNDARY_NOT_FOUND != boundaryPos) {
+                    boundaryPos -= movecnt;
+                } else {
+                    boundaryPos = boundaryPosition(
+                            readbuf, readBufPos,
+                            readBufEnd);        // See if the boundary is now there.
+                }
+            }
+        }
+
+                // read till we get the amount or the stream is finished.
+        while (!eos && (bwritten < len));
+
+        if (log.isDebugEnabled()) {
+            if (bwritten > 0) {
+                byte tb[] = new byte[bwritten];
+
+                System.arraycopy(b, off, tb, 0, bwritten);
+                log.debug("readBStream" +
+                        new String[]{"" + bwritten,
+                                     "" + streamNo,
+                                     new String(tb)});
+            }
+        }
+
+        if (eos && theEnd) {
+            readbuf = null;    // dealloc even in Java.
+        }
+
+        return bwritten;
+    }
+
+    /**
+     * Read from the boundary delimited stream.
+     * @param b is the array to read into. Read as much as possible
+     *   into the size of this array.
+     * @return the number of bytes read. -1 if endof stream.
+     *
+     * @throws java.io.IOException
+     */
+    public int read(byte[] b) throws java.io.IOException {
+        return read(b, 0, b.length);
+    }
+
+    /**
+     * Read from the boundary delimited stream.
+     * @return The byte read, or -1 if endof stream.
+     *
+     * @throws java.io.IOException
+     */
+    public int read() throws java.io.IOException {
+
+        byte[] b = new byte[1];    // quick and dirty. //for now
+        int read = read(b);
+
+        if (read < 0) {
+            return -1;
+        } else {
+            return b[0]&0xff;
+        }
+    }
+
+    /**
+     * Closes the stream.
+     *
+     * @throws java.io.IOException
+     */
+    public synchronized void close() throws java.io.IOException {
+
+        if (closed) {
+            return;
+        }
+
+        log.debug("bStreamClosed" + streamNo);
+
+        closed = true;    // mark it closed.
+
+        if (!eos) {    // We need get this off the stream.
+
+            // Easy way to flush through the stream;
+            byte[] readrest = new byte[1024 * 16];
+            int bread;
+
+            do {
+                bread = read(readrest);
+            } while (bread > -1);
+        }
+    }
+
+    /**
+     * mark the stream.
+     * This is not supported.
+     *
+     * @param readlimit
+     */
+    public void mark(int readlimit) {
+
+        // do nothing
+    }
+
+    /**
+     * reset the stream.
+     * This is not supported.
+     *
+     * @throws java.io.IOException
+     */
+    public void reset() throws java.io.IOException {
+        throw new java.io.IOException("attach.bounday.mns");
+    }
+
+    /**
+     * markSupported
+     * return false;
+     *
+     */
+    public boolean markSupported() {
+        return false;
+    }
+
+    public int available() throws java.io.IOException {
+
+        int bcopy = readBufEnd - readBufPos - boundaryBufLen;
+
+        // never go past the boundary.
+        bcopy = Math.min(bcopy, boundaryPos - readBufPos);
+
+        return Math.max(0, bcopy);
+    }
+
+    /**
+     * Read from the boundary delimited stream.
+     *
+     * @param searchbuf buffer to read from
+     * @param start     starting index
+     * @param end       ending index
+     * @return The position of the boundary. Detects the end of the source stream.
+     * @throws java.io.IOException if there was an error manipulating the
+     *              underlying stream
+     */
+    protected int boundaryPosition(byte[] searchbuf, int start, int end) throws java.io.IOException  {
+
+        int foundAt = boundarySearch(searchbuf, start, end);
+
+        // First find the boundary marker
+        if (BOUNDARY_NOT_FOUND != foundAt) {    // Something was found.
+            if (foundAt + boundaryLen + 2 > end) {
+                foundAt = BOUNDARY_NOT_FOUND;
+            } else {
+
+                // If the marker has a "--" at the end then this is the last boundary.
+                if ((searchbuf[foundAt + boundaryLen] == '-')
+                        && (searchbuf[foundAt + boundaryLen + 1] == '-')) {
+                    finalClose();
+                } else if ((searchbuf[foundAt + boundaryLen] != 13)
+                        || (searchbuf[foundAt + boundaryLen + 1] != 10)) {
+
+                    // If there really was no crlf at then end then this is not a boundary.
+                    foundAt = BOUNDARY_NOT_FOUND;
+                }
+
+                if ((foundAt != BOUNDARY_NOT_FOUND)
+                		&& (searchbuf[foundAt - 2] == 13)
+                        && (searchbuf[foundAt - 1] == 10)) {
+
+                	// Section 7.2.1 of the MIME RFC (#1521) states that CRLF
+                	// preceeding boundary is part of the encapsulation
+                	// boundary
+                	foundAt -= 2;
+                }
+            }
+        }
+
+        return foundAt;
+    }
+
+    /* The below uses a standard textbook Boyer-Moore pattern search. */
+
+    private int[] skip = null;
+
+    private int boundarySearch(final byte[] text, final int start,
+                               final int end) {
+
+        // log.debug(">>>>" + start + "," + end);
+        int i = 0, j = 0, k = 0;
+
+        if (boundaryLen > (end - start)) {
+            return BOUNDARY_NOT_FOUND;
+        }
+
+        if (null == skip) {
+            skip = new int[256];
+
+            java.util.Arrays.fill(skip, boundaryLen);
+
+            for (k = 0; k < boundaryLen - 1; k++) {
+                skip[boundary[k]] = boundaryLen - k - 1;
+            }
+        }
+
+        for (k = start + boundaryLen - 1; k < end;
+             k += skip[text[k] & (0xff)]) {
+
+            // log.debug(">>>>" + k);
+            // printarry(text, k-boundaryLen+1, end);
+            try {
+                for (j = boundaryLen - 1, i = k;
+                     (j >= 0) && (text[i] == boundary[j]); j--) {
+                    i--;
+                }
+            } catch (ArrayIndexOutOfBoundsException e) {
+                StringBuffer sb = new StringBuffer();
+                sb.append(">>>").append(e);    // rr temporary till a boundary issue is resolved.
+                sb.append("start=").append(start);
+                sb.append("k=").append(k);
+                sb.append("text.length=").append(text.length);
+                sb.append("i=").append(i);
+                sb.append("boundary.length=").append(boundary.length);
+                sb.append("j=").append(j);
+                sb.append("end=").append(end);
+                log.warn("exception01" + sb.toString());
+                throw e;
+            }
+
+            if (j == (-1)) {
+                return i + 1;
+            }
+        }
+
+        // log.debug(">>>> not found" );
+        return BOUNDARY_NOT_FOUND;
+    }
+
+    /**
+     * Close the underlying stream and remove all references to it.
+     *
+     * @throws java.io.IOException if the stream could not be closed
+     */
+    protected void finalClose() throws java.io.IOException {
+      if(theEnd) return;
+      theEnd= true;
+      is.close();
+      is= null;
+    }
+
+    /**
+     * Method printarry
+     *
+     * @param b
+     * @param start
+     * @param end
+     */
+    public static void printarry(byte[] b, int start, int end) {
+
+        if (log.isDebugEnabled()) {
+            byte tb[] = new byte[end - start];
+
+            System.arraycopy(b, start, tb, 0, end - start);
+            log.debug("\"" + new String(tb) + "\"");
+        }
+    }
+}
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/ByteArrayDataSource.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/ByteArrayDataSource.java
new file mode 100644
index 0000000..588ff22
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/ByteArrayDataSource.java
@@ -0,0 +1,66 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.attachments;

+

+import javax.activation.DataSource;

+import java.io.ByteArrayInputStream;

+import java.io.IOException;

+import java.io.InputStream;

+import java.io.OutputStream;

+

+public class ByteArrayDataSource implements DataSource {

+

+    private byte[] data;

+

+    private String type;

+

+    public ByteArrayDataSource(byte[] data, String type) {

+        super();

+        this.data = data;

+        this.type = type;

+    }

+

+    public ByteArrayDataSource(byte[] data) {

+        super();

+        this.data = data;

+    }

+

+    public void setType(String type) {

+        this.type = type;

+    }

+

+    public String getContentType() {

+        if (type == null)

+            return "application/octet-stream";

+        else

+            return type;

+    }

+

+    public InputStream getInputStream() throws IOException {

+        return new ByteArrayInputStream(data);

+    }

+

+    public String getName() {

+

+        return "ByteArrayDataSource";

+    }

+

+    public OutputStream getOutputStream() throws IOException {

+        throw new IOException("Not Supported");

+    }

+}

+

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/CachedFileDataSource.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/CachedFileDataSource.java
new file mode 100755
index 0000000..b58bded
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/CachedFileDataSource.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.attachments;
+
+import java.io.File;
+
+import javax.activation.FileDataSource;
+
+public class CachedFileDataSource extends FileDataSource {
+
+	String contentType = null;
+
+	public CachedFileDataSource(File arg0) {
+		super(arg0);
+	}
+
+	public String getContentType() {
+		if (this.contentType != null) {
+			return contentType;
+		} else {
+			return super.getContentType();
+		}
+	}
+
+	public void setContentType(String contentType) {
+		this.contentType = contentType;
+	}
+}
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/IncomingAttachmentInputStream.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/IncomingAttachmentInputStream.java
new file mode 100644
index 0000000..821c656
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/IncomingAttachmentInputStream.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.attachments;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+public class IncomingAttachmentInputStream extends InputStream {
+    private HashMap _headers = null;
+
+    private InputStream _stream = null;
+    private IncomingAttachmentStreams parentContainer;
+
+    public static final String HEADER_CONTENT_DESCRIPTION = "content-description";
+    public static final String HEADER_CONTENT_TYPE = "content-type";
+    public static final String HEADER_CONTENT_TRANSFER_ENCODING = "content-transfer-encoding";
+    public static final String HEADER_CONTENT_TYPE_JMS = "contentType";
+    public static final String HEADER_CONTENT_LENGTH = "content-length";
+    public static final String HEADER_CONTENT_LOCATION = "content-location";
+    public static final String HEADER_CONTENT_ID = "content-id";
+
+    /**
+     * @param in
+     */
+    public IncomingAttachmentInputStream(InputStream in, IncomingAttachmentStreams parentContainer) {
+        _stream = in;
+        this.parentContainer = parentContainer;
+    }
+
+    /**
+     * @return MIME headers for this attachment. May be null if no headers
+     *         were set.
+     */
+    public Map getHeaders() {
+        return _headers;
+    }
+
+    /**
+     * Add a header.
+     * 
+     * @param name
+     * @param value
+     */
+    public void addHeader(String name, String value) {
+        if (_headers == null) {
+            _headers = new HashMap();
+        }
+        _headers.put(name, value);
+    }
+
+    /**
+     * Get a header value.
+     * 
+     * @param name
+     * @return The header found or null if not found.
+     */
+    public String getHeader(String name) {
+        Object header = null;
+        if (_headers == null || (header = _headers.get(name)) == null) {
+            return null;
+        }
+        return header.toString();
+    }
+
+    /**
+     * @return The header with HTTPConstants.HEADER_CONTENT_ID as the key.
+     */
+    public String getContentId() {
+        return getHeader(HEADER_CONTENT_ID);
+    }
+
+    /**
+     * @return The header with HTTPConstants.HEADER_CONTENT_LOCATION as the
+     *         key.
+     */
+    public String getContentLocation() {
+        return getHeader(HEADER_CONTENT_LOCATION);
+    }
+
+    /**
+     * @return The header with HTTPConstants.HEADER_CONTENT_TYPE as the key.
+     */
+    public String getContentType() {
+        return getHeader(HEADER_CONTENT_TYPE);
+    }
+
+    /**
+     * Don't want to support mark and reset since this may get us into
+     * concurrency problem when different pieces of software may have a
+     * handle to the underlying InputStream.
+     */
+    public boolean markSupported() {
+        return false;
+    }
+
+    public void reset() throws IOException {
+        throw new IOException("markNotSupported");
+    }
+
+    public void mark(int readLimit) {
+        // do nothing
+    }
+
+    public int read() throws IOException {
+        int retval = _stream.read();
+        parentContainer.setReadyToGetNextStream(retval == -1);
+        return retval;
+    }
+
+    public int read(byte[] b) throws IOException {
+        int retval = _stream.read(b);
+        parentContainer.setReadyToGetNextStream(retval == -1);
+        return retval;
+    }
+
+    public int read(byte[] b, int off, int len) throws IOException {
+        int retval = _stream.read(b, off, len);
+        parentContainer.setReadyToGetNextStream(retval == -1);
+        return retval;
+    }
+}
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/IncomingAttachmentStreams.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/IncomingAttachmentStreams.java
new file mode 100644
index 0000000..1319416
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/IncomingAttachmentStreams.java
@@ -0,0 +1,56 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.attachments;

+

+import org.apache.axiom.om.OMException;

+

+/**

+ * Container for AttachmentStream s. This class provides an SwA like 

+ * access mechanism, allowing applications to access the streams directly. 

+ * Access it intentionally restrictred to either SwA like (stream access), 

+ * or MTOM like (part/data handler access via blob id), not both.   

+ */

+public abstract class IncomingAttachmentStreams {

+	

+	/** Boolean indicating weather or not the next stream can be read (next 

+	 * stream cannot be read until previous is consumed */

+	protected boolean _readyToGetNextStream = true;

+

+    /**

+     * @return True if the next stream can be read, false otherwise.

+     */

+    public final boolean isReadyToGetNextStream() {

+        return _readyToGetNextStream;

+    }

+

+    /**

+     * Set the ready flag. Intended for the inner class to use.

+     * 

+     * @param ready

+     */

+    protected final void setReadyToGetNextStream(boolean ready) {

+        _readyToGetNextStream = ready;

+    }

+    

+    /**

+     * 

+     * Returns the next attachment stream in sequence.

+     * 

+     * @return The next stream or null if no additional streams are left.

+     */

+    public abstract IncomingAttachmentInputStream getNextStream() throws OMException;

+}
\ No newline at end of file
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/MIMEBodyPartInputStream.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/MIMEBodyPartInputStream.java
new file mode 100644
index 0000000..0abee7c
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/MIMEBodyPartInputStream.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.attachments;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PushbackInputStream;
+
+public class MIMEBodyPartInputStream extends InputStream {
+    PushbackInputStream inStream;
+
+    boolean boundaryFound;
+
+    Attachments parent;
+
+    byte[] boundary;
+
+    public MIMEBodyPartInputStream(PushbackInputStream inStream, byte[] boundary) {
+        super();
+        this.inStream = inStream;
+        this.boundary = boundary;
+    }
+
+    public MIMEBodyPartInputStream(PushbackInputStream inStream,
+            byte[] boundary, Attachments parent) {
+        this(inStream, boundary);
+        this.parent = parent;
+    }
+
+    public int read() throws IOException {
+        if (boundaryFound) {
+            return -1;
+        }
+        // read the next value from stream
+        int value = inStream.read();
+        
+        // A problem occured because all the mime parts tends to have a /r/n at
+        // the end. Making it hard to transform them to correct DataSources.
+        // This logic introduced to handle it
+        //TODO look more in to this && for a better way to do this
+        if (value == 13) {
+            value = inStream.read();
+            if (value != 10) {
+                inStream.unread(value);
+                return 13;
+            } else {
+                value = inStream.read();
+                if ((byte) value != boundary[0]) {
+                    inStream.unread(value);
+                    inStream.unread(10);
+                    return 13;
+                }
+            }
+        } else {
+            return value;
+        }
+
+        // read value is the first byte of the boundary. Start matching the
+        // next characters to find a boundary
+        int boundaryIndex = 0;
+        while ((boundaryIndex < (boundary.length - 1))
+                && ((byte) value == boundary[boundaryIndex])) {
+            value = inStream.read();
+            boundaryIndex++;
+        }
+
+        if (boundaryIndex == (boundary.length - 1)) { // boundary found
+            boundaryFound = true;
+            // read the end of line character
+            if ((value = inStream.read()) == 45) {
+                //check whether end of stream
+                //Last mime boundary should have a succeeding "--"
+                if ((value = inStream.read()) == 45 && parent!=null) {
+                    parent.setEndOfStream(true);
+                }
+            } else {
+                inStream.read();
+            }
+
+            return -1;
+        }
+
+        // Boundary not found. Restoring bytes skipped.
+        // write first skipped byte, push back the rest
+
+        if (value != -1) { // Stream might have ended
+            inStream.unread(value);
+        }
+
+        inStream.unread(boundary, 0, boundaryIndex);
+        inStream.unread(10);
+        return 13;
+    }
+    
+    public boolean getBoundaryStatus()
+    {
+        return boundaryFound;
+    }
+}
\ No newline at end of file
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/MultipartAttachmentStreams.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/MultipartAttachmentStreams.java
new file mode 100644
index 0000000..cb46e6f
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/MultipartAttachmentStreams.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.attachments;
+
+import java.io.IOException;
+import java.util.Enumeration;
+
+import javax.mail.Header;
+import javax.mail.MessagingException;
+import javax.mail.internet.InternetHeaders;
+
+import org.apache.axiom.om.OMException;
+/**
+ * The MultipartAttachmentStreams class is used to create
+ * IncomingAttachmentInputStream objects when the HTTP stream shows a marked
+ * separation between the SOAP and each attachment parts. Unlike the DIME
+ * version, this class will use the BoundaryDelimitedStream to parse data in the
+ * SwA format. Another difference between the two is that the
+ * MultipartAttachmentStreams class must also provide a way to hold attachment
+ * parts parsed prior to where the SOAP part appears in the HTTP stream (i.e.
+ * the root part of the multipart-related message). Our DIME counterpart didn't
+ * have to worry about this since the SOAP part is guaranteed to be the first in
+ * the stream. But since SwA has no such guarantee, we must fall back to caching
+ * these first parts. Afterwards, we can stream the rest of the attachments that
+ * are after the SOAP part of the request message.
+ */
+public final class MultipartAttachmentStreams extends IncomingAttachmentStreams {
+    private BoundaryDelimitedStream _delimitedStream = null;
+
+    public MultipartAttachmentStreams(BoundaryDelimitedStream delimitedStream)
+            throws OMException {
+    	this._delimitedStream = delimitedStream;
+    }
+
+    /**
+     * 
+     * @see org.apache.axis.attachments.IncomingAttachmentStreams#getNextStream()
+     */
+    public IncomingAttachmentInputStream getNextStream() throws OMException {
+    	IncomingAttachmentInputStream stream;
+    	
+    	if (!isReadyToGetNextStream()) {
+    		throw new IllegalStateException("nextStreamNotReady");
+    	}
+    	
+    	InternetHeaders headers;
+    	
+    	try {
+    		_delimitedStream = _delimitedStream.getNextStream();
+    		if (_delimitedStream == null) {
+    			return null;
+    		}
+    		
+        	headers = new InternetHeaders(_delimitedStream);
+
+    	} catch (IOException ioe) {
+    		ioe.printStackTrace();
+    		throw new OMException(ioe);
+    	} catch (MessagingException me) {
+    		me.printStackTrace();
+    		throw new OMException(me);
+    	}
+
+    	stream = new IncomingAttachmentInputStream(_delimitedStream, this);
+    	
+    	Header header;
+    	String name;
+    	String value;
+    	Enumeration e = headers.getAllHeaders();
+    	while (e != null && e.hasMoreElements()) {
+    		header = (Header) e.nextElement();
+    		name = header.getName().toLowerCase();
+    		value = header.getValue();
+    		if (IncomingAttachmentInputStream.HEADER_CONTENT_ID.equals(name)
+    				|| IncomingAttachmentInputStream.HEADER_CONTENT_TYPE.equals(name)
+    				|| IncomingAttachmentInputStream.HEADER_CONTENT_LOCATION.equals(name)) {
+    			value = value.trim();
+    		}
+    		stream.addHeader(name, value);
+    	}
+
+    	setReadyToGetNextStream(false);
+    	return stream;
+    }
+}
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Part.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Part.java
new file mode 100644
index 0000000..d500204
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Part.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.attachments;
+
+import javax.activation.DataHandler;
+import javax.mail.MessagingException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Enumeration;
+
+public interface Part{
+
+    
+    public int getSize() throws MessagingException ;
+
+    public String getContentType() throws MessagingException;
+    
+    public String getContentID() throws MessagingException;
+    
+    public String getFileName() throws MessagingException;
+
+    public InputStream getInputStream() throws IOException, MessagingException ;
+    
+    public DataHandler getDataHandler() throws MessagingException ;
+    
+    public void addHeader(String arg0, String arg1) throws MessagingException ;
+    
+    public String getHeader(String arg0) throws MessagingException ;
+    
+    public Enumeration getAllHeaders() throws MessagingException ;
+    
+}
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/PartOnFile.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/PartOnFile.java
new file mode 100644
index 0000000..6f563fd
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/PartOnFile.java
@@ -0,0 +1,195 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.attachments;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.activation.FileDataSource;
+import javax.mail.Header;
+import javax.mail.MessagingException;
+
+import org.apache.axiom.om.OMException;
+
+public class PartOnFile implements Part {
+
+    File cacheFile;
+
+    Part bodyPart;
+
+    String contentType;
+
+    String contentID;
+
+    Hashtable headers;
+
+    public PartOnFile(PushbackFilePartInputStream inStream, String repoDir) {
+        super();
+
+        headers = new Hashtable();
+
+        if (repoDir == null) {
+            repoDir = ".";
+        }
+        try {
+            cacheFile = File.createTempFile("Axis2", ".att",
+                    (repoDir == null) ? null : new File(repoDir));
+
+            FileOutputStream fileOutStream = new FileOutputStream(cacheFile);
+            int value;
+            value = parseTheHeaders(inStream);
+            fileOutStream.write(value);
+            while (!inStream.getBoundaryStatus()) {
+                value = inStream.read();
+                if (!inStream.getBoundaryStatus()) {
+                    fileOutStream.write(value);
+                }
+            }
+
+            fileOutStream.flush();
+            fileOutStream.close();
+        } catch (IOException e) {
+            throw new OMException("Error creating temporary File.", e);
+        }
+    }
+
+    private int parseTheHeaders(InputStream inStream) throws IOException {
+        int value;
+        boolean readingHeaders = true;
+        StringBuffer header = new StringBuffer();
+        while (readingHeaders & (value = inStream.read()) != -1) {
+            if (value == 13) {
+                if ((value = inStream.read()) == 10) {
+                    if ((value = inStream.read()) == 13) {
+                        if ((value = inStream.read()) == 10) {
+                            putToMap(header);
+                            readingHeaders = false;
+                        }
+                    } else {
+                        putToMap(header);
+                        header = new StringBuffer();
+                        header.append((char) value);
+                    }
+                } else {
+                    header.append(13);
+                    header.append(value);
+                }
+            } else {
+                header.append((char) value);
+            }
+        }
+        return value;
+    }
+
+    private void putToMap(StringBuffer header) {
+        String headerString = header.toString();
+        int delimiter = headerString.indexOf(":");
+        
+        String name = headerString.substring(0, delimiter).trim();
+        String value= headerString.substring(delimiter + 1, headerString.length()).trim();
+
+        Header headerObj = new Header(name, value);
+        headers.put(name, headerObj);
+    }
+
+    public String getContentID() {
+        Header cID = (Header) headers.get("Content-ID");
+        if (cID == null) {
+            cID = (Header) headers.get("Content-Id");
+            if (cID == null) {
+                cID = (Header) headers.get("Content-id");
+                if (cID == null) {
+                    cID = (Header) headers.get("content-id");
+                }
+            }
+
+        }
+        return cID.getValue();
+    }
+
+    public int getSize() throws MessagingException {
+        return (int) cacheFile.length();
+    }
+
+    public int getLineCount() throws MessagingException {
+        throw new UnsupportedOperationException();
+    }
+
+    public String getDescription() throws MessagingException {
+        throw new UnsupportedOperationException();
+    }
+
+    public void setDescription(String arg0) throws MessagingException {
+        throw new UnsupportedOperationException();
+    }
+
+    public String getFileName() throws MessagingException {
+        return cacheFile.getAbsolutePath();
+    }
+
+    public InputStream getInputStream() throws IOException, MessagingException {
+        return new FileInputStream(cacheFile);
+    }
+
+    public DataHandler getDataHandler() throws MessagingException {
+    	CachedFileDataSource dataSource = new CachedFileDataSource(cacheFile);
+    	dataSource.setContentType(getContentType());
+        return new DataHandler(dataSource);
+    }
+
+    public Object getContent() throws IOException, MessagingException {
+        return getDataHandler().getContent();
+    }
+
+    public void writeTo(OutputStream outStream) throws IOException,
+            MessagingException {
+        getDataHandler().writeTo(outStream);
+    }
+
+    public String getHeader(String arg0) throws MessagingException {
+    	return ((Header) headers.get(arg0)).getValue();
+    }
+
+    public void addHeader(String arg0, String arg1) throws MessagingException {
+    	Header headerObj = new Header(arg0, arg1);
+        headers.put(arg0, headerObj);
+    }
+
+    public Enumeration getAllHeaders() throws MessagingException {
+        return headers.elements();
+    }
+
+    public String getContentType() throws MessagingException {
+        Header cType = (Header) headers.get("Content-Type");
+        if (cType == null) {
+            cType = (Header) headers.get("Content-type");
+            if (cType == null) {
+                cType = (Header) headers.get("content-type");
+            }
+        }
+        return cType.getValue();
+    }
+
+}
\ No newline at end of file
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/PartOnMemory.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/PartOnMemory.java
new file mode 100644
index 0000000..4fd93af
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/PartOnMemory.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.attachments;
+
+import javax.activation.DataHandler;
+import javax.mail.MessagingException;
+import javax.mail.internet.MimeBodyPart;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Enumeration;
+
+public class PartOnMemory implements Part{
+
+    MimeBodyPart part;
+    public PartOnMemory(InputStream partInStream) throws MessagingException
+    {
+        part =  new MimeBodyPart(partInStream);
+    }
+
+    public int getSize() throws MessagingException {
+        return part.getSize();
+    }
+
+    public String getContentType() throws MessagingException {
+        return part.getContentType();
+    }
+
+    public String getFileName() throws MessagingException {
+        return part.getFileName();
+    }
+
+    public InputStream getInputStream() throws IOException, MessagingException {
+        return part.getInputStream();
+    }
+
+    public DataHandler getDataHandler() throws MessagingException {
+        return part.getDataHandler();
+    }
+
+    public void addHeader(String arg0, String arg1) throws MessagingException {
+        part.addHeader(arg0, arg1);
+    }
+
+    public String getHeader(String arg0) throws MessagingException {
+       return part.getHeader(arg0)[0];
+    }
+
+    public Enumeration getAllHeaders() throws MessagingException {
+       return part.getAllHeaders();
+    }
+
+
+    public String getContentID() throws MessagingException {
+        return part.getContentID();
+    }
+}
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/PushbackFilePartInputStream.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/PushbackFilePartInputStream.java
new file mode 100644
index 0000000..4793592
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/PushbackFilePartInputStream.java
@@ -0,0 +1,58 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.attachments;

+

+import java.io.IOException;

+import java.io.InputStream;

+

+public class PushbackFilePartInputStream extends InputStream {

+

+    MIMEBodyPartInputStream inStream;

+

+    byte[] buffer;

+

+    int count;

+

+    /**

+     * @param inStream

+     * @param buffer

+     */

+    public PushbackFilePartInputStream(MIMEBodyPartInputStream inStream,

+            byte[] buffer) {

+        super();

+        this.inStream = inStream;

+        this.buffer = buffer;

+        count = buffer.length;

+    }

+

+    public int read() throws IOException {

+        int data;

+        if (count > 0) {

+            data = buffer[buffer.length - count];

+            count--;

+        } else {

+            data = inStream.read();

+        }

+        return data;

+    }

+    

+    public boolean getBoundaryStatus()

+    {

+        return inStream.getBoundaryStatus();

+    }

+

+}
\ No newline at end of file
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/utils/DataHandlerUtils.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/utils/DataHandlerUtils.java
new file mode 100755
index 0000000..0e30342
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/utils/DataHandlerUtils.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright  2004 The Apache Software Foundation.
+ *
+ *  Licensed 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.
+ *
+ */
+package org.apache.axiom.attachments.utils;
+
+
+import org.apache.axiom.attachments.ByteArrayDataSource;
+import org.apache.axiom.om.util.Base64;
+
+import javax.activation.DataHandler;
+
+public class DataHandlerUtils {
+
+  public static Object getDataHandlerFromText(String value, String mimeType)
+  {
+      ByteArrayDataSource dataSource;
+      byte[] data = Base64.decode(value);
+      if (mimeType != null) {
+          dataSource = new ByteArrayDataSource(data, mimeType);
+      } else {
+          // Assumes type as application/octet-stream
+          dataSource = new ByteArrayDataSource(data);
+      }
+      return new DataHandler(dataSource);
+  }
+}
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/utils/IOUtils.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/utils/IOUtils.java
new file mode 100644
index 0000000..009aa5a
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/utils/IOUtils.java
@@ -0,0 +1,98 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.attachments.utils;

+

+import java.io.IOException;

+import java.io.InputStream;

+import java.io.ByteArrayOutputStream;

+

+/**

+ * Utility class containing IO helper methods

+ */

+public class IOUtils {

+    private IOUtils() {

+    }

+

+    /**

+     * Reads into a byte array. Ensures that the full buffer is read.

+     * Helper method, just calls <tt>readFully(in, b, 0, b.length)</tt>

+     *

+     * @see #readFully(java.io.InputStream, byte[], int, int)

+     */

+    public static int readFully(InputStream in, byte[] b)

+            throws IOException {

+        return readFully(in, b, 0, b.length);

+    }

+

+    /**

+     * Same as the normal <tt>in.read(b, off, len)</tt>, but tries to ensure that

+     * the entire len number of bytes is read.

+     * 

+     * @return Returns the number of bytes read, or -1 if the end of file is

+     * reached before any bytes are read

+     */

+    public static int readFully(InputStream in, byte[] b, int off, int len)

+            throws IOException {

+        int total = 0;

+        for (; ;) {

+            int got = in.read(b, off + total, len - total);

+            if (got < 0) {

+                return (total == 0) ? -1 : total;

+            } else {

+                total += got;

+                if (total == len)

+                    return total;

+            }

+        }

+    }

+

+    /**

+     * Returns the contents of the input stream as byte array.

+     *

+     * @param stream the <code>InputStream</code>

+     * @return the stream content as byte array

+     */

+    public static byte[] getStreamAsByteArray(InputStream stream) throws IOException {

+        return getStreamAsByteArray(stream, -1);

+    }

+

+    /**

+     * Returns the contents of the input stream as byte array.

+     *

+     * @param stream the <code>InputStream</code>

+     * @param length the number of bytes to copy, if length < 0,

+     *               the number is unlimited

+     * @return the stream content as byte array

+     */

+    public static byte[] getStreamAsByteArray(InputStream stream, int length) throws IOException {

+        if (length == 0) return new byte[0];

+        boolean checkLength = true;

+        if (length < 0) {

+            length = Integer.MAX_VALUE;

+            checkLength = false;

+        }

+        ByteArrayOutputStream byteStream = new ByteArrayOutputStream();

+        int nextValue = stream.read();

+        if (checkLength) length--;

+        while (-1 != nextValue && length >= 0) {

+            byteStream.write(nextValue);

+            nextValue = stream.read();

+            if (checkLength) length--;

+        }

+        return byteStream.toByteArray();

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAbstractFactory.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAbstractFactory.java
new file mode 100644
index 0000000..48c3add
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAbstractFactory.java
@@ -0,0 +1,101 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import org.apache.axiom.soap.SOAPFactory;

+

+public class OMAbstractFactory {

+    public static final String OM_FACTORY_NAME_PROPERTY = "om.factory";

+    public static final String SOAP11_FACTORY_NAME_PROPERTY = "soap11.factory";

+    public static final String SOAP12_FACTORY_NAME_PROPERTY = "soap12.factory";

+

+    private static final String DEFAULT_OM_FACTORY_CLASS_NAME = "org.apache.axiom.om.impl.llom.factory.OMLinkedListImplFactory";

+    private static final String DEFAULT_SOAP11_FACTORY_CLASS_NAME = "org.apache.axiom.soap.impl.llom.soap11.SOAP11Factory";

+    private static final String DEFAULT_SOAP12_FACTORY_CLASS_NAME = "org.apache.axiom.soap.impl.llom.soap12.SOAP12Factory";

+

+

+    public static OMFactory getOMFactory() {

+

+        String omFactory;

+        try {

+            omFactory = System.getProperty(OM_FACTORY_NAME_PROPERTY);

+            if (omFactory == null || "".equals(omFactory)) {

+                omFactory = DEFAULT_OM_FACTORY_CLASS_NAME;

+            }

+        } catch (SecurityException e) {

+            // security exception can be thrown when trying to access system variables within a sand box like an applet.

+            // please refer : http://issues.apache.org/jira/browse/WSCOMMONS-57

+            omFactory = DEFAULT_OM_FACTORY_CLASS_NAME;

+        }

+

+        try {

+           return (OMFactory) Class.forName(omFactory).newInstance();

+        } catch (InstantiationException e) {

+            throw new OMException(e);

+        } catch (IllegalAccessException e) {

+            throw new OMException(e);

+        } catch (ClassNotFoundException e) {

+            throw new OMException(e);

+        }

+    }

+

+

+    /**

+     * Gets the default factory implementation from the classpath.

+     *

+     * @return Returns SOAPFactory.

+     */

+    public static SOAPFactory getSOAP11Factory() {

+        try {

+            String omFactory = System.getProperty(SOAP11_FACTORY_NAME_PROPERTY);

+            if (omFactory == null || "".equals(omFactory)) {

+                omFactory = DEFAULT_SOAP11_FACTORY_CLASS_NAME;

+            }

+            return (SOAPFactory) Class.forName(omFactory).newInstance();

+        } catch (InstantiationException e) {

+            throw new OMException(e);

+        } catch (IllegalAccessException e) {

+            throw new OMException(e);

+        } catch (ClassNotFoundException e) {

+            throw new OMException(e);

+        }

+    }

+

+

+    /**

+     * Gets the default factory implementation from the classpath.

+     *

+     * @return Returns SOAPFactory.

+     */

+    public static SOAPFactory getSOAP12Factory() {

+        try {

+            String omFactory = System.getProperty(SOAP12_FACTORY_NAME_PROPERTY);

+            if (omFactory == null || "".equals(omFactory)) {

+                omFactory = DEFAULT_SOAP12_FACTORY_CLASS_NAME;

+            }

+            return (SOAPFactory) Class.forName(omFactory).newInstance();

+        } catch (InstantiationException e) {

+            throw new OMException(e);

+        } catch (IllegalAccessException e) {

+            throw new OMException(e);

+        } catch (ClassNotFoundException e) {

+            throw new OMException(e);

+        }

+    }

+

+

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAttribute.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAttribute.java
new file mode 100644
index 0000000..2b5fc74
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMAttribute.java
@@ -0,0 +1,64 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import javax.xml.namespace.QName;

+

+/**

+ * Interface OMAttribute

+ */

+public interface OMAttribute {

+    /**

+     * @return Returns localName.

+     */

+    public String getLocalName();

+

+    /**

+     * @param localName

+     */

+    public void setLocalName(String localName);

+

+    /**

+     * @return Returns String.

+     */

+    public String getAttributeValue();

+

+    /**

+     * @param value

+     */

+    public void setAttributeValue(String value);

+

+    /**

+     * @param omNamespace

+     */

+    public void setOMNamespace(OMNamespace omNamespace);

+

+    /**

+     * @return Returns OMNamespace.

+     */

+    public OMNamespace getNamespace();

+

+    /**

+     * @return Returns javax.xml.namespace.QName

+     */

+    public QName getQName();

+    

+    /**

+     * Returns the OMFactory that created this object

+     */

+    public OMFactory getOMFactory();

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMComment.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMComment.java
new file mode 100644
index 0000000..16d3777
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMComment.java
@@ -0,0 +1,34 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+/**

+ * Interface OMComment

+ */

+public interface OMComment extends OMNode {

+    /**

+     * Returns the value of this comment as defined by XPath 1.0.

+     * @return Returns String.

+     */

+    public String getValue();

+

+    /**

+     * Sets the content of this comment to the specified string.

+     * @param text

+     */

+    public void setValue(String text);

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMConstants.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMConstants.java
new file mode 100644
index 0000000..8ad74df
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMConstants.java
@@ -0,0 +1,84 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+/**

+ * Interface OMConstants

+ */

+public interface OMConstants {

+

+

+    // OMBuilder constants

+    /**

+     * Field PUSH_TYPE_BUILDER

+     */

+    public static final short PUSH_TYPE_BUILDER = 0;

+

+    /**

+     * Field PULL_TYPE_BUILDER

+     */

+    public static final short PULL_TYPE_BUILDER = 1;

+

+    /**

+     * Field ARRAY_ITEM_NSURI

+     */

+    public static final String ARRAY_ITEM_NSURI =

+            "http://axis.apache.org/encoding/Arrays";

+

+    /**

+     * Field ARRAY_ITEM_LOCALNAME

+     */

+    public static final String ARRAY_ITEM_LOCALNAME = "item";

+

+    /**

+     * Field ARRAY_ITEM_NS_PREFIX

+     */

+    public static final String ARRAY_ITEM_NS_PREFIX = "arrays";

+

+    /**

+     * Field ARRAY_ITEM_QNAME

+     */

+    public static final String ARRAY_ITEM_QNAME =

+            OMConstants.ARRAY_ITEM_NS_PREFIX + ':'

+            + OMConstants.ARRAY_ITEM_LOCALNAME;

+

+    /**

+     * Field DEFAULT_CHAR_SET_ENCODING specifies the default

+     * character encoding scheme to be used

+     */

+    public static final String DEFAULT_CHAR_SET_ENCODING = "utf-8";

+    public static final String DEFAULT_XML_VERSION = "1.0";

+    

+    

+    public static final String XMLNS_URI =

+        "http://www.w3.org/XML/1998/namespace";

+

+    public static final String XMLNS_NS_URI = "http://www.w3.org/2000/xmlns/";

+	public final static String XMLNS_NS_PREFIX = "xmlns";

+    

+    public static final String XMLNS_PREFIX =

+        "xml";

+    String IS_BINARY = "Axiom.IsBinary";

+    String DATA_HANDLER = "Axiom.DataHandler";

+    String IS_DATA_HANDLERS_AWARE = "IsDatahandlersAwareParsing";

+

+    /**

+     * No its not a mistake. This is the default nsURI of the default namespace of a node

+     */

+    public static final String DEFAULT_DEFAULT_NAMESPACE = "\"\"";

+    

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMContainer.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMContainer.java
new file mode 100644
index 0000000..8d1e0a3
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMContainer.java
@@ -0,0 +1,100 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import javax.xml.namespace.QName;

+import java.util.Iterator;

+

+/**

+ * Captures the operations related to containment shared by both a document and an element.

+ *

+ * <p>Exposes the ability to add, find, and iterate over the children of a document or

+ * element.</p>

+ */

+public interface OMContainer {

+

+    /**

+     * Adds the given node as the last child. One must preserve the order of children, 

+     * in this operation.

+     * Tip : appending the new child is preferred.

+     *

+     * @param omNode

+     */

+    public void addChild(OMNode omNode);

+

+    /**

+     * Returns an iterator for child nodes matching the criteria indicated by the given QName.

+     *

+     * <p>This function searches in three ways:

+     *  <ul>

+     *   <li>Exact match - Both parts of the passed QName are non-null.  Only children with the

+     *      same namespace and local name will be returned.

+     *   </li>

+     *  <li>Namespace match - The local name of the passed QName is null.  All children matching the

+     *      namespace will be returned by the iterator.

+     *  </li>

+     *  <li>Local name match - The namespace of the passed QName is null.  All children with the

+     *      matching local name will be returned by the iterator.

+     *  </li>

+     * </ul>

+     *

+     * <p>

+     * <b>Example:</b> <code>header.getChildrenWithName( new QName(ADDRESSING_NAMESPACE, null));</code>

+     *  will return all of the "addressing" headers.

+     * </p>

+     *

+     * @param elementQName The QName specifying namespace and local name to match.

+     * @return Returns an iterator of {@link OMElement} items that match the given QName appropriately.

+     */

+    public Iterator getChildrenWithName(QName elementQName);

+

+    /**

+     * Returns the first child in document order that matches the given QName criteria.

+     *

+     * <p>The QName filter is applied as in the function {@link #getChildrenWithName}.</p>

+     *

+     * @param elementQName The QName to use for matching.

+     *

+     * @return Returns the first element in document order that matches the <tt>elementQName</tt> criteria.

+     *

+     * @see #getChildrenWithName

+     *

+     * @throws OMException Could indirectly trigger building of child nodes.

+     */

+    public OMElement getFirstChildWithName(QName elementQName) throws OMException;

+

+    /**

+     * Returns an iterator for the children of the container.

+     *

+     * @return Returns a {@link Iterator} of children, all of which implement {@link OMNode}.

+     *

+     * @see #getFirstChildWithName

+     * @see #getChildrenWithName

+     */

+    public Iterator getChildren();

+

+    /**

+     * Gets the first child.

+     *

+     * @return Returns the first child.  May return null if the container has no children.

+     */

+    public OMNode getFirstOMChild();

+

+    public boolean isComplete();

+

+    public void buildNext();

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDataSource.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDataSource.java
new file mode 100644
index 0000000..1e3cea8
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDataSource.java
@@ -0,0 +1,59 @@
+/**
+ * 
+ */
+package org.apache.axiom.om;
+
+import java.io.OutputStream;
+import java.io.Writer;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * Interface to arbitrary source of XML element data. This provides the hook for
+ * using a general data source (such as data binding frameworks) as the backing
+ * source of data for an element.
+ */
+public interface OMDataSource
+{
+    /**
+     * Serializes element data directly to stream.
+     *
+     * @param output destination stream for element XML text
+     * @param format output format information (<code>null</code> if none; may
+     * be ignored if not supported by data binding even if supplied)
+     * @throws XMLStreamException
+     */
+    public void serialize(OutputStream output, OMOutputFormat format)
+            throws XMLStreamException;
+    
+    /**
+     * Serializes element data directly to writer.
+     *
+     * @param writer destination writer for element XML text
+     * @param format output format information (<code>null</code> if none; may
+     * be ignored if not supported by data binding even if supplied)
+     * @throws XMLStreamException
+     */
+    public void serialize(Writer writer, OMOutputFormat format)
+            throws XMLStreamException;
+    
+    /**
+     * Serializes element data directly to StAX writer.
+     *
+     * @param xmlWriter destination writer
+     * @throws XMLStreamException
+     */
+    public void serialize(XMLStreamWriter xmlWriter)
+            throws XMLStreamException;
+    
+    /**
+     * Get parser for element data. In the general case this may require the
+     * data source to serialize data as XML text and then parse that text.
+     *
+     * @return element parser
+     * @throws XMLStreamException
+     */
+    public XMLStreamReader getReader() throws XMLStreamException;
+}
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDocType.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDocType.java
new file mode 100644
index 0000000..75871f1
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDocType.java
@@ -0,0 +1,34 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+/**

+ * Interface OMDocType

+ */

+public interface OMDocType extends OMNode {

+    /**

+     * Returns the value of this DocType.

+     * @return Returns String.

+     */

+    public String getValue();

+

+    /**

+     * Sets the content of this DocType to the specified string.

+     * @param text

+     */

+    public void setValue(String text);

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDocument.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDocument.java
new file mode 100644
index 0000000..13cc124
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMDocument.java
@@ -0,0 +1,116 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import javax.xml.stream.XMLStreamException;

+import java.io.OutputStream;

+

+

+public interface OMDocument extends OMContainer {

+

+    /**

+     * Field XML_10 XML Version 1.0

+     */

+    public final static String XML_10 = "1.0";

+

+    /**

+     * Field XML_11 XML Version 1.1

+     */

+    public final static String XML_11 = "1.1";

+

+    /**

+     * Returns the document element.

+     * @return Returns OMElement.

+     */

+    public OMElement getOMDocumentElement();

+

+    /**

+     * Sets the document element of the XML document.

+     * @param rootElement

+     */

+    public void setOMDocumentElement(OMElement rootElement);

+

+    /**

+     * Returns the XML version.

+     * @return Returns String.

+     */

+    public String getXMLVersion();

+

+    /**

+     * Sets the XML version.

+     * @see org.apache.axiom.om.impl.llom.OMDocumentImpl#XML_10 XML 1.0

+     * @see org.apache.axiom.om.impl.llom.OMDocumentImpl#XML_11 XML 1.1

+     * @param version

+     */

+    public void setXMLVersion(String version);

+

+    /**

+     * Returns the character set encoding scheme.

+     * @return Returns String.

+     */

+    public String getCharsetEncoding();

+

+    /**

+     * Sets the character set encoding scheme to be used.

+     * @param charsetEncoding

+     */

+    public void setCharsetEncoding(String charsetEncoding);

+

+    /**

+     * XML standalone value.

+     * This will be yes, no or null (if not available)

+     * @return Returns boolean.

+     */

+    public String isStandalone();

+    public void setStandalone(String isStandalone);

+

+    /**

+     * Serializes the OMDocument.

+     * @param output

+     * @param format

+     * @throws XMLStreamException

+     */

+    public void serializeAndConsume(OutputStream output, OMOutputFormat format) throws XMLStreamException;

+

+    /**

+     * Builds the OM node/tree and then serializes the document.

+     * @param output

+     * @param format

+     * @throws XMLStreamException

+     */

+    public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException;

+

+    /**

+     * Serializes the OMDocument.

+     * @param output

+     * @throws XMLStreamException

+     */

+    public void serializeAndConsume(OutputStream output) throws XMLStreamException;

+

+    /**

+     * Serializes the document with cache on.

+     * @param output

+     * @throws XMLStreamException

+     */

+    public void serialize(OutputStream output) throws XMLStreamException;

+    

+    /**

+     * Returns the OMFactory that created this object

+     */

+    public OMFactory getOMFactory();

+    

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMElement.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMElement.java
new file mode 100644
index 0000000..560068a
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMElement.java
@@ -0,0 +1,329 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.util.Iterator;
+
+/**
+ * A particular kind of node that represents an element infoset information item.
+ * <p/>
+ * <p>An element has a collection of children, attributes, and namespaces.</p>
+ * <p>In contrast with DOM, this interface exposes namespaces separately from the
+ * attributes.</p>
+ */
+public interface OMElement extends OMNode, OMContainer {
+
+    /**
+     * Returns a filtered list of children - just the elements.
+     *
+     * @return Returns an iterator over the child elements.
+     * @see #getChildren()
+     * @see #getChildrenWithName(javax.xml.namespace.QName)
+     */
+    public Iterator getChildElements();
+
+    /**
+     * Creates a namespace in the current element scope.
+     *
+     * @param uri    The namespace to declare in the current scope.  The
+     *               caller is expected to ensure that the URI is a valid namespace name.
+     * @param prefix The prefix to associate with the given namespace.
+     *               The caller is expected to ensure that this is a valid XML prefix.
+     *               If "" is given, first this will check for an existing namespace
+     *               with the same uri. If not found, a prefix will be auto-generated.
+     * @return Returns the created namespace information item.
+     * @see #declareNamespace(OMNamespace)
+     * @see #findNamespace(String, String)
+     * @see #getAllDeclaredNamespaces()
+     */
+    public OMNamespace declareNamespace(String uri, String prefix);
+
+
+    /**
+     * This will declare a default namespace for this element explicitly
+     * @param uri
+     */
+    public OMNamespace declareDefaultNamespace(String uri);
+
+    /**
+     * This will retrieve the default namespace of this element, if available. null returned if none
+     * is found.
+     */
+    public OMNamespace getDefaultNamespace();
+
+    /**
+     * Declares a namespace with the element as its scope.
+     *
+     * @param namespace The namespace to declare.
+     * @return Returns the namespace parameter passed.
+     * @see #declareNamespace(String, String)
+     * @see #findNamespace(String, String)
+     * @see #getAllDeclaredNamespaces()
+     */
+    public OMNamespace declareNamespace(OMNamespace namespace);
+
+    /**
+     * Finds a namespace with the given uri and prefix, in the scope of the hierarchy.
+     * <p/>
+     * <p>Searches from the current element and goes up the hiararchy until a match is found.
+     * If no match is found, returns <tt>null</tt>.</p>
+     * <p/>
+     * <p>Either <tt>prefix</tt> or <tt>uri</tt> should be null.  Results are undefined
+     * if both are specified.</p>
+     *
+     * @param uri    The namespace to look for.  If this is specified, <tt>prefix</tt> should be null.
+     * @param prefix The prefix to look for.  If this is specified, <tt>uri</tt> should be null.
+     * @return Returns the matching namespace declaration, or <tt>null</tt> if none was found.
+     * @see #declareNamespace(String, String)
+     * @see #declareNamespace(OMNamespace)
+     * @see #getAllDeclaredNamespaces()
+     */
+    public OMNamespace findNamespace(String uri, String prefix);
+
+    /**
+     * Checks for a namespace in the context of this element with the given prefix and
+     * returns the relevant namespace object, if available. If not available, returns null.
+     *
+     * @param prefix
+     */
+    public OMNamespace findNamespaceURI(String prefix);
+
+    /**
+     * Returns an iterator for all of the namespaces declared on this element.
+     * <p/>
+     * <p>If you're interested in all namespaces in scope, you need to call this function
+     * for all parent elements as well.  Note that the iterator may be invalidated by
+     * any call to either <tt>declareNamespace</tt> function.
+     * </p>
+     *
+     * @return Returns an iterator over the {@link OMNamespace} items declared on the current element.
+     * @see #findNamespace(String, String)
+     * @see #declareNamespace(String, String)
+     * @see #declareNamespace(OMNamespace)
+     */
+    public Iterator getAllDeclaredNamespaces() throws OMException;
+
+    /**
+     * Returns a list of OMAttributes.
+     * 
+     * <p>Note that the iterator returned by this function will be invalidated by
+     * any <tt>addAttribute</tt> call.
+     * </p>
+     *
+     * @return Returns an {@link Iterator} of {@link OMAttribute} items associated with the element.
+     * @see #getAttribute
+     * @see #addAttribute(OMAttribute)
+     * @see #addAttribute(String, String, OMNamespace)
+     */
+    public Iterator getAllAttributes();
+
+    /**
+     * Returns a named attribute if present.
+     *
+     * @param qname the qualified name to search for
+     * @return Returns an OMAttribute with the given name if found, or null
+     */
+    public OMAttribute getAttribute(QName qname);
+
+    /**
+     * Returns a named attribute's value, if present.
+     *
+     * @param qname the qualified name to search for
+     * @return Returns a String containing the attribute value, or null
+     */
+    public String getAttributeValue(QName qname);
+
+    /**
+     * Adds an attribute to this element.
+     * <p/>
+     * <p>There is no order implied by added attributes.</p>
+     *
+     * @param attr The attribute to add.
+     * @return Returns the passed in attribute.
+     */
+    public OMAttribute addAttribute(OMAttribute attr);
+
+    /**
+     * Adds an attribute to the current element.
+     * <p/>
+     * <p>This function does not check to make sure that the given attribute value can be serialized directly
+     * as an XML value.  The caller may, for example, pass a string with the character 0x01.
+     *
+     * @param attributeName The "local name" for the attribute.
+     * @param value         The string value of the attribute.
+     * @param ns            The namespace has to be one of the in scope namespace. i.e. the passed namespace
+     *                      must be declared in the parent element of this attribute or ancestors of the parent element of the attribute.
+     * @return Returns the added attribute.
+     */
+    public OMAttribute addAttribute(String attributeName, String value,
+                                    OMNamespace ns);
+
+    /**
+     * Method removeAttribute
+     *
+     * @param attr
+     */
+    public void removeAttribute(OMAttribute attr);
+
+    /**
+     * Method setBuilder.
+     *
+     * @param wrapper
+     */
+    public void setBuilder(OMXMLParserWrapper wrapper);
+
+    /**
+     * Returns the builder object.
+     *
+     * @return Returns the builder object used to construct the underlying XML infoset on the fly.
+     */
+    public OMXMLParserWrapper getBuilder();
+
+    /**
+     * Sets the first child.
+     *
+     * @param node
+     */
+    public void setFirstChild(OMNode node);
+
+    /**
+     * Returns the first child element of the element.
+     *
+     * @return Returns the first child element of the element, or <tt>null</tt> if none was found.
+     */
+
+    public OMElement getFirstElement();
+
+
+    /**
+     * Returns the pull parser that will generate the pull
+     * events relevant to THIS element.
+     * <p/>
+     * <p>Caching is on.</p>
+     *
+     * @return Returns an XMLStreamReader relative to this element.
+     */
+    public XMLStreamReader getXMLStreamReader();
+
+    /**
+     * Returns the pull parser that will generate the pull
+     * events relevant to THIS element.
+     * <p/>
+     * <p>Caching is off.</p>
+     *
+     * @return Returns an XMLStreamReader relative to this element, with no caching.
+     */
+    public XMLStreamReader getXMLStreamReaderWithoutCaching();
+
+    /**
+     * @param text
+     */
+    public void setText(String text);
+    public void setText(QName text);
+
+    /**
+     * Returns the non-empty text children as a String.
+     *
+     * @return Returns a String representing the concatenation of the child text nodes.
+     */
+    public String getText();
+
+    /**
+     * OMText can contain its information as a QName as well. This will return the text as a QName 
+     */
+    public QName getTextAsQName();
+
+    /**
+     * Returns the local name of the element.
+     *
+     * @return Returns the local name of the element.
+     */
+    public String getLocalName();
+
+    /**
+     * Method setLocalName
+     *
+     * @param localName
+     */
+    public void setLocalName(String localName);
+
+    /**
+     * @return Returns the OMNamespace object associated with this element
+     * @throws OMException
+     */
+    public OMNamespace getNamespace() throws OMException;
+
+    /**
+     * Sets the Namespace. This will first search for a namespace in the current scope with the given
+     * namespace. If no namespace is found with the given details, then it will declare a new one. Then
+     * that namespace will be assigned to this element.
+     *
+     * @param namespace
+     */
+    public void setNamespace(OMNamespace namespace);
+
+    /**
+     * This will not search the namespace in the scope nor will declare in the current element, as
+     * in setNamespace(OMNamespace). This will just assign the given namespace to the element. 
+     * @param namespace
+     */
+    public void setNamespaceWithNoFindInCurrentScope(OMNamespace namespace);
+
+
+    /**
+     * Gets the QName of this node.
+     *
+     * @return Returns the {@link QName} for the element.
+     */
+    public QName getQName();
+
+    /**
+     * This is a convenience method only. This will basically serialize the given OMElement
+     * to a String but will build the OMTree in the memory
+     */
+    public String toString();
+
+    /**
+     * This is a convenience method only. This basically serializes the given OMElement
+     * to a String but will NOT build the OMTree in the memory. So you are at your own risk of
+     * losing information.
+     */
+    public String toStringWithConsume() throws XMLStreamException;
+
+
+    /**
+     * Turns a prefix:local qname string into a proper QName, evaluating it in the OMElement context.
+     * Unprefixed qnames resolve to the local namespace.
+     *
+     * @param qname prefixed qname string to resolve
+     * @return Returns null for any failure to extract a qname.
+     */
+    QName resolveQName(String qname);
+
+    /**
+     * Clones this element. Since both elements are build compleletely, you will
+     * lose the differed building capability.
+     * @return Returns OMElement.
+     */
+    public OMElement cloneOMElement();
+
+    public void setLineNumber(int lineNumber);
+    public int getLineNumber();
+}
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMException.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMException.java
new file mode 100644
index 0000000..5844efd
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMException.java
@@ -0,0 +1,59 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+/**

+ * Class OMException

+ */

+public class OMException extends RuntimeException {

+    

+    private static final long serialVersionUID = -730218408325095333L;

+

+    /**

+     * Constructor OMException

+     */

+    public OMException() {

+    }

+

+    /**

+     * Constructor OMException

+     *

+     * @param message

+     */

+    public OMException(String message) {

+        super(message);

+    }

+

+    /**

+     * Constructor OMException

+     *

+     * @param message

+     * @param cause

+     */

+    public OMException(String message, Throwable cause) {

+        super(message, cause);

+    }

+

+    /**

+     * Constructor OMException

+     *

+     * @param cause

+     */

+    public OMException(Throwable cause) {

+        super(cause);

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMFactory.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMFactory.java
new file mode 100644
index 0000000..fd2e742
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMFactory.java
@@ -0,0 +1,183 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import javax.xml.namespace.QName;

+

+/**

+ * Class OMFactory

+ */

+public interface OMFactory {

+

+    /**

+     * Creates a new OMDocument.

+     */

+    public OMDocument createOMDocument();

+

+    public OMDocument createOMDocument(OMXMLParserWrapper builder);

+

+

+    /**

+     * @param localName

+     * @param ns - This can be null

+     */

+    public OMElement createOMElement(String localName, OMNamespace ns);

+

+    public OMElement createOMElement(String localName, OMNamespace ns, OMContainer parent) throws OMException;

+

+    /**

+     * @param localName

+     * @param ns - this can be null

+     * @param parent

+     * @param builder

+     */

+    public OMElement createOMElement(String localName, OMNamespace ns,

+                                     OMContainer parent,

+                                     OMXMLParserWrapper builder);

+

+    /**

+     * Construct element with arbitrary data source. This is an optional

+     * operation which may not be supported by all factories.

+     *

+     * @param source

+     * @param localName

+     * @param ns

+     */

+    public OMElement createOMElement(OMDataSource source, String localName,

+                                     OMNamespace ns);

+

+    /**

+     * This is almost the same as as createOMElement(localName,OMNamespace) method above.

+     * But some people may, for some reason, need to use the conventional method of putting a namespace.

+     * Or in other words people might not want to use the new OMNamespace.

+     * Well, this is for those people.

+     *

+     * @param localName

+     * @param namespaceURI

+     * @param namespacePrefix

+     * @return Returns the newly created OMElement.

+     */

+    public OMElement createOMElement(String localName,

+                                     String namespaceURI,

+                                     String namespacePrefix);

+

+    /**

+     * QName(localPart),

+     * QName(namespaceURI, localPart) - a prefix will be assigned to this

+     * QName(namespaceURI, localPart, prefix)

+     *

+     * @param qname

+     * @param parent

+     * @return Returns the new OMElement.

+     * @throws OMException

+     */

+    public OMElement createOMElement(QName qname, OMContainer parent)

+            throws OMException;

+

+    /**

+     * @param uri

+     * @param prefix

+     * @return Returns OMNameSpace.

+     */

+    public OMNamespace createOMNamespace(String uri, String prefix);

+

+    /**

+     * @param parent

+     * @param text

+     * @return Returns OMText.

+     */

+    public OMText createOMText(OMContainer parent, String text);

+

+    /**

+     * @param parent

+     * @param text   - This text itself can contain a namespace inside it.

+     */

+    public OMText createOMText(OMContainer parent, QName text);

+

+    /**

+     * @param parent

+     * @param text

+     * @param type   - this should be either of XMLStreamConstants.CHARACTERS, XMLStreamConstants.CDATA,

+     *               XMLStreamConstants.SPACE, XMLStreamConstants.ENTITY_REFERENCE

+     * @return Returns OMText.

+     */

+    public OMText createOMText(OMContainer parent, String text, int type);

+    public OMText createOMText(OMContainer parent, char[] charArary, int type);

+

+    /**

+     * @param parent

+     * @param text   - This text itself can contain a namespace inside it.

+     * @param type

+     */

+    public OMText createOMText(OMContainer parent, QName text, int type);

+

+    /**

+     * @param s

+     * @return Returns OMText.

+     */

+    public OMText createOMText(String s);

+

+    /**

+     * @param s

+     * @param type - OMText node can handle SPACE, CHARACTERS, CDATA and ENTITY REFERENCES. For Constants, use either

+     *             XMLStreamConstants or constants found in OMNode.

+     * @return Returns OMText.

+     */

+    public OMText createOMText(String s, int type);

+

+    public OMText createOMText(String s, String mimeType, boolean optimize);

+

+    public OMText createOMText(Object dataHandler, boolean optimize);

+

+    public OMText createOMText(OMContainer parent, String s, String mimeType,

+                               boolean optimize);

+

+    public OMText createOMText(String contentID, OMContainer parent,

+                               OMXMLParserWrapper builder);

+

+    public OMAttribute createOMAttribute(String localName,

+                                         OMNamespace ns,

+                                         String value);

+

+    /**

+     * Creates DocType/DTD.

+     *

+     * @param parent

+     * @param content

+     * @return Returns doctype.

+     */

+    public OMDocType createOMDocType(OMContainer parent, String content);

+

+    /**

+     * Creates a PI.

+     *

+     * @param parent

+     * @param piTarget

+     * @param piData

+     * @return Returns OMProcessingInstruction.

+     */

+    public OMProcessingInstruction createOMProcessingInstruction(OMContainer parent, String piTarget, String piData);

+

+    /**

+     * Creates a comment.

+     *

+     * @param parent

+     * @param content

+     * @return Returns OMComment.

+     */

+    public OMComment createOMComment(OMContainer parent, String content);

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMFactoryException.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMFactoryException.java
new file mode 100644
index 0000000..73246ce
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMFactoryException.java
@@ -0,0 +1,59 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+/**

+ * Class OMFactoryException

+ */

+public class OMFactoryException extends OMException {

+    

+    private static final long serialVersionUID = -9107212004470940807L;

+

+    /**

+     * Constructor OMFactoryException

+     */

+    public OMFactoryException() {

+    }

+

+    /**

+     * Constructor OMFactoryException

+     *

+     * @param message

+     */

+    public OMFactoryException(String message) {

+        super(message);

+    }

+

+    /**

+     * Constructor OMFactoryException

+     *

+     * @param message

+     * @param cause

+     */

+    public OMFactoryException(String message, Throwable cause) {

+        super(message, cause);

+    }

+

+    /**

+     * Constructor OMFactoryException

+     *

+     * @param cause

+     */

+    public OMFactoryException(Throwable cause) {

+        super(cause);

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMNamespace.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMNamespace.java
new file mode 100644
index 0000000..57972c5
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMNamespace.java
@@ -0,0 +1,53 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+/**

+ * Interface OMNamespace

+ */

+public interface OMNamespace {

+    /**

+     * Method equals.

+     *

+     * @param uri

+     * @param prefix

+     * @return Returns boolean.

+     */

+    public boolean equals(String uri, String prefix);

+

+    /**

+     * Method getPrefix.

+     *

+     * @return Returns String.

+     */

+    public String getPrefix();

+

+    /**

+     * Method getName.

+     *

+     * @deprecated This method is deprecated. Please use getNamespaceURI() method instead.

+     *

+     * @return Returns String.

+     */

+    public String getName();

+

+    /**

+     * Provides the namespace URI of this namespace.

+     * @return - the namespace URI of the namespace.

+     */

+    public String getNamespaceURI();

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMNode.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMNode.java
new file mode 100644
index 0000000..23f3b9e
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMNode.java
@@ -0,0 +1,305 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import javax.xml.stream.XMLStreamConstants;

+import javax.xml.stream.XMLStreamException;

+import javax.xml.stream.XMLStreamWriter;

+import java.io.OutputStream;

+import java.io.Writer;

+

+/**

+ * Defines the base interface used by most of the XML object model within Axis.

+ * 

+ * <p>

+ * This tree model for XML captures the idea of deferring the construction of

+ * child nodes until they are needed. The <code>isComplete</code> function

+ * identifies whether or not a particular node has been fully parsed. A node may

+ * not be fully parsed, for example, if all of the children of an element have

+ * not yet been parsed.

+ * </p>

+ * 

+ * <p>

+ * In comparison to DOM, in this model, you will not find document fragments, or

+ * entities. In addition, while {@link OMDocument} and {@link OMAttribute}

+ * exist, neither is an extension of <code>OMNode</code>.

+ * </p>

+ */

+public interface OMNode {

+	/**

+	 * The node is an <code>Element</code>.

+	 * 

+	 * @see #getType()

+	 */

+	public static final short ELEMENT_NODE = 1;

+

+	/**

+	 * The node is a <code>Text</code> node.

+	 * 

+	 * @see #getType()

+	 */

+	public static final short TEXT_NODE = XMLStreamConstants.CHARACTERS;

+

+	/**

+	 * The node is a <code>CDATASection</code>.

+	 * 

+	 * @see #getType()

+	 */

+	public static final short CDATA_SECTION_NODE = XMLStreamConstants.CDATA;

+

+	/**

+	 * The node is a <code>Comment</code>.

+	 * 

+	 * @see #getType()

+	 */

+	public static final short COMMENT_NODE = XMLStreamConstants.COMMENT;

+

+	/**

+	 * This node is a <code>DTD</code>.

+	 * 

+	 * @see #getType()

+	 */

+	public static final short DTD_NODE = XMLStreamConstants.DTD;

+

+	/**

+	 * This node is a <code>ProcessingInstruction</code>.

+	 * 

+	 * @see #getType()

+	 */

+	public static final short PI_NODE = XMLStreamConstants.PROCESSING_INSTRUCTION;

+

+	/**

+	 * This node is an <code>Entity Reference</code>.

+	 * 

+	 * @see #getType()

+	 */

+	public static final short ENTITY_REFERENCE_NODE = XMLStreamConstants.ENTITY_REFERENCE;

+

+	/**

+	 * This node is an <code>Entity Reference</code>.

+	 * 

+	 * @see #getType()

+	 */

+	public static final short SPACE_NODE = XMLStreamConstants.SPACE;

+

+	/**

+	 * Returns the parent containing node.

+	 * 

+	 * <p>

+	 * Returns the parent container, which may be either an {@link OMDocument}

+	 * or {@link OMElement}.

+	 * 

+	 * @return The {@link OMContainer} of the node.

+	 */

+	public OMContainer getParent();

+

+	/**

+	 * Returns the next sibling in document order.

+	 * 

+	 * @return Returns the next sibling in document order.

+	 */

+	public OMNode getNextOMSibling() throws OMException;

+

+	/**

+	 * Indicates whether parser has parsed this information item completely or

+	 * not. If some info are not available in the item, one has to check this

+	 * attribute to make sure that, this item has been parsed completely or not.

+	 * 

+	 * @return Returns boolean.

+	 */

+	public boolean isComplete();

+

+	/**

+	 * Removes a node (and all of its children) from its containing parent.

+	 * 

+	 * <p>

+	 * Removes a node from its parent. Partially complete nodes will be

+	 * completed before they are detached from the model. A node cannot be

+	 * detached until its next sibling has been identified, so that the next

+	 * sibling and parent can be updated appropriately. Please note that this

+	 * will not handle the namespaces. For example, if there you have used a

+	 * namespace within the detaching node and which is defined outside the

+	 * detaching node, user has to handle it manually.

+	 * </p>

+	 * 

+	 * @throws OMException

+	 *             If a node is not complete, the detach can trigger further

+	 *             parsing, which may cause an exception.

+	 */

+	public OMNode detach() throws OMException;

+

+	/**

+	 * Discards a node.

+	 * 

+	 * <p>

+	 * Discard goes to the parser level and if the element is not completely

+	 * built, then it will be completely skipped at the parser level.

+	 * </p>

+	 * 

+	 * @throws OMException

+	 */

+	public void discard() throws OMException;

+

+	/**

+	 * Inserts a new sibling after the current node.

+	 * 

+	 * @param sibling

+	 *            The node that will be added after the current node.

+	 * 

+	 * @throws OMException

+	 */

+	public void insertSiblingAfter(OMNode sibling) throws OMException;

+

+	/**

+	 * Inserts a sibling just before the current node.

+	 * 

+	 * @param sibling

+	 *            The node that will be added before the current node.

+	 * @throws OMException

+	 */

+	public void insertSiblingBefore(OMNode sibling) throws OMException;

+

+	/**

+	 * Returns the type of node.

+	 * 

+	 * @return Returns one of {@link #ELEMENT_NODE}, {@link #TEXT_NODE},

+	 *         {@link #CDATA_SECTION_NODE}, {@link #COMMENT_NODE},

+	 *         {@link #DTD_NODE}, {@link #PI_NODE},

+	 *         {@link #ENTITY_REFERENCE_NODE}, {@link #SPACE_NODE}, or

+	 *         {@link #TEXT_NODE}.

+	 */

+	public int getType();

+

+	/**

+	 * Gets the previous sibling.

+	 * 

+	 * @return Returns node.

+	 */

+	public OMNode getPreviousOMSibling();

+

+	/**

+	 * Serializes the node with caching.

+	 * 

+	 * @param xmlWriter

+	 * @throws XMLStreamException

+	 */

+	public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException;

+

+	/**

+	 * Serializes the node with caching.

+	 * 

+	 * @param output

+	 * @throws XMLStreamException

+	 */

+	public void serialize(OutputStream output) throws XMLStreamException;

+

+	/**

+	 * Serializes the node with caching.

+	 * 

+	 * @param writer

+	 * @throws XMLStreamException

+	 */

+	public void serialize(Writer writer) throws XMLStreamException;

+

+	/**

+	 * Serializes the node with caching.

+	 * 

+	 * @param output

+	 * @param format

+	 * @throws XMLStreamException

+	 */

+	public void serialize(OutputStream output, OMOutputFormat format)

+			throws XMLStreamException;

+

+	/**

+	 * Serializes the node with caching.

+	 * 

+	 * @param writer

+	 * @param format

+	 * @throws XMLStreamException

+	 */

+	public void serialize(Writer writer, OMOutputFormat format)

+			throws XMLStreamException;

+

+	/**

+	 * Serializes the node without caching.

+	 * 

+	 * @param xmlWriter

+	 * @throws XMLStreamException

+	 */

+	public void serializeAndConsume(XMLStreamWriter xmlWriter)

+			throws XMLStreamException;

+

+	/**

+	 * Serializes the node without caching.

+	 * 

+	 * @param output

+	 * @throws XMLStreamException

+	 */

+	public void serializeAndConsume(OutputStream output)

+			throws XMLStreamException;

+

+	/**

+	 * Serializes the node without caching.

+	 * 

+	 * @param writer

+	 * @throws XMLStreamException

+	 */

+	public void serializeAndConsume(Writer writer) throws XMLStreamException;

+

+	/**

+	 * Serializes the node without caching.

+	 * 

+	 * @param output

+	 * @param format

+	 * @throws XMLStreamException

+	 */

+	public void serializeAndConsume(OutputStream output, OMOutputFormat format)

+			throws XMLStreamException;

+

+	/**

+	 * Serializes the node without caching.

+	 * 

+	 * @param writer

+	 * @param format

+	 * @throws XMLStreamException

+	 */

+	public void serializeAndConsume(Writer writer, OMOutputFormat format)

+			throws XMLStreamException;

+

+	/**

+	 * Builds itself.

+	 */

+	public void build();

+

+	/**

+	 * Builds itself with the OMText binary content. AXIOM supports two levels

+	 * of deffered building. First is deffered building of AXIOM using StAX.

+	 * Second level is the deffered building of attachments. AXIOM reads in the

+	 * attachements from the stream only when user asks by calling

+	 * getDataHandler(). build() method builds the OM without the attachments.

+	 * buildAll() builds the OM together with attachement data. This becomes

+	 * handy when user wants to free the input stream.

+	 */

+	public void buildWithAttachments();

+

+	/**

+	 * Returns the OMFactory that created this object

+	 */

+	public OMFactory getOMFactory();

+

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
new file mode 100644
index 0000000..c65e524
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
@@ -0,0 +1,182 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om;
+
+import org.apache.axiom.om.impl.MTOMConstants;
+import org.apache.axiom.om.util.UUIDGenerator;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAP12Constants;
+
+
+/**
+ * Formats options for OM Output.
+ * 
+ * Setting of all the properties in a OMOutputFormat should be done before
+ * calling the getContentType() method. It is advised to set all the properties
+ * at the creation time of the OMOutputFormat and not to change them later.
+ */
+public class OMOutputFormat {
+    private String mimeBoundary = null;
+    private String rootContentId = null;
+    private int nextid = 0;
+    private boolean doOptimize;
+    private boolean doingSWA;
+    private boolean isSoap11 = true;
+
+    /**
+     * Field DEFAULT_CHAR_SET_ENCODING. Specifies the default
+     * character encoding scheme to be used.
+     */
+    public static final String DEFAULT_CHAR_SET_ENCODING = "utf-8";
+
+    private String charSetEncoding;
+    private String xmlVersion;
+    private boolean ignoreXMLDeclaration = false;
+
+
+    public OMOutputFormat() {
+    }
+
+    public boolean isOptimized() {
+        return doOptimize;
+    }
+
+    public String getContentType() {
+        String SOAPContentType;
+        if (isSoap11) {
+            SOAPContentType = SOAP11Constants.SOAP_11_CONTENT_TYPE;
+        } else {
+            SOAPContentType = SOAP12Constants.SOAP_12_CONTENT_TYPE;
+        }
+        // MTOM is given priority
+        if (isOptimized()) {
+            return this.getContentTypeForMTOM(SOAPContentType);
+        } else if (isDoingSWA())
+        {
+        	return this.getContentTypeForSwA(SOAPContentType);
+        }
+        else {
+            return SOAPContentType;
+        }
+    }
+
+    public String getMimeBoundary() {
+        if (mimeBoundary == null) {
+        	mimeBoundary =
+                "MIMEBoundary"
+                        + UUIDGenerator.getUUID().replace(':','_');
+
+        }
+        return mimeBoundary;
+    }
+
+    public String getRootContentId() {
+        if (rootContentId == null) {
+            rootContentId =
+                    "0."
+                            + UUIDGenerator.getUUID()
+                            + "@apache.org";
+        }
+        return rootContentId;
+    }
+
+    public String getNextContentId() {
+        nextid++;
+        return nextid
+                + "."
+                + UUIDGenerator.getUUID()
+                + "@apache.org";
+    }
+
+    /**
+     * Returns the character set encoding scheme. If the value of the
+     * charSetEncoding is not set then the default will be returned.
+     *
+     * @return Returns encoding string.
+     */
+    public String getCharSetEncoding() {
+        return this.charSetEncoding;
+    }
+
+    public void setCharSetEncoding(String charSetEncoding) {
+        this.charSetEncoding = charSetEncoding;
+    }
+
+    public String getXmlVersion() {
+        return xmlVersion;
+    }
+
+    public void setXmlVersion(String xmlVersion) {
+        this.xmlVersion = xmlVersion;
+    }
+
+    public void setSOAP11(boolean b) {
+        isSoap11 = b;
+    }
+    
+    public boolean isSOAP11() {
+        return isSoap11;
+    }
+
+    public boolean isIgnoreXMLDeclaration() {
+        return ignoreXMLDeclaration;
+    }
+
+    public void setIgnoreXMLDeclaration(boolean ignoreXMLDeclaration) {
+        this.ignoreXMLDeclaration = ignoreXMLDeclaration;
+    }
+
+    public void setDoOptimize(boolean b) {
+        doOptimize = b;
+    }
+
+	public boolean isDoingSWA() {
+		return doingSWA;
+	}
+
+	public void setDoingSWA(boolean doingSWA) {
+		this.doingSWA = doingSWA;
+	}
+
+	public String getContentTypeForMTOM(String SOAPContentType) {
+	    StringBuffer sb = new StringBuffer();
+	    sb.append("multipart/related");
+	    sb.append("; ");
+	    sb.append("boundary=");
+	    sb.append(getMimeBoundary());
+	    sb.append("; ");  
+	  	sb.append("type=\""+MTOMConstants.MTOM_TYPE+"\"");
+	    sb.append("; ");
+	    sb.append("start=\"<" + getRootContentId() + ">\"");
+	    sb.append("; ");
+	    sb.append("start-info=\""+SOAPContentType+"\"");
+	    return sb.toString();
+	}
+	
+	public String getContentTypeForSwA(String SOAPContentType) {
+	    StringBuffer sb = new StringBuffer();
+	    sb.append("multipart/related");
+	    sb.append("; ");
+	    sb.append("boundary=");
+	    sb.append(getMimeBoundary());
+	    sb.append("; ");  
+	  	sb.append("type=\""+SOAPContentType+"\"");
+	    sb.append("; ");
+	    sb.append("start=\"<" + getRootContentId() + ">\"");
+	    return sb.toString();
+	}
+}
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMProcessingInstruction.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMProcessingInstruction.java
new file mode 100644
index 0000000..d472586
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMProcessingInstruction.java
@@ -0,0 +1,46 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+/**

+ * Interface OMProcessingInstruction

+ */

+public interface OMProcessingInstruction extends OMNode {

+    /**

+     * Sets the target of this Processing Instruction.

+     * @param target

+     */

+    public void setTarget(String target);

+

+    /**

+     * Gets the target of this Processing Instruction.

+      * @return Returns string.

+     */

+    public String getTarget();

+

+    /**

+     * Sets the value of this Processing Instruction.

+     * @param value

+     */

+    public void setValue(String value);

+

+    /**

+     * Gets the value of this Processing Instruction.

+      * @return Returns String.

+     */

+    public String getValue();

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMSerializer.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMSerializer.java
new file mode 100644
index 0000000..bc42a9c
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMSerializer.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * Interface OMSerializer
+ */
+public interface OMSerializer {
+    /**
+     * Method serialize
+     *
+     * @param reader
+     * @param writer
+     * @throws XMLStreamException
+     */
+    void serialize(XMLStreamReader reader, XMLStreamWriter writer)
+            throws XMLStreamException;
+}
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMText.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMText.java
new file mode 100644
index 0000000..e6bb145
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMText.java
@@ -0,0 +1,84 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import javax.xml.namespace.QName;

+

+

+/**

+ * Interface OMText.

+ *

+ * OMText can contain data as a String, char[] or a DataHandler.

+ */

+public interface OMText extends OMNode {

+    /**

+     * Returns the text value of this node.

+     *

+     * @return Returns String.

+     */

+    String getText();

+

+    char[] getTextCharacters();

+    boolean isCharacters();

+

+    QName getTextAsQName();

+    

+    /**

+     * Returns the Namespace if this contains a QName

+     * Return null otherwise

+     * @return OMNamespace 

+     */

+    OMNamespace getNamespace();

+

+    /**

+     * Gets the datahandler.

+     * @return Returns datahandler.

+     */

+    Object getDataHandler();

+

+    /**

+     * @return Returns boolean flag saying whether the node contains

+     *         an optimized text or not.

+     */

+    boolean isOptimized();

+

+    /**

+     * Sets the optimize flag.

+     * @param value

+     */

+    void setOptimize(boolean value);

+    

+    /**

+     * @return Returns boolean flag saying whether the node contains

+     *         binary or not.

+     */

+    boolean isBinary();

+

+    /**

+     * Sets the isBinary flag.

+     * @param value

+     */

+    void setBinary(boolean value);

+    

+

+    /**

+     * Gets the content id.

+     * @return Returns String.

+     */

+    String getContentID();

+

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMXMLParserWrapper.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMXMLParserWrapper.java
new file mode 100644
index 0000000..842b4e4
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMXMLParserWrapper.java
@@ -0,0 +1,95 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+/**

+ * Interface OMXMLParserWrapper

+ */

+public interface OMXMLParserWrapper {

+    /**

+     * Proceed the parser one step and return the event value.

+     *

+     * @return Returns int.

+     * @throws org.apache.axiom.om.OMException

+     *

+     * @throws OMException

+     */

+    int next() throws OMException;

+

+    /**

+     * Discards the current element.

+     * This will remove the given element and its decendants.

+     *

+     * @param el

+     * @throws org.apache.axiom.om.OMException

+     *

+     * @throws OMException

+     */

+    void discard(OMElement el) throws OMException;

+

+    /**

+     * @param b

+     * @throws org.apache.axiom.om.OMException

+     *

+     * @throws OMException

+     */

+    void setCache(boolean b) throws OMException;

+

+    /**

+     * Allows to access the underlying parser. Since the parser

+     * depends on the underlying implementation, an Object is returned.

+     * However the implementations may have restrictions in letting access to

+     * the parser.

+     *

+     * @return Returns Object.

+     */

+    Object getParser();

+

+    /**

+     * @return Returns the complete status.

+     */

+    boolean isCompleted();

+

+    /**

+     * @return Returns the document element.

+     */

+    OMElement getDocumentElement();

+

+    /**

+     * Returns the type of the builder.

+     * Can be either PUSH_TYPE_BUILDER or PULL_TYPE_BUILDER.

+     *

+     * @return Returns short.

+     */

+    short getBuilderType();

+

+    /**

+     * Registers an external content handler. Especially useful for

+     * push type builders. Throws an unsupportedOperationException if

+     * such handler registration is not supported.

+     *

+     * @param obj

+     */

+    void registerExternalContentHandler(Object obj);

+

+    /**

+     * get the registered external content handler

+     *

+     * @return Returns Object.

+     */

+    Object getRegisteredContentHandler();

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/EmptyOMLocation.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/EmptyOMLocation.java
new file mode 100644
index 0000000..ba2af42
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/EmptyOMLocation.java
@@ -0,0 +1,45 @@
+package org.apache.axiom.om.impl;

+

+import javax.xml.stream.Location;

+

+/*

+ * Copyright 2001-2004 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ *

+ */

+

+public class EmptyOMLocation implements Location {

+

+

+    public int getLineNumber() {

+        return -1;  //To change body of implemented methods use File | Settings | File Templates.

+    }

+

+    public int getColumnNumber() {

+        return -1;  //To change body of implemented methods use File | Settings | File Templates.

+    }

+

+    public int getCharacterOffset() {

+        return 0;  //To change body of implemented methods use File | Settings | File Templates.

+    }

+

+    public String getPublicId() {

+        return null;  //To change body of implemented methods use File | Settings | File Templates.

+    }

+

+    public String getSystemId() {

+        return null;  //To change body of implemented methods use File | Settings | File Templates.

+    }

+

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java
new file mode 100644
index 0000000..048c5bf
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java
@@ -0,0 +1,173 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl;

+

+import java.io.IOException;

+import java.io.OutputStream;

+import java.io.StringWriter;

+import java.util.Iterator;

+import java.util.LinkedList;

+import java.util.Map;

+

+import javax.activation.DataHandler;

+import javax.mail.MessagingException;

+import javax.mail.internet.MimeBodyPart;

+

+import org.apache.axiom.attachments.Attachments;

+import org.apache.axiom.om.OMConstants;

+import org.apache.axiom.om.OMException;

+import org.apache.axiom.om.OMOutputFormat;

+import org.apache.axiom.om.OMText;

+import org.apache.axiom.soap.SOAP11Constants;

+import org.apache.axiom.soap.SOAP12Constants;

+

+public class MIMEOutputUtils {

+

+    private static byte[] CRLF =  { 13, 10 };

+

+    public static void complete(OutputStream outStream,

+                                StringWriter writer, LinkedList binaryNodeList,

+                                String boundary, String contentId, String charSetEncoding,String SOAPContentType) {

+        try {

+            startWritingMime(outStream, boundary);

+

+            javax.activation.DataHandler dh = new javax.activation.DataHandler(writer.toString(),

+                    "text/xml; charset=" + charSetEncoding);

+            MimeBodyPart rootMimeBodyPart = new MimeBodyPart();

+            rootMimeBodyPart.setDataHandler(dh);

+

+            rootMimeBodyPart.addHeader("content-type",

+                    "application/xop+xml; charset=" + charSetEncoding +

+                    "; type=\""+SOAPContentType+"\";");

+            rootMimeBodyPart.addHeader("content-transfer-encoding", "binary");

+            rootMimeBodyPart.addHeader("content-id","<"+contentId+">");

+

+            writeBodyPart(outStream, rootMimeBodyPart, boundary);

+

+            Iterator binaryNodeIterator = binaryNodeList.iterator();

+            while (binaryNodeIterator.hasNext()) {

+				OMText binaryNode = (OMText) binaryNodeIterator.next();

+				writeBodyPart(outStream, createMimeBodyPart(binaryNode

+						.getContentID(), (DataHandler) binaryNode

+						.getDataHandler()), boundary);

+			}

+			finishWritingMime(outStream);

+        } catch (IOException e) {

+            throw new OMException("Error while writing to the OutputStream.", e);

+        } catch (MessagingException e) {

+            throw new OMException("Problem writing Mime Parts.", e);

+        }

+    }

+

+    public static MimeBodyPart createMimeBodyPart(String contentID, DataHandler dataHandler)

+            throws MessagingException {

+        MimeBodyPart mimeBodyPart = new MimeBodyPart();

+        mimeBodyPart.setDataHandler(dataHandler);

+        mimeBodyPart.addHeader("content-id", "<"+contentID+">");

+        mimeBodyPart.addHeader("content-type", dataHandler.getContentType());

+        mimeBodyPart.addHeader("content-transfer-encoding", "binary");

+        return mimeBodyPart;

+

+    }

+

+    /**

+     * @throws IOException This will write the boundary to output Stream

+     */

+    public static void writeMimeBoundary(OutputStream outStream,

+                                         String boundary) throws IOException {

+        outStream.write(new byte[]{45, 45});

+        outStream.write(boundary.getBytes());

+    }

+

+    /**

+     * @throws IOException This will write the boundary with CRLF

+     */

+    public static void startWritingMime(OutputStream outStream,

+                                        String boundary)

+            throws IOException {

+        writeMimeBoundary(outStream, boundary);

+        //outStream.write(CRLF);

+    }

+

+    /**

+     * Writes a CRLF for the earlier boundary then the BodyPart data

+     * with headers followed by boundary. Writes only the boundary. No more

+     * CRLF's are written after that.

+     *

+     * @throws IOException

+     * @throws MessagingException

+     */

+    public static void writeBodyPart(OutputStream outStream,

+                                     MimeBodyPart part,

+                                     String boundary) throws IOException,

+            MessagingException {

+        outStream.write(CRLF);

+        part.writeTo(outStream);

+        outStream.write(CRLF);

+        writeMimeBoundary(outStream, boundary);

+    }

+

+    /**

+     * @throws IOException This will write "--" to the end of last boundary

+     */

+    public static void finishWritingMime(OutputStream outStream)

+            throws IOException {

+        outStream.write(new byte[]{45, 45});

+    }

+

+    public static void writeSOAPWithAttachmentsMessage(StringWriter writer,

+			OutputStream outputStream, Attachments attachments, OMOutputFormat format) {

+		String SOAPContentType;

+		try {

+			if (format.isSOAP11()) {

+				SOAPContentType = SOAP11Constants.SOAP_11_CONTENT_TYPE;

+			} else {

+				SOAPContentType = SOAP12Constants.SOAP_12_CONTENT_TYPE;

+			}

+			startWritingMime(outputStream, format.getMimeBoundary());

+

+			javax.activation.DataHandler dh = new javax.activation.DataHandler(

+					writer.toString(), "text/xml; charset="

+							+ format.getCharSetEncoding());

+			MimeBodyPart rootMimeBodyPart = new MimeBodyPart();

+			rootMimeBodyPart.setDataHandler(dh);

+

+			rootMimeBodyPart.addHeader("content-type",

+					SOAPContentType+"; charset="

+							+ format.getCharSetEncoding());

+			rootMimeBodyPart.addHeader("content-transfer-encoding", "8bit");

+			rootMimeBodyPart.addHeader("content-id", "<"

+					+ format.getRootContentId() + ">");

+

+			writeBodyPart(outputStream, rootMimeBodyPart, format

+					.getMimeBoundary());

+

+			Iterator attachmentIDIterator = attachments.getContentIDSet().iterator();

+			while (attachmentIDIterator.hasNext()) {

+				String contentID = (String) attachmentIDIterator.next();

+				DataHandler dataHandler = attachments.getDataHandler(contentID);

+				writeBodyPart(outputStream, createMimeBodyPart(contentID,

+						dataHandler), format.getMimeBoundary());

+			}

+			finishWritingMime(outputStream);

+		} catch (IOException e) {

+			throw new OMException("Error while writing to the OutputStream.", e);

+		} catch (MessagingException e) {

+			throw new OMException("Problem writing Mime Parts.", e);

+		}

+	}

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMConstants.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMConstants.java
new file mode 100644
index 0000000..2d780f0
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMConstants.java
@@ -0,0 +1,37 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl;

+

+public interface MTOMConstants {

+    public static final String XOP_INCLUDE = "Include";

+    public static final String XOP_NAMESPACE_URI = "http://www.w3.org/2004/08/xop/include";

+

+    /**

+     * If the Message is MTOM optimised then <code>MTOM_TYPE</code>

+     */

+    String MTOM_TYPE = "application/xop+xml";

+    /**

+     * If the message is Soap with Attachments <code>SWA_TYPE</code>

+     */

+    String SWA_TYPE = "text/xml";

+    /**

+     * <code>rootPart</code> is used as the key for the root BodyPart in the

+     * Parts HashMap

+     */

+    String ROOT_PART = "SoapPart";

+    String ATTACHMENTS = "Attachments";

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java
new file mode 100644
index 0000000..0cd59e3
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java
@@ -0,0 +1,301 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl;
+
+import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAP12Constants;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import java.util.LinkedList;
+
+
+/**
+ * For the moment this assumes that transport takes the decision of whether
+ * to optimize or not by looking at whether the MTOM optimize is enabled &
+ * also looking at the OM tree whether it has any optimizable content.
+ */
+public class MTOMXMLStreamWriter implements XMLStreamWriter {
+    private XMLStreamWriter xmlWriter;
+    private OutputStream outStream;
+    private LinkedList binaryNodeList = new LinkedList();
+    private StringWriter bufferedSOAPBody;
+    private OMOutputFormat format = new OMOutputFormat();
+
+    public MTOMXMLStreamWriter(XMLStreamWriter xmlWriter) {
+        this.xmlWriter = xmlWriter;
+    }
+
+    /**
+     * Creates a new MTOMXMLStreamWriter with specified encoding.
+     *
+     * @param outStream
+     * @param format
+     * @throws XMLStreamException
+     * @throws FactoryConfigurationError
+     * @see OMOutputFormat#DEFAULT_CHAR_SET_ENCODING
+     */
+    public MTOMXMLStreamWriter(OutputStream outStream, OMOutputFormat format)
+            throws XMLStreamException, FactoryConfigurationError {
+        this.format = format;
+        this.outStream = outStream;
+
+        if (format.getCharSetEncoding() == null) //Default encoding is UTF-8
+            format.setCharSetEncoding(OMOutputFormat.DEFAULT_CHAR_SET_ENCODING);
+
+        if (format.isOptimized()) {
+            bufferedSOAPBody = new StringWriter();
+            xmlWriter = StAXUtils.createXMLStreamWriter(bufferedSOAPBody);
+        } else {
+            try {
+                xmlWriter = StAXUtils.createXMLStreamWriter(new java.io.BufferedWriter(new OutputStreamWriter(outStream,
+                        format.getCharSetEncoding())));
+            } catch (UnsupportedEncodingException e) {
+                throw new XMLStreamException(e);
+            }
+        }
+    }
+
+    public void writeStartElement(String string) throws XMLStreamException {
+        xmlWriter.writeStartElement(string);
+    }
+
+    public void writeStartElement(String string, String string1) throws XMLStreamException {
+        xmlWriter.writeStartElement(string, string1);
+    }
+
+    public void writeStartElement(String string, String string1, String string2) throws XMLStreamException {
+        xmlWriter.writeStartElement(string, string1, string2);
+    }
+
+    public void writeEmptyElement(String string, String string1) throws XMLStreamException {
+        xmlWriter.writeStartElement(string, string1);
+    }
+
+    public void writeEmptyElement(String string, String string1, String string2) throws XMLStreamException {
+        xmlWriter.writeStartElement(string, string1, string2);
+    }
+
+    public void writeEmptyElement(String string) throws XMLStreamException {
+        xmlWriter.writeStartElement(string);
+    }
+
+    public void writeEndElement() throws XMLStreamException {
+        xmlWriter.writeEndElement();
+    }
+
+    public void writeEndDocument() throws XMLStreamException {
+        xmlWriter.writeEndDocument();
+    }
+
+    public void close() throws XMLStreamException {
+        xmlWriter.close();
+    }
+
+    public void flush() throws XMLStreamException {
+        xmlWriter.flush();
+        String SOAPContentType;
+        if (format.isOptimized()) {
+            if (format.isSOAP11()) {
+                SOAPContentType = SOAP11Constants.SOAP_11_CONTENT_TYPE;
+            } else {
+                SOAPContentType = SOAP12Constants.SOAP_12_CONTENT_TYPE;
+            }
+            MIMEOutputUtils.complete(
+                    outStream,
+                    bufferedSOAPBody,
+                    binaryNodeList,
+                    format.getMimeBoundary(),
+                    format.getRootContentId(),
+                    format.getCharSetEncoding(), SOAPContentType);
+        }
+    }
+
+    public void writeAttribute(String string, String string1) throws XMLStreamException {
+        xmlWriter.writeAttribute(string, string1);
+    }
+
+    public void writeAttribute(String string, String string1, String string2, String string3) throws XMLStreamException {
+        xmlWriter.writeAttribute(string, string1, string2, string3);
+    }
+
+    public void writeAttribute(String string, String string1, String string2) throws XMLStreamException {
+        xmlWriter.writeAttribute(string, string1, string2);
+    }
+
+    public void writeNamespace(String string, String string1) throws XMLStreamException {
+        xmlWriter.writeNamespace(string, string1);
+    }
+
+    public void writeDefaultNamespace(String string) throws XMLStreamException {
+        xmlWriter.writeDefaultNamespace(string);
+    }
+
+    public void writeComment(String string) throws XMLStreamException {
+        xmlWriter.writeComment(string);
+    }
+
+    public void writeProcessingInstruction(String string) throws XMLStreamException {
+        xmlWriter.writeProcessingInstruction(string);
+    }
+
+    public void writeProcessingInstruction(String string, String string1) throws XMLStreamException {
+        xmlWriter.writeProcessingInstruction(string, string1);
+    }
+
+    public void writeCData(String string) throws XMLStreamException {
+        xmlWriter.writeCData(string);
+    }
+
+    public void writeDTD(String string) throws XMLStreamException {
+        xmlWriter.writeDTD(string);
+    }
+
+    public void writeEntityRef(String string) throws XMLStreamException {
+        xmlWriter.writeEntityRef(string);
+    }
+
+    public void writeStartDocument() throws XMLStreamException {
+        xmlWriter.writeStartDocument();
+    }
+
+    public void writeStartDocument(String string) throws XMLStreamException {
+        xmlWriter.writeStartDocument(string);
+    }
+
+    public void writeStartDocument(String string, String string1) throws XMLStreamException {
+        xmlWriter.writeStartDocument(string, string1);
+    }
+
+    public void writeCharacters(String string) throws XMLStreamException {
+        if (string != null) {
+            char[] array = string.toCharArray();
+            xmlWriter.writeCharacters(array, 0, array.length);
+        }
+    }
+
+    public void writeCharacters(char[] chars, int i, int i1) throws XMLStreamException {
+        xmlWriter.writeCharacters(chars, i, i1);
+    }
+
+    public String getPrefix(String string) throws XMLStreamException {
+        return xmlWriter.getPrefix(string);
+    }
+
+    public void setPrefix(String string, String string1) throws XMLStreamException {
+        xmlWriter.setPrefix(string, string1);
+    }
+
+    public void setDefaultNamespace(String string) throws XMLStreamException {
+        xmlWriter.setDefaultNamespace(string);
+    }
+
+    public void setNamespaceContext(NamespaceContext namespaceContext) throws XMLStreamException {
+        xmlWriter.setNamespaceContext(namespaceContext);
+    }
+
+    public NamespaceContext getNamespaceContext() {
+        return xmlWriter.getNamespaceContext();
+    }
+
+    public Object getProperty(String string) throws IllegalArgumentException {
+        return xmlWriter.getProperty(string);
+    }
+
+    public boolean isOptimized() {
+        return format.isOptimized();
+    }
+
+    public String getContentType() {
+        return format.getContentType();
+    }
+
+    public void writeOptimized(OMText node) {
+        binaryNodeList.add(node);
+    }
+
+    public void setXmlStreamWriter(XMLStreamWriter xmlWriter) {
+        this.xmlWriter = xmlWriter;
+    }
+
+    public XMLStreamWriter getXmlStreamWriter() {
+        return xmlWriter;
+    }
+
+    public String getMimeBoundary() {
+        return format.getMimeBoundary();
+    }
+
+    public String getRootContentId() {
+        return format.getRootContentId();
+    }
+
+    public String getNextContentId() {
+        return format.getNextContentId();
+    }
+
+    /**
+     * Returns the character set encoding scheme. If the value of the
+     * charSetEncoding is not set then the default will be returned.
+     *
+     * @return Returns encoding.
+     */
+    public String getCharSetEncoding() {
+        return format.getCharSetEncoding();
+    }
+
+    public void setCharSetEncoding(String charSetEncoding) {
+        format.setCharSetEncoding(charSetEncoding);
+    }
+
+    public String getXmlVersion() {
+        return format.getXmlVersion();
+    }
+
+    public void setXmlVersion(String xmlVersion) {
+        format.setXmlVersion(xmlVersion);
+    }
+
+    public void setSoap11(boolean b) {
+        format.setSOAP11(b);
+    }
+
+    public boolean isIgnoreXMLDeclaration() {
+        return format.isIgnoreXMLDeclaration();
+    }
+
+    public void setIgnoreXMLDeclaration(boolean ignoreXMLDeclaration) {
+        format.setIgnoreXMLDeclaration(ignoreXMLDeclaration);
+    }
+
+    public void setDoOptimize(boolean b) {
+        format.setDoOptimize(b);
+    }
+
+    public void setOutputFormat(OMOutputFormat format) {
+        this.format = format;
+    }
+}
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMContainerEx.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMContainerEx.java
new file mode 100644
index 0000000..bdb19b4
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMContainerEx.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl;
+
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMNode;
+
+/**
+ * Interface OMContainerEx
+ *
+ * Internal Implementation detail. Adding special interface to stop folks from accidently using OMContainer.
+ * Please use at your own risk. May corrupt the data integrity.
+ */
+public interface OMContainerEx extends OMContainer {
+    public void setComplete(boolean state);
+
+    public void setFirstChild(OMNode omNode);
+}
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMNamespaceImpl.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMNamespaceImpl.java
new file mode 100644
index 0000000..9ef464f
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMNamespaceImpl.java
@@ -0,0 +1,80 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl;

+

+import org.apache.axiom.om.OMNamespace;

+

+/**

+ * Class OMNamespaceImpl

+ */

+public class OMNamespaceImpl implements OMNamespace {

+    /**

+     * Field prefix

+     */

+    private String prefix;

+

+    /**

+     * Field uri

+     */

+    private String uri;

+

+    /**

+     * @param uri

+     * @param prefix

+     */

+    public OMNamespaceImpl(String uri, String prefix) {

+        this.uri = uri;

+        this.prefix = prefix;

+    }

+

+    /**

+     * Method equals.

+     *

+     * @param uri

+     * @param prefix

+     * @return Returns boolean.

+     */

+    public boolean equals(String uri, String prefix) {

+        return (((prefix == null) && (this.prefix == null)) ||

+                ((prefix != null) && prefix.equals(this.prefix))) &&

+                ((uri == null) && (this.uri == null) ||

+                        (uri != null) && uri.equals(this.uri));

+

+    }

+

+    /**

+     * Method getPrefix.

+     *

+     * @return Returns String.

+     */

+    public String getPrefix() {

+        return prefix;

+    }

+

+    /**

+     * Method getName.

+     *

+     * @return Returns String.

+     */

+    public String getName() {

+        return uri;

+    }

+

+    public String getNamespaceURI() {

+        return uri;

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMNodeEx.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMNodeEx.java
new file mode 100644
index 0000000..1850e34
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMNodeEx.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl;
+
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMNode;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * Interface OMNodeEx
+ *
+ * Internal Implementation detail. Adding special interface to stop folks from accidently using OMNode.
+ * Please use at your own risk. May corrupt the data integrity.
+ */
+public interface OMNodeEx extends OMNode {
+    public void setNextOMSibling(OMNode node);
+
+    public void setPreviousOMSibling(OMNode previousSibling);
+
+    public void setParent(OMContainer element);
+
+    public void setComplete(boolean state);
+
+    public void setType(int nodeType) throws OMException;
+
+    /**
+     * Serializes the node with caching.
+     *
+     * @param writer
+     * @throws javax.xml.stream.XMLStreamException
+     */
+    public void internalSerialize(XMLStreamWriter writer)
+            throws XMLStreamException;
+
+    /**
+     * Serializes the node without caching.
+     *
+     * @param writer
+     * @throws XMLStreamException
+     */
+    public void internalSerializeAndConsume(XMLStreamWriter writer) throws XMLStreamException;
+}
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java
new file mode 100644
index 0000000..caf8a40
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java
@@ -0,0 +1,174 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.builder;

+

+import org.apache.axiom.om.OMAbstractFactory;

+import org.apache.axiom.om.OMContainer;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMException;

+import org.apache.axiom.om.OMFactory;

+import org.apache.axiom.om.OMNode;

+import org.apache.axiom.om.impl.OMNodeEx;

+import org.xml.sax.Attributes;

+import org.xml.sax.Locator;

+import org.xml.sax.SAXException;

+import org.xml.sax.helpers.DefaultHandler;

+

+import java.util.ArrayList;

+import java.util.List;

+

+public class SAXOMBuilder extends DefaultHandler {

+    OMElement root = null;

+

+    OMNode lastNode = null;

+

+    OMElement nextElem = null;

+

+    OMFactory factory = OMAbstractFactory.getOMFactory();

+

+    List prefixMappings = new ArrayList();

+

+    public void setDocumentLocator(Locator arg0) {

+    }

+

+    public void startDocument() throws SAXException {

+

+    }

+

+    public void endDocument() throws SAXException {

+    }

+

+    protected OMElement createNextElement(String localName) throws OMException {

+        OMElement e;

+        if (lastNode == null) {

+            root = e = factory.createOMElement(localName, null, null, null);

+        } else if (lastNode.isComplete()) {

+            e = factory.createOMElement(localName, null, lastNode.getParent(),

+                    null);

+            ((OMNodeEx)lastNode).setNextOMSibling(e);

+            ((OMNodeEx)e).setPreviousOMSibling(lastNode);

+        } else {

+            OMElement parent = (OMElement) lastNode;

+            e = factory.createOMElement(localName, null, (OMElement) lastNode,

+                    null);

+            parent.setFirstChild(e);

+        }

+        return e;

+    }

+

+    /*

+     * (non-Javadoc)

+     *

+     * @see org.xml.sax.ContentHandler#startPrefixMapping(java.lang.String,

+     *      java.lang.String)

+     */

+    public void startPrefixMapping(String prefix, String uri)

+            throws SAXException {

+        if (nextElem == null)

+            nextElem = createNextElement(null);

+        nextElem.declareNamespace(uri, prefix);

+    }

+

+    public void endPrefixMapping(String arg0) throws SAXException {

+    }

+

+    /*

+     * (non-Javadoc)

+     *

+     * @see org.xml.sax.ContentHandler#startElement(java.lang.String,

+     *      java.lang.String, java.lang.String, org.xml.sax.Attributes)

+     */

+    public void startElement(String namespaceURI, String localName,

+                             String qName, Attributes atts) throws SAXException {

+        if (localName == null || localName.trim().equals(""))

+            localName = qName.substring(qName.indexOf(':') + 1);

+        if (nextElem == null)

+            nextElem = createNextElement(localName);

+        else

+            nextElem.setLocalName(localName);

+        nextElem

+                .setNamespace(nextElem.findNamespace(namespaceURI, null));

+        int j = atts.getLength();

+        for (int i = 0; i < j; i++)

+            nextElem.addAttribute(atts.getLocalName(i), atts.getValue(i),

+                    nextElem.findNamespace(atts.getURI(i), null));

+        lastNode = nextElem;

+        nextElem = null;

+    }

+

+    /*

+     * (non-Javadoc)

+     *

+     * @see org.xml.sax.ContentHandler#endElement(java.lang.String,

+     *      java.lang.String, java.lang.String)

+     */

+    public void endElement(String arg0, String arg1, String arg2)

+            throws SAXException {

+        if (lastNode.isComplete()) {

+            OMContainer parent = lastNode.getParent();

+            ((OMNodeEx)parent).setComplete(true);

+            lastNode = (OMNode) parent;

+        } else {

+            OMElement e = (OMElement) lastNode;

+            ((OMNodeEx)e).setComplete(true);

+        }

+    }

+

+    /*

+     * (non-Javadoc)

+     *

+     * @see org.xml.sax.ContentHandler#characters(char[], int, int)

+     */

+    public void characters(char[] ch, int start, int length)

+            throws SAXException {

+        if (lastNode == null) {

+            throw new SAXException("");

+        }

+        OMNode node;

+        if (lastNode.isComplete()) {

+            node =

+                    factory.createOMText(lastNode.getParent(),

+                            new String(ch,

+                                    start, length));

+            ((OMNodeEx)lastNode).setNextOMSibling(node);

+            ((OMNodeEx)node).setPreviousOMSibling(lastNode);

+        } else {

+            OMElement e = (OMElement) lastNode;

+            node = factory.createOMText(e, new String(ch, start, length));

+            e.setFirstChild(node);

+        }

+        lastNode = node;

+    }

+

+    public void ignorableWhitespace(char[] arg0, int arg1, int arg2)

+            throws SAXException {

+    }

+

+    public void processingInstruction(String arg0, String arg1)

+            throws SAXException {

+    }

+

+    public void skippedEntity(String arg0) throws SAXException {

+    }

+

+    /**

+     * @return Returns the root.

+     */

+    public OMElement getRootElement() {

+        return root;

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java
new file mode 100644
index 0000000..dfa5d4b
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java
@@ -0,0 +1,467 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.builder;

+

+import org.apache.axiom.om.*;

+import org.apache.axiom.om.impl.OMNodeEx;

+import org.apache.axiom.om.impl.util.OMSerializerUtil;

+

+import javax.xml.stream.XMLStreamConstants;

+import javax.xml.stream.XMLStreamReader;

+

+/**

+ * OM should be able to be built from any data source. And the model it builds

+ * may be a SOAP specific one or just an XML model. This class will give

+ * some common functionality of OM Building from StAX.

+ */

+public abstract class StAXBuilder implements OMXMLParserWrapper {

+

+    /**

+     * Field parser

+     */

+    protected XMLStreamReader parser;

+

+    /**

+     * Field omfactory

+     */

+    protected OMFactory omfactory;

+

+    /**

+     * Field lastNode

+     */

+    protected OMNode lastNode;

+

+    // returns the state of completion

+

+    /**

+     * Field done

+     */

+    protected boolean done = false;

+

+    // keeps the state of the cache

+

+    /**

+     * Field cache

+     */

+    protected boolean cache = true;

+

+    // keeps the state of the parser access. if the parser is

+    // accessed atleast once,this flag will be set

+

+    /**

+     * Field parserAccessed

+     */

+    protected boolean parserAccessed = false;

+    protected OMDocument document;

+

+    protected boolean isDataHandlerAware = false;

+

+

+    /**

+     * Constructor StAXBuilder.

+     *

+     * @param ombuilderFactory

+     * @param parser

+     */

+    protected StAXBuilder(OMFactory ombuilderFactory, XMLStreamReader parser) {

+        this.parser = parser;

+        omfactory = ombuilderFactory;

+

+        // check whether data handlers are treated seperately

+        try {

+            if (parser != null && (Boolean.TRUE == parser.getProperty(OMConstants.IS_DATA_HANDLERS_AWARE))) {

+                isDataHandlerAware = true;

+            }

+        } catch (IllegalArgumentException e) {

+            // according to the parser api, get property will return IllegalArgumentException, when that

+            // property is not found.

+            isDataHandlerAware = false;

+        }

+    }

+

+    /**

+     * Constructor StAXBuilder.

+     *

+     * @param parser

+     */

+    protected StAXBuilder(XMLStreamReader parser) {

+        this(OMAbstractFactory.getOMFactory(), parser);

+    }

+

+    /**

+     * Method setOMBuilderFactory.

+     *

+     * @param ombuilderFactory

+     */

+    public void setOMBuilderFactory(OMFactory ombuilderFactory) {

+        this.omfactory = ombuilderFactory;

+    }

+

+    /**

+     * Method processNamespaceData.

+     *

+     * @param node

+     */

+    protected abstract void processNamespaceData(OMElement node);

+

+    // since the behaviors are different when it comes to namespaces

+    // this must be implemented differently

+

+    /**

+     * Method processAttributes.

+     *

+     * @param node

+     */

+    protected void processAttributes(OMElement node) {

+        int attribCount = parser.getAttributeCount();

+        for (int i = 0; i < attribCount; i++) {

+            String uri = parser.getAttributeNamespace(i);

+            String prefix = parser.getAttributePrefix(i);

+

+

+            OMNamespace namespace = null;

+            if (uri != null && uri.length() > 0) {

+

+                // prefix being null means this elements has a default namespace or it has inherited

+                // a default namespace from its parent

+                namespace = node.findNamespace(uri, prefix);

+                if (namespace == null) {

+                    if (prefix == null || "".equals(prefix)) {

+                        prefix = OMSerializerUtil.getNextNSPrefix();

+                    }

+                    namespace = node.declareNamespace(uri, prefix);

+                }

+            }

+

+            // todo if the attributes are supposed to namespace qualified all the time

+            // todo then this should throw an exception here

+

+            node.addAttribute(parser.getAttributeLocalName(i),

+                    parser.getAttributeValue(i), namespace);

+        }

+    }

+

+    /**

+     * Method createOMText.

+     *

+     * @return Returns OMNode.

+     * @throws OMException

+     */

+    protected OMNode createOMText(int textType) throws OMException {

+        OMNode node;

+        if (lastNode == null) {

+            return null;

+        } else if (!lastNode.isComplete()) {

+            node = createOMText((OMElement) lastNode, textType);

+        } else {

+            node = createOMText(lastNode.getParent(), textType);

+        }

+        return node;

+    }

+

+    /**

+     * This method will check whether the text can be optimizable using IS_BINARY flag.

+     * If that is set then we try to get the data handler.

+     *

+     * @param omContainer

+     * @param textType

+     * @return omNode

+     */

+    private OMNode createOMText(OMContainer omContainer, int textType) {

+        try {

+            if (isDataHandlerAware && Boolean.TRUE == parser.getProperty(OMConstants.IS_BINARY)) {

+                Object dataHandler = parser.getProperty(OMConstants.DATA_HANDLER);

+                OMText text = omfactory.createOMText(dataHandler, true);

+                omContainer.addChild(text);

+                return text;

+            } else {

+                return omfactory.createOMText(omContainer, parser.getText(), textType);

+            }

+        } catch (IllegalArgumentException e) {

+            return omfactory.createOMText(omContainer, parser.getText(), textType);

+        }

+    }

+

+    /**

+     * Method reset.

+     *

+     * @param node

+     * @throws OMException

+     */

+    public void reset(OMNode node) throws OMException {

+        lastNode = null;

+    }

+

+    /**

+     * Method discard.

+     *

+     * @param el

+     * @throws OMException

+     */

+    public void discard(OMElement el) throws OMException {

+        OMElement element = null;

+

+        if (element.isComplete() || !cache) {

+            throw new OMException();

+        }

+        try {

+            cache = false;

+            do {

+                while (parser.next() != XMLStreamConstants.END_ELEMENT) ;

+

+                // TODO:

+            } while (!parser.getName().equals(element.getQName()));

+            lastNode = element.getPreviousOMSibling();

+            if (lastNode != null) {

+                ((OMNodeEx) lastNode).setNextOMSibling(null);

+            } else {

+                OMElement parent = (OMElement) element.getParent();

+                if (parent == null) {

+                    throw new OMException();

+                }

+                parent.setFirstChild(null);

+                lastNode = parent;

+            }

+            cache = true;

+        } catch (OMException e) {

+            throw e;

+        } catch (Exception e) {

+            throw new OMException(e);

+        }

+    }

+

+    /**

+     * Method getText.

+     *

+     * @return Returns String.

+     * @throws OMException

+     */

+    public String getText() throws OMException {

+        return parser.getText();

+    }

+

+    /**

+     * Method getNamespace.

+     *

+     * @return Returns String.

+     * @throws OMException

+     */

+    public String getNamespace() throws OMException {

+        return parser.getNamespaceURI();

+    }

+

+    /**

+     * Method getNamespaceCount.

+     *

+     * @return Returns int.

+     * @throws OMException

+     */

+    public int getNamespaceCount() throws OMException {

+        try {

+            return parser.getNamespaceCount();

+        } catch (Exception e) {

+            throw new OMException(e);

+        }

+    }

+

+    /**

+     * Method getNamespacePrefix.

+     *

+     * @param index

+     * @return Returns String.

+     * @throws OMException

+     */

+    public String getNamespacePrefix(int index) throws OMException {

+        try {

+            return parser.getNamespacePrefix(index);

+        } catch (Exception e) {

+            throw new OMException(e);

+        }

+    }

+

+    /**

+     * Method getNamespaceUri.

+     *

+     * @param index

+     * @return Returns String.

+     * @throws OMException

+     */

+    public String getNamespaceUri(int index) throws OMException {

+        try {

+            return parser.getNamespaceURI(index);

+        } catch (Exception e) {

+            throw new OMException(e);

+        }

+    }

+

+    /**

+     * Method setCache.

+     *

+     * @param b

+     */

+    public void setCache(boolean b) {

+        if (parserAccessed && b) {

+            throw new UnsupportedOperationException(

+                    "parser accessed. cannot set cache");

+        }

+        cache = b;

+    }

+

+    /**

+     * Method getName.

+     *

+     * @return Returns String.

+     * @throws OMException

+     */

+    public String getName() throws OMException {

+        return parser.getLocalName();

+    }

+

+    /**

+     * Method getPrefix.

+     *

+     * @return Returns String.

+     * @throws OMException

+     */

+    public String getPrefix() throws OMException {

+        return parser.getPrefix();

+    }

+

+    /**

+     * Method getAttributeCount.

+     *

+     * @return Returns int.

+     * @throws OMException

+     */

+    public int getAttributeCount() throws OMException {

+        return parser.getAttributeCount();

+    }

+

+    /**

+     * Method getAttributeNamespace.

+     *

+     * @param arg

+     * @return Returns String.

+     * @throws OMException

+     */

+    public String getAttributeNamespace(int arg) throws OMException {

+        return parser.getAttributeNamespace(arg);

+    }

+

+    /**

+     * Method getAttributeName.

+     *

+     * @param arg

+     * @return Returns String.

+     * @throws OMException

+     */

+    public String getAttributeName(int arg) throws OMException {

+        return parser.getAttributeNamespace(arg);

+    }

+

+    /**

+     * Method getAttributePrefix.

+     *

+     * @param arg

+     * @return Returns String.

+     * @throws OMException

+     */

+    public String getAttributePrefix(int arg) throws OMException {

+        return parser.getAttributeNamespace(arg);

+    }

+

+    /**

+     * Method getParser.

+     *

+     * @return Returns Object.

+     */

+    public Object getParser() {

+        if (parserAccessed) {

+            throw new IllegalStateException(

+                    "Parser already accessed!");

+        }

+        if (!cache) {

+            parserAccessed = true;

+            return parser;

+        } else {

+            throw new IllegalStateException(

+                    "cache must be switched off to access the parser");

+        }

+    }

+

+    /**

+     * Method isCompleted.

+     *

+     * @return Returns boolean.

+     */

+    public boolean isCompleted() {

+        return done;

+    }

+

+    /**

+     * This method is called with the XMLStreamConstants.START_ELEMENT event.

+     *

+     * @return Returns OMNode.

+     * @throws OMException

+     */

+    protected abstract OMNode createOMElement() throws OMException;

+

+    /**

+     * Forwards the parser one step further, if parser is not completed yet.

+     * If this is called after parser is done, then throw an OMException.

+     * If the cache is set to false, then returns the event, *without* building the OM tree.

+     * If the cache is set to true, then handles all the events within this, and

+     * builds the object structure appropriately and returns the event.

+     *

+     * @return Returns int.

+     * @throws OMException

+     */

+    public abstract int next() throws OMException;

+

+    /**

+     * @return Returns short.

+     */

+    public short getBuilderType() {

+        return OMConstants.PULL_TYPE_BUILDER;

+    }

+

+    /**

+     * Method registerExternalContentHandler.

+     *

+     * @param obj

+     */

+    public void registerExternalContentHandler(Object obj) {

+        throw new UnsupportedOperationException();

+    }

+

+    /**

+     * Method getRegisteredContentHandler.

+     *

+     * @return Returns Object.

+     */

+    public Object getRegisteredContentHandler() {

+        throw new UnsupportedOperationException();

+    }

+

+    public OMDocument getDocument() {

+        return document;

+    }

+

+    public OMNode getLastNode() {

+        return this.lastNode;

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
new file mode 100644
index 0000000..bf407bf
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
@@ -0,0 +1,370 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.builder;

+

+import org.apache.axiom.om.*;

+import org.apache.axiom.om.impl.OMContainerEx;

+import org.apache.axiom.om.impl.OMNodeEx;

+import org.apache.axiom.om.util.StAXUtils;

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+

+import javax.xml.stream.XMLStreamConstants;

+import javax.xml.stream.XMLStreamException;

+import javax.xml.stream.XMLStreamReader;

+import java.io.FileInputStream;

+import java.io.FileNotFoundException;

+import java.io.InputStream;

+

+

+/**

+ * Constructs an OM without using SOAP specific classes like SOAPEnvelope,

+ * SOAPHeader, SOAPHeaderBlock and SOAPBody. This has the document concept also.

+ */

+public class StAXOMBuilder extends StAXBuilder {

+    /**

+     * Field document

+     */

+

+    private static final Log log = LogFactory.getLog(StAXOMBuilder.class);

+    private boolean doDebug = false;

+    private static int nsCount = 0;

+

+    /**

+     * Constructor StAXOMBuilder.

+     *

+     * @param ombuilderFactory

+     * @param parser

+     */

+    public StAXOMBuilder(OMFactory ombuilderFactory, XMLStreamReader parser) {

+        super(ombuilderFactory, parser);

+        document = ombuilderFactory.createOMDocument(this);

+        doDebug = log.isDebugEnabled();

+    }

+

+    /**

+     * Constructor linked to existing element.

+     *

+     * @param factory

+     * @param parser

+     * @param element

+     */

+    public StAXOMBuilder(OMFactory factory, XMLStreamReader parser, OMElement element) {

+        this(factory, parser);

+        lastNode = element;

+        document.setOMDocumentElement(element);

+        doDebug = log.isDebugEnabled();

+        populateOMElement(element);

+    }

+

+    /**

+     * @param filePath - Path to the XML file

+     * @throws XMLStreamException

+     * @throws FileNotFoundException

+     */

+    public StAXOMBuilder(String filePath) throws XMLStreamException, FileNotFoundException {

+        this(StAXUtils.createXMLStreamReader(new FileInputStream(filePath)));

+        doDebug = log.isDebugEnabled();

+    }

+

+    /**

+     * @param inStream - instream which contains the XML

+     * @throws XMLStreamException

+     */

+    public StAXOMBuilder(InputStream inStream) throws XMLStreamException {

+        this(StAXUtils.createXMLStreamReader(inStream));

+        doDebug = log.isDebugEnabled();

+    }

+

+    /**

+     * Constructor StAXOMBuilder.

+     *

+     * @param parser

+     */

+    public StAXOMBuilder(XMLStreamReader parser) {

+        super(parser);

+        omfactory = OMAbstractFactory.getOMFactory();

+        document = omfactory.createOMDocument(this);

+        doDebug = log.isDebugEnabled();

+    }

+

+    /**

+     * Method next.

+     *

+     * @return Returns int.

+     * @throws OMException

+     */

+    public int next() throws OMException {

+        try {

+            if (done) {

+                throw new OMException();

+            }

+            int token = parser.next();

+            if (!cache) {

+                return token;

+            }

+            switch (token) {

+                case XMLStreamConstants.START_ELEMENT:

+                    if (doDebug) {

+                        log.debug("START_ELEMENT: " + parser.getName() + ":" + parser.getLocalName());

+                    }

+                    lastNode = createOMElement();

+                    break;

+                case XMLStreamConstants.START_DOCUMENT:

+                    // Document has already being created.

+

+                    document.setXMLVersion(parser.getVersion());

+                    document.setCharsetEncoding(parser.getEncoding());

+                    document.setStandalone(parser.isStandalone() ? "yes" : "no");

+                    if (doDebug) {

+                        log.debug("START_DOCUMENT: ");

+                    }

+                    break;

+                case XMLStreamConstants.CHARACTERS:

+                    if (doDebug) {

+                        log.debug("CHARACTERS: [" + parser.getText() + "]");

+                    }

+                    lastNode = createOMText(XMLStreamConstants.CHARACTERS);

+                    break;

+                case XMLStreamConstants.CDATA:

+                    if (doDebug) {

+                        log.debug("CDATA: [" + parser.getText() + "]");

+                    }

+                    lastNode = createOMText(XMLStreamConstants.CDATA);

+                    break;

+                case XMLStreamConstants.END_ELEMENT:

+                    if (doDebug) {

+                        log.debug("END_ELEMENT: " + parser.getName() + ":" + parser.getLocalName());

+                    }

+                    endElement();

+                    break;

+                case XMLStreamConstants.END_DOCUMENT:

+                    if (doDebug) {

+                        log.debug("END_DOCUMENT: ");

+                    }

+                    done = true;

+                    ((OMContainerEx) this.document).setComplete(true);

+                    break;

+                case XMLStreamConstants.SPACE:

+                    if (doDebug) {

+                        log.debug("SPACE: [" + parser.getText() + "]");

+                    }

+                    lastNode = createOMText(XMLStreamConstants.SPACE);

+                    break;

+                case XMLStreamConstants.COMMENT:

+                    if (doDebug) {

+                        log.debug("COMMENT: [" + parser.getText() + "]");

+                    }

+                    createComment();

+                    break;

+                case XMLStreamConstants.DTD:

+                    if (doDebug) {

+                        log.debug("DTD: [" + parser.getText() + "]");

+                    }

+                    createDTD();

+                    break;

+                case XMLStreamConstants.PROCESSING_INSTRUCTION:

+                    if (doDebug) {

+                        log.debug("PROCESSING_INSTRUCTION: [" + parser.getPITarget() + "][" + parser.getPIData() + "]");

+                    }

+                    createPI();

+                    break;

+                case XMLStreamConstants.ENTITY_REFERENCE:

+                    if (doDebug) {

+                        log.debug("ENTITY_REFERENCE: " + parser.getLocalName() + "[" + parser.getText() + "]");

+                    }

+                    lastNode = createOMText(XMLStreamConstants.ENTITY_REFERENCE);

+                    break;

+                default :

+                    throw new OMException();

+            }

+            return token;

+        } catch (OMException e) {

+            throw e;

+        } catch (Exception e) {

+            throw new OMException(e);

+        }

+    }

+

+    /**

+     * Populate element with data from parser START_ELEMENT event. This is used

+     * when the source of data for an element needs to be parsed on demand. The

+     * supplied element must already be set to the proper name and namespace.

+     *

+     * @param node element to be populated

+     */

+    private void populateOMElement(OMElement node) {

+        // create the namespaces

+        processNamespaceData(node);

+        // fill in the attributes

+        processAttributes(node);

+        node.setLineNumber(parser.getLocation().getLineNumber());

+    }

+

+    /**

+     * Method createOMElement.

+     *

+     * @return Returns OMNode.

+     * @throws OMException

+     */

+    protected OMNode createOMElement() throws OMException {

+        OMElement node;

+        String elementName = parser.getLocalName();

+        if (lastNode == null) {

+            node = omfactory.createOMElement(elementName, null, document, this);

+        } else if (lastNode.isComplete()) {

+            node = omfactory.createOMElement(elementName, null,

+                    lastNode.getParent(), this);

+            ((OMNodeEx) lastNode).setNextOMSibling(node);

+            ((OMNodeEx) node).setPreviousOMSibling(lastNode);

+        } else {

+            OMElement e = (OMElement) lastNode;

+            node = omfactory.createOMElement(elementName, null,

+                    (OMElement) lastNode, this);

+            e.setFirstChild(node);

+        }

+        populateOMElement(node);

+        return node;

+    }

+

+    /**

+     * Method createOMText.

+     *

+     * @return Returns OMNode.

+     * @throws OMException

+     */

+    protected OMNode createComment() throws OMException {

+        OMNode node;

+        if (lastNode == null) {

+            node = omfactory.createOMComment(document, parser.getText());

+        } else if (lastNode.isComplete()) {

+            node = omfactory.createOMComment(lastNode.getParent(), parser.getText());

+        } else {

+            node = omfactory.createOMComment((OMElement) lastNode, parser.getText());

+        }

+        return node;

+    }

+

+    /**

+     * Method createDTD.

+     *

+     * @return Returns OMNode.

+     * @throws OMException

+     */

+    protected OMNode createDTD() throws OMException {

+        if (!parser.hasText())

+            return null;

+        lastNode = omfactory.createOMDocType(document, parser.getText());

+        return lastNode;

+    }

+

+    /**

+     * Method createPI.

+     *

+     * @return Returns OMNode.

+     * @throws OMException

+     */

+    protected OMNode createPI() throws OMException {

+        OMNode node;

+        String target = parser.getPITarget();

+        String data = parser.getPIData();

+        if (lastNode == null) {

+            node = omfactory.createOMProcessingInstruction(document, target, data);

+        } else if (lastNode.isComplete()) {

+            node = omfactory.createOMProcessingInstruction(lastNode.getParent(), target, data);

+        } else if (lastNode instanceof OMText) {

+            node = omfactory.createOMProcessingInstruction(lastNode.getParent(), target, data);

+        } else {

+            node = omfactory.createOMProcessingInstruction((OMContainer) lastNode, target, data);

+        }

+        return node;

+    }

+

+    protected void endElement() {

+        if (lastNode.isComplete()) {

+            OMNodeEx parent = (OMNodeEx) lastNode.getParent();

+            parent.setComplete(true);

+            lastNode = parent;

+        } else {

+            OMNodeEx e = (OMNodeEx) lastNode;

+            e.setComplete(true);

+        }

+

+        //return lastNode;

+    }

+

+    /**

+     * Method getDocumentElement.

+     *

+     * @return Returns root element.

+     */

+    public OMElement getDocumentElement() {

+        return document.getOMDocumentElement();

+    }

+

+    /**

+     * Method processNamespaceData.

+     *

+     * @param node

+     */

+    protected void processNamespaceData(OMElement node) {

+        // set the own namespace

+        String namespaceURI = parser.getNamespaceURI();

+        String prefix = parser.getPrefix();

+

+

+        int namespaceCount = parser.getNamespaceCount();

+        String nsprefix;

+        String namespaceURIFromParser;

+        for (int i = 0; i < namespaceCount; i++) {

+            nsprefix = parser.getNamespacePrefix(i);

+

+            //if the namespace is not defined already when we write the start tag declare it

+            // check whether this is the default namespace and make sure we have not declared that earlier

+            namespaceURIFromParser = parser.getNamespaceURI(i);

+            if (nsprefix == null || "".equals(nsprefix)) {

+                node.declareDefaultNamespace(parser.getNamespaceURI(i));

+            } else {

+                node.declareNamespace(namespaceURIFromParser, nsprefix);

+            }

+        }

+

+        if (namespaceURI != null && namespaceURI.length() > 0) {

+            OMNamespace namespace = node.findNamespace(namespaceURI, prefix);

+            if (namespace == null || namespace.getPrefix() != prefix) {

+                if (prefix == null || "".equals(prefix)) {

+                    namespace = node.declareDefaultNamespace(namespaceURI);

+                } else {

+                    namespace = node.declareNamespace(namespaceURI, prefix);

+                }

+            }

+            node.setNamespaceWithNoFindInCurrentScope(namespace);

+        }

+

+

+    }

+

+

+    public void setDoDebug(boolean doDebug) {

+        this.doDebug = doDebug;

+    }

+

+    protected String createPrefix() {

+        return "ns" + nsCount++;

+    }

+

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/exception/OMBuilderException.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/exception/OMBuilderException.java
new file mode 100644
index 0000000..0249b3f
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/exception/OMBuilderException.java
@@ -0,0 +1,40 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.exception;

+

+import org.apache.axiom.om.OMException;

+

+/**

+ * Class OMBuilderException

+ */

+public class OMBuilderException extends OMException {

+	

+    private static final long serialVersionUID = -7447667411291193889L;

+

+	/**

+     * Constructor OMBuilderException

+     *

+     * @param s

+     */

+    public OMBuilderException(String s) {

+        super(s);

+    }

+

+    public OMBuilderException(Throwable cause) {

+        super(cause);

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/exception/OMStreamingException.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/exception/OMStreamingException.java
new file mode 100644
index 0000000..b6e2e8b
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/exception/OMStreamingException.java
@@ -0,0 +1,61 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.exception;

+

+import org.apache.axiom.om.OMException;

+

+/**

+ * Class OMStreamingException

+ */

+public class OMStreamingException extends OMException {

+	

+    private static final long serialVersionUID = 8108888406034145092L;

+

+	/**

+     * Constructor OMStreamingException

+     */

+    public OMStreamingException() {

+    }

+

+    /**

+     * Constructor OMStreamingException

+     *

+     * @param message

+     */

+    public OMStreamingException(String message) {

+        super(message);

+    }

+

+    /**

+     * Constructor OMStreamingException

+     *

+     * @param message

+     * @param cause

+     */

+    public OMStreamingException(String message, Throwable cause) {

+        super(message, cause);

+    }

+

+    /**

+     * Constructor OMStreamingException

+     *

+     * @param cause

+     */

+    public OMStreamingException(Throwable cause) {

+        super(cause);

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/exception/XMLComparisonException.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/exception/XMLComparisonException.java
new file mode 100644
index 0000000..5df46d5
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/exception/XMLComparisonException.java
@@ -0,0 +1,37 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.exception;

+

+public class XMLComparisonException extends Exception {

+	/**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+	

+    private static final long serialVersionUID = -7918497983548520994L;

+

+    public XMLComparisonException(String message) {

+        super(message);

+    }

+

+    public XMLComparisonException(Throwable cause) {

+        super(cause);

+    }

+

+    public XMLComparisonException(String message, Throwable cause) {

+        super(message, cause);

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/mtom/MTOMStAXSOAPModelBuilder.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/mtom/MTOMStAXSOAPModelBuilder.java
new file mode 100644
index 0000000..88cc22c
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/mtom/MTOMStAXSOAPModelBuilder.java
@@ -0,0 +1,137 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.mtom;

+

+import org.apache.axiom.attachments.Attachments;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMException;

+import org.apache.axiom.om.OMNode;

+import org.apache.axiom.om.OMText;

+import org.apache.axiom.om.util.ElementHelper;

+import org.apache.axiom.om.impl.MTOMConstants;

+import org.apache.axiom.om.impl.OMNodeEx;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;

+

+import javax.activation.DataHandler;

+import javax.xml.stream.XMLStreamReader;

+import java.io.UnsupportedEncodingException;

+import java.net.URLDecoder;

+

+public class MTOMStAXSOAPModelBuilder extends StAXSOAPModelBuilder implements MTOMConstants {

+	

+    /**

+     * <code>Attachments</code> handles deferred parsing of incoming MIME

+     * Messages.

+     */

+    Attachments attachments;

+

+    int partIndex = 0;

+

+    public MTOMStAXSOAPModelBuilder(XMLStreamReader parser,

+                                    SOAPFactory factory,

+                                    Attachments attachments, String soapVersion) {

+        super(parser, factory, soapVersion);

+        this.attachments = attachments;

+    }

+

+    /**

+     * @param reader

+     * @param attachments

+     */

+    public MTOMStAXSOAPModelBuilder(XMLStreamReader reader,

+                                    Attachments attachments, String soapVersion) {

+        super(reader, soapVersion);

+        this.attachments = attachments;

+    }

+

+    protected OMNode createOMElement() throws OMException {

+

+        elementLevel++;

+        String elementName = parser.getLocalName();

+

+        String namespaceURI = parser.getNamespaceURI();

+

+        // create an OMBlob if the element is an <xop:Include>

+

+        if (XOP_INCLUDE.equalsIgnoreCase(elementName)

+                && XOP_NAMESPACE_URI

+                .equalsIgnoreCase(namespaceURI)) {

+            // do we need to check prfix as well. Meaning, should it be "XOP" ?

+

+

+            OMText node;

+            if (lastNode == null) {

+                // Decide whether to ckeck the level >3 or not

+                throw new OMException(

+                        "XOP:Include element is not supported here");

+            }

+            

+            String contentID = ElementHelper.getContentID(parser, getDocument().getCharsetEncoding());

+

+            // This cannot happen. XOP:Include is always the only child of an parent element

+            // cause it is same as having some text

+            try {

+                OMElement e = (OMElement) lastNode;

+                //node = new OMTextImpl(contentID, (OMElement) lastNode, this);

+                node = this.omfactory.createOMText(contentID, (OMElement) lastNode, this);

+                e.setFirstChild(node);

+            } catch (ClassCastException e) {

+                throw new OMException(

+                        "Last Node & Parent of an OMText should be an Element" +

+                                e);

+            }

+

+            return node;

+

+        } else {

+            OMElement node;

+            if (lastNode == null) {

+                node = constructNode(null, elementName, true);

+                setSOAPEnvelope(node);

+            } else if (lastNode.isComplete()) {

+                node =

+                        constructNode((OMElement) lastNode.getParent(),

+                                elementName,

+                                false);

+                ((OMNodeEx)lastNode).setNextOMSibling(node);

+                ((OMNodeEx)node).setPreviousOMSibling(lastNode);

+            } else {

+                OMElement e = (OMElement) lastNode;

+                node = constructNode((OMElement) lastNode, elementName, false);

+                e.setFirstChild(node);

+            }

+

+            

+            // This code seems suspicious.  The constructNode call

+            // does the attribute processing.  The parser is now at a different node,

+            // and thus processAttributes will either throw an exception or get the

+            // wrong attributes. (scheu)

+            

+            // fill in the attributes

+            processAttributes(node);

+            //TODO Exception when trying to log . check this

+            //			log.info("Build the OMElelment {" + node.getLocalName() + '}'

+            //					+ node.getLocalName() + "By the StaxSOAPModelBuilder");

+            return node;

+        }

+    }

+

+    public DataHandler getDataHandler(String blobContentID) throws OMException {

+        return attachments.getDataHandler(blobContentID);

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamWriterToContentHandlerConverter.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamWriterToContentHandlerConverter.java
new file mode 100644
index 0000000..5f7c431
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamWriterToContentHandlerConverter.java
@@ -0,0 +1,234 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.serialize;

+

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+import org.xml.sax.Attributes;

+import org.xml.sax.ContentHandler;

+import org.xml.sax.Locator;

+import org.xml.sax.SAXException;

+

+import javax.xml.stream.XMLStreamException;

+import javax.xml.stream.XMLStreamWriter;

+

+/**

+ * Class StreamWriterToContentHandlerConverter

+ */

+public class StreamWriterToContentHandlerConverter implements ContentHandler {

+    /**

+     * Field log

+     */

+    private Log log = LogFactory.getLog(getClass());

+

+    /**

+     * Field writer

+     */

+    private XMLStreamWriter writer;

+

+    /**

+     * Constructor StreamWriterToContentHandlerConverter.

+     *

+     * @param writer

+     */

+    public StreamWriterToContentHandlerConverter(XMLStreamWriter writer) {

+        this.writer = writer;

+    }

+

+    /**

+     * Method endDocument.

+     *

+     * @throws SAXException

+     */

+    public void endDocument() throws SAXException {

+

+        // do nothing

+    }

+

+    /**

+     * Method startDocument.

+     *

+     * @throws SAXException

+     */

+    public void startDocument() throws SAXException {

+

+        // 

+    }

+

+    /**

+     * Method characters.

+     *

+     * @param ch

+     * @param start

+     * @param length

+     * @throws SAXException

+     */

+    public void characters(char ch[], int start, int length)

+            throws SAXException {

+        try {

+            writer.writeCharacters(ch, start, length);

+        } catch (XMLStreamException e) {

+            throw new SAXException(e);

+        }

+    }

+

+    /**

+     * Method ignorableWhitespace.

+     *

+     * @param ch

+     * @param start

+     * @param length

+     * @throws SAXException

+     */

+    public void ignorableWhitespace(char ch[], int start, int length)

+            throws SAXException {

+

+        // throw new UnsupportedOperationException();

+    }

+

+    /**

+     * Method endPrefixMapping.

+     *

+     * @param prefix

+     * @throws SAXException

+     */

+    public void endPrefixMapping(String prefix) throws SAXException {

+

+        // throw new UnsupportedOperationException();

+    }

+

+    /**

+     * Method skippedEntity.

+     *

+     * @param name

+     * @throws SAXException

+     */

+    public void skippedEntity(String name) throws SAXException {

+

+        // throw new UnsupportedOperationException();

+    }

+

+    /**

+     * Method setDocumentLocator.

+     *

+     * @param locator

+     */

+    public void setDocumentLocator(Locator locator) {

+

+        // throw new UnsupportedOperationException();

+    }

+

+    /**

+     * Method processingInstruction.

+     *

+     * @param target

+     * @param data

+     * @throws SAXException

+     */

+    public void processingInstruction(String target, String data)

+            throws SAXException {

+

+        // throw new UnsupportedOperationException();

+    }

+

+    /**

+     * Method startPrefixMapping.

+     *

+     * @param prefix

+     * @param uri

+     * @throws SAXException

+     */

+    public void startPrefixMapping(String prefix, String uri)

+            throws SAXException {

+        try {

+            writer.writeNamespace(prefix, uri);

+            writer.setPrefix(prefix, uri);

+        } catch (XMLStreamException e) {

+            throw new SAXException(e);

+        }

+    }

+

+    /**

+     * Method endElement.

+     *

+     * @param namespaceURI

+     * @param localName

+     * @param qName

+     * @throws SAXException

+     */

+    public void endElement(String namespaceURI,

+                           String localName,

+                           String qName)

+            throws SAXException {

+        try {

+            writer.writeEndElement();

+        } catch (XMLStreamException e) {

+            throw new SAXException(e);

+        }

+    }

+

+    /**

+     * Method getPrefix.

+     *

+     * @param qName

+     * @return Returns String.

+     */

+    private String getPrefix(String qName) {

+        if (qName != null) {

+            return qName.substring(0, qName.indexOf(":"));

+        }

+        return null;

+    }

+

+    /**

+     * Method startElement.

+     *

+     * @param namespaceURI

+     * @param localName

+     * @param qName

+     * @param atts

+     * @throws SAXException

+     */

+    public void startElement(String namespaceURI,

+                             String localName,

+                             String qName,

+                             Attributes atts)

+            throws SAXException {

+        try {

+            log.info("writing element {" + namespaceURI + '}' + localName

+                    + " directly to stream ");

+            String prefix = getPrefix(qName);

+

+            // it is only the prefix we want to learn from the QName! so we can get rid of the

+            // spliting QName

+            if (prefix == null) {

+                writer.writeStartElement(namespaceURI, localName);

+            } else {

+                writer.writeStartElement(prefix, localName, namespaceURI);

+            }

+            if (atts != null) {

+                int attCount = atts.getLength();

+                for (int i = 0; i < attCount; i++) {

+                    writer.writeAttribute(atts.getURI(i), localName,

+                            atts.getValue(i));

+                }

+            }

+        } catch (XMLStreamException e) {

+            throw new SAXException(e);

+        }

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java
new file mode 100644
index 0000000..3fab71c
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java
@@ -0,0 +1,436 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.serialize;
+
+import java.util.ArrayList;
+
+import org.apache.axiom.om.OMSerializer;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * Class StreamingOMSerializer
+ */
+public class StreamingOMSerializer implements XMLStreamConstants, OMSerializer {
+
+    private static int namespaceSuffix = 0;
+    public static final String NAMESPACE_PREFIX = "ns";
+
+    /*
+    * The behavior of the serializer is such that it returns when it encounters the
+    * starting element for the second time. The depth variable tracks the depth of the
+    * serilizer and tells it when to return.
+    * Note that it is assumed that this serialization starts on an Element.
+    */
+
+    /**
+     * Field depth
+     */
+    private int depth = 0;
+
+    /**
+     * Method serialize.
+     *
+     * @param node
+     * @param writer
+     * @throws XMLStreamException
+     */
+    public void serialize(XMLStreamReader node, XMLStreamWriter writer)
+            throws XMLStreamException {
+        serializeNode(node, writer);
+    }
+
+    /**
+     * Method serializeNode.
+     *
+     * @param reader
+     * @param writer
+     * @throws XMLStreamException
+     */
+    protected void serializeNode(XMLStreamReader reader, XMLStreamWriter writer)
+            throws XMLStreamException {
+        //TODO We get the StAXWriter at this point and uses it hereafter assuming that this is the only entry point to this class.
+        // If there can be other classes calling methodes of this we might need to change methode signatures to OMOutputer
+        while (reader.hasNext()) {
+            int event = reader.next();
+            if (event == START_ELEMENT) {
+                serializeElement(reader, writer);
+                depth++;
+            } else if (event == ATTRIBUTE) {
+                serializeAttributes(reader, writer);
+            } else if (event == CHARACTERS) {
+                serializeText(reader, writer);
+            } else if (event == COMMENT) {
+                serializeComment(reader, writer);
+            } else if (event == CDATA) {
+                serializeCData(reader, writer);
+            } else if (event == END_ELEMENT) {
+                serializeEndElement(writer);
+                depth--;
+            }else if (event == START_DOCUMENT) {
+                depth++; //if a start document is found then increment the depth
+            } else if (event == END_DOCUMENT) {
+                if (depth!=0) depth--;  //for the end document - reduce the depth
+                try {
+                    serializeEndElement(writer);
+                } catch (Exception e) {
+                    //TODO: log exceptions
+                }
+            }
+            if (depth == 0) {
+                break;
+            }
+        }
+    }
+
+    /**
+     * @param reader
+     * @param writer
+     * @throws XMLStreamException
+     */
+    protected void serializeElement(XMLStreamReader reader,
+                                    XMLStreamWriter writer)
+            throws XMLStreamException {

+        
+    	// Note: To serialize the start tag, we must follow the order dictated by the JSR-173 (StAX) specification.
+    	// Please keep this code in sync with the code in OMSerializerUtil.serializeStartpart
+    
+    	// The algorithm is:
+        // ... generate setPrefix/setDefaultNamespace for each namespace declaration if the prefix is unassociated.
+    	// ... generate setPrefix/setDefaultNamespace if the prefix of the element is unassociated
+    	// ... generate setPrefix/setDefaultNamespace for each unassociated prefix of the attributes.
+    	//
+    	// ... generate writeStartElement (See NOTE_A)
+    	//
+    	// ... generate writeNamespace/writerDefaultNamespace for the new namespace declarations determine during the "set" processing
+    	// ... generate writeAttribute for each attribute
+    	
+    	// NOTE_A: To confuse matters, some StAX vendors (including woodstox), believe that the setPrefix bindings 
+    	// should occur after the writeStartElement.  If this is the case, the writeStartElement is generated first.
+    	
+    	ArrayList  writePrefixList = null;
+    	ArrayList  writeNSList = null;
+    	
+
+    	// Get the prefix and namespace of the element.  "" and null are identical.
+        String ePrefix = reader.getPrefix();
+    	ePrefix = (ePrefix != null && ePrefix.length() == 0) ? null : ePrefix;
+    	String eNamespace = reader.getNamespaceURI();
+    	eNamespace = (eNamespace != null && eNamespace.length() == 0) ? null : eNamespace;
+    	
+    	// Write the startElement if required
+		boolean setPrefixFirst = OMSerializerUtil.isSetPrefixBeforeStartElement(writer);
+        if (!setPrefixFirst) {
+        	if (eNamespace != null) {
+        		if (ePrefix == null) {
+        			writer.writeStartElement("", reader.getLocalName(), eNamespace);
+        		} else {
+        			writer.writeStartElement(ePrefix, reader.getLocalName(), eNamespace);
+        		}
+        	} else {
+        		writer.writeStartElement(reader.getLocalName());
+        	}
+        }
+    	
+        // Generate setPrefix for the namespace declarations
+        int count = reader.getNamespaceCount();
+        for (int i = 0; i < count; i++) {
+        	String prefix = reader.getNamespacePrefix(i);
+        	prefix = (prefix != null && prefix.length() == 0) ? null : prefix;
+        	String namespace = reader.getNamespaceURI(i);
+        	namespace = (namespace != null && namespace.length() == 0) ? null : namespace;
+        	
+        	String newPrefix = generateSetPrefix(prefix, namespace, writer);
+        	// If this is a new association, remember it so that it can written out later
+        	if (newPrefix != null) {
+        		if (writePrefixList == null) {
+        			writePrefixList= new ArrayList();
+        			writeNSList = new ArrayList();
+        		}
+        		if (!writePrefixList.contains(newPrefix)) {
+        			writePrefixList.add(newPrefix);
+        			writeNSList.add(namespace);
+        		}
+        	}
+        }
+        
+        // Generate setPrefix for the element
+        // If the prefix is not associated with a namespace yet, remember it so that we can
+    	// write out a namespace declaration
+    	String newPrefix = generateSetPrefix(ePrefix, eNamespace, writer);
+    	// If this is a new association, remember it so that it can written out later
+    	if (newPrefix != null) {
+    		if (writePrefixList == null) {
+    			writePrefixList= new ArrayList();
+    			writeNSList = new ArrayList();
+    		}
+    		if (!writePrefixList.contains(newPrefix)) {
+    			writePrefixList.add(newPrefix);
+    			writeNSList.add(eNamespace);
+    		}
+    	}
+    
+        // Now Generate setPrefix for each attribute
+        count = reader.getAttributeCount();
+        for (int i = 0; i < count; i++) {
+            String prefix = reader.getAttributePrefix(i);
+            prefix = (prefix != null && prefix.length() == 0) ? null : prefix;
+            String namespace = reader.getAttributeNamespace(i);
+            namespace = (namespace != null && namespace.length() == 0) ? null : namespace;
+            
+            // Default prefix referencing is not allowed on an attribute
+            if (prefix == null && namespace != null) {
+            	String writerPrefix = writer.getPrefix(namespace);
+            	writerPrefix = (writerPrefix != null && writerPrefix.length() == 0) ? null : writerPrefix;
+            	prefix = (writerPrefix != null) ? 
+            			writerPrefix :
+            	        generateUniquePrefix(writer.getNamespaceContext());

+            }

+            newPrefix = generateSetPrefix(prefix, namespace, writer);
+            // If the prefix is not associated with a namespace yet, remember it so that we can
+        	// write out a namespace declaration
+        	if (newPrefix != null) {
+        		if (writePrefixList == null) {
+        			writePrefixList= new ArrayList();
+        			writeNSList = new ArrayList();
+        		}
+        		if (!writePrefixList.contains(newPrefix)) {
+        			writePrefixList.add(newPrefix);
+        			writeNSList.add(namespace);
+        		}
+        	}
+        }
+        
+        // Now write the startElement
+        if (setPrefixFirst) {
+        	if (eNamespace != null) {
+        		if (ePrefix == null) {
+        			writer.writeStartElement("", reader.getLocalName(), eNamespace);
+        		} else {
+        			writer.writeStartElement(ePrefix, reader.getLocalName(), eNamespace);
+        		}
+        	} else {
+        		writer.writeStartElement(reader.getLocalName());
+        	}

+        }
+
+        // Now write out the list of namespace declarations in this list that we constructed
+    	// while doing the "set" processing.
+    	if (writePrefixList != null) {
+        	for (int i=0; i<writePrefixList.size(); i++) {
+        		String prefix = (String) writePrefixList.get(i);
+        		String namespace = (String) writeNSList.get(i);	
+        		if (prefix != null) {
+            		writer.writeNamespace(prefix, namespace);
+            	} else {
+            		writer.writeDefaultNamespace(namespace);
+            	}
+        	}
+        }
+    	
+        // Now write the attributes
+        count = reader.getAttributeCount();
+        for (int i = 0; i < count; i++) {
+            String prefix = reader.getAttributePrefix(i);
+            prefix = (prefix != null && prefix.length() == 0) ? null : prefix;
+            String namespace = reader.getAttributeNamespace(i);
+            namespace = (namespace != null && namespace.length() == 0) ? null : namespace;
+            
+            
+            if (prefix == null && namespace != null) {
+            	// Default namespaces are not allowed on an attribute reference.
+                // Earlier in this code, a unique prefix was added for this case...now obtain and use it
+            	prefix = writer.getPrefix(namespace);
+            } else if (namespace != null) {
+            	// Use the writer's prefix if it is different
+            	String writerPrefix = writer.getPrefix(namespace);
+            	if (!prefix.equals(writerPrefix)) {
+            		prefix = writerPrefix;
+            	}
+            }
+            if (namespace != null) {
+            	// Qualified attribute
+            	writer.writeAttribute(prefix, namespace,
+                    reader.getAttributeLocalName(i),
+                    reader.getAttributeValue(i));
+            } else {
+            	// Unqualified attribute
+            	writer.writeAttribute(reader.getAttributeLocalName(i),
+                        reader.getAttributeValue(i));
+            }
+        }

+    }
+
+    /**

+     * Generate setPrefix/setDefaultNamespace if the prefix is not associated
+     * @param prefix
+     * @param namespace
+     * @param writer
+     * @return prefix name if a setPrefix/setDefaultNamespace is performed
+     */
+    private String generateSetPrefix(String prefix, String namespace, XMLStreamWriter writer) throws XMLStreamException {
+    	return OMSerializerUtil.generateSetPrefix(prefix, namespace, writer);
+    }
+    
+    /**

+     * Method serializeEndElement.
+     *
+     * @param writer
+     * @throws XMLStreamException
+     */
+    protected void serializeEndElement(XMLStreamWriter writer)
+            throws XMLStreamException {
+        writer.writeEndElement();
+    }
+
+    /**
+     * @param reader
+     * @param writer
+     * @throws XMLStreamException
+     */
+    protected void serializeText(XMLStreamReader reader,
+                                 XMLStreamWriter writer)
+            throws XMLStreamException {
+        writer.writeCharacters(reader.getText());
+    }
+
+    /**
+     * Method serializeCData.
+     *
+     * @param reader
+     * @param writer
+     * @throws XMLStreamException
+     */
+    protected void serializeCData(XMLStreamReader reader,
+                                  XMLStreamWriter writer)
+            throws XMLStreamException {
+        writer.writeCData(reader.getText());
+    }
+
+    /**
+     * Method serializeComment.
+     *
+     * @param reader
+     * @param writer
+     * @throws XMLStreamException
+     */
+    protected void serializeComment(XMLStreamReader reader,
+                                    XMLStreamWriter writer)
+            throws XMLStreamException {
+        writer.writeComment(reader.getText());
+    }
+
+    /**
+     * @param reader
+     * @param writer
+     * @throws XMLStreamException
+     */
+    protected void serializeAttributes(XMLStreamReader reader,
+                                       XMLStreamWriter writer)
+            throws XMLStreamException {
+        int count = reader.getAttributeCount();
+        String prefix = null;
+        String namespaceName = null;
+        String writerPrefix=null;
+        for (int i = 0; i < count; i++) {
+            prefix = reader.getAttributePrefix(i);
+            namespaceName = reader.getAttributeNamespace(i);
+            /*
+               Due to parser implementations returning null as the namespace URI
+              (for the empty namespace) we need to make sure that we deal with
+              a namespace name that is not null. The best way to work around this
+              issue is to set the namespace uri to "" if it is null
+            */
+            if (namespaceName==null) namespaceName="";
+
+            writerPrefix =writer.getNamespaceContext().getPrefix(namespaceName);
+
+            if (!"".equals(namespaceName)){
+                //prefix has already being declared but this particular attrib has a
+                //no prefix attached. So use the prefix provided by the writer
+                if (writerPrefix!=null && (prefix==null || prefix.equals(""))){
+                    writer.writeAttribute(writerPrefix, namespaceName,
+                            reader.getAttributeLocalName(i),
+                            reader.getAttributeValue(i));
+
+                    //writer prefix is available but different from the current
+                    //prefix of the attrib. We should be decalring the new prefix
+                    //as a namespace declaration
+                }else if (prefix!=null && !"".equals(prefix)&& !prefix.equals(writerPrefix)){
+                    writer.writeNamespace(prefix,namespaceName);
+                    writer.writeAttribute(prefix, namespaceName,
+                            reader.getAttributeLocalName(i),
+                            reader.getAttributeValue(i));
+
+                    //prefix is null (or empty), but the namespace name is valid! it has not
+                    //being written previously also. So we need to generate a prefix
+                    //here
+                }else{
+                    prefix = generateUniquePrefix(writer.getNamespaceContext());
+                    writer.writeNamespace(prefix,namespaceName);
+                    writer.writeAttribute(prefix, namespaceName,
+                            reader.getAttributeLocalName(i),
+                            reader.getAttributeValue(i));
+                }
+            }else{
+                //empty namespace is equal to no namespace!
+                writer.writeAttribute(reader.getAttributeLocalName(i),
+                        reader.getAttributeValue(i));
+            }
+
+
+        }
+    }
+
+    /**
+     * Generates a unique namespace prefix that is not in the
+     * scope of the NamespaceContext
+     * @param nsCtxt
+     * @return string
+     */
+    private String generateUniquePrefix(NamespaceContext nsCtxt){
+        String prefix = NAMESPACE_PREFIX + namespaceSuffix++;
+        //null should be returned if the prefix is not bound!
+        while(nsCtxt.getNamespaceURI(prefix)!=null){
+            prefix = NAMESPACE_PREFIX + namespaceSuffix++;
+        }
+
+        return prefix;
+    }
+    /**
+     * Method serializeNamespace.
+     * @param prefix
+     * @param URI
+     * @param writer
+     * @throws XMLStreamException
+     */
+    private void serializeNamespace(String prefix,
+                                    String URI,
+                                    XMLStreamWriter writer)
+            throws XMLStreamException {
+        String prefix1 = writer.getPrefix(URI);
+        if (prefix1 == null) {
+            writer.writeNamespace(prefix, URI);
+            writer.setPrefix(prefix, URI);
+        }
+    }
+}
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/traverse/OMChildElementIterator.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/traverse/OMChildElementIterator.java
new file mode 100644
index 0000000..1be50fc
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/traverse/OMChildElementIterator.java
@@ -0,0 +1,120 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.traverse;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMException;

+import org.apache.axiom.om.OMNode;

+

+import java.util.Iterator;

+

+public class OMChildElementIterator implements Iterator {

+

+    /**

+     * Field currentChild

+     */

+    protected OMNode currentChild;

+

+    /**

+     * Field lastChild

+     */

+    protected OMNode lastChild;

+

+    /**

+     * Field nextCalled

+     */

+    protected boolean nextCalled = false;

+

+    /**

+     * Field removeCalled

+     */

+    protected boolean removeCalled = false;

+

+    /**

+     * Constructor OMChildrenIterator.

+     *

+     * @param currentChild

+     */

+    public OMChildElementIterator(OMElement currentChild) {

+        this.currentChild = currentChild;

+    }

+

+    /**

+     * Removes the last element returned by the iterator (optional operation) 

+     * from the underlying collection. This method can be called only once per

+     * call to <tt>next</tt>.  The behavior of an iterator is unspecified if

+     * the underlying collection is modified while the iteration is in

+     * progress in any way other than by calling this method.

+     *

+     * @throws UnsupportedOperationException if the <tt>remove</tt>

+     *                                       operation is not supported by this Iterator.

+     * @throws IllegalStateException         if the <tt>next</tt> method has not

+     *                                       yet been called, or the <tt>remove</tt> method has already

+     *                                       been called after the last call to the <tt>next</tt>

+     *                                       method.

+     */

+    public void remove() {

+        if (!nextCalled) {

+            throw new IllegalStateException(

+                    "next method has not yet being called");

+        }

+        if (removeCalled) {

+            throw new IllegalStateException("remove has already being called");

+        }

+        removeCalled = true;

+

+        // since this acts on the last child there is no need to mess with the current child

+        if (lastChild == null) {

+            throw new OMException("cannot remove a child at this stage!");

+        }

+        lastChild.detach();

+    }

+

+    /**

+     * Returns <tt>true</tt> if the iteration has more elements. (In other

+     * words, returns <tt>true</tt> if <tt>next</tt> would return an element

+     * rather than throwing an exception.)

+     *

+     * @return Returns <tt>true</tt> if the iterator has more elements.

+     */

+    public boolean hasNext() {

+        return (currentChild != null);

+    }

+

+    /**

+     * Returns the next element in the iteration.

+     *

+     * @return Returns the next element in the iteration.

+     * @throws java.util.NoSuchElementException

+     *          iteration has no more elements.

+     */

+    public Object next() {

+        nextCalled = true;

+        removeCalled = false;

+

+        if (hasNext()) {

+            lastChild = currentChild;

+            do{

+                currentChild = currentChild.getNextOMSibling();

+            }while(currentChild!=null && currentChild.getType()!=OMNode.ELEMENT_NODE);

+

+

+            return lastChild;

+        }

+        return null;

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/traverse/OMChildrenIterator.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/traverse/OMChildrenIterator.java
new file mode 100644
index 0000000..eb9003d
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/traverse/OMChildrenIterator.java
@@ -0,0 +1,125 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.traverse;

+

+import org.apache.axiom.om.OMException;

+import org.apache.axiom.om.OMNode;

+

+import java.util.Iterator;

+import java.util.NoSuchElementException;

+

+/**

+ * Class OMChildrenIterator

+ */

+public class OMChildrenIterator implements Iterator {

+    /**

+     * Field currentChild

+     */

+    protected OMNode currentChild;

+

+    /**

+     * Field lastChild

+     */

+    protected OMNode lastChild;

+

+    /**

+     * Field nextCalled

+     */

+    protected boolean nextCalled = false;

+

+    /**

+     * Field removeCalled

+     */

+    protected boolean removeCalled = false;

+

+    protected boolean isExceptionThrownInAdvancingToNextElement = false;

+

+    /**

+     * Constructor OMChildrenIterator.

+     *

+     * @param currentChild

+     */

+    public OMChildrenIterator(OMNode currentChild) {

+        this.currentChild = currentChild;

+    }

+

+    /**

+     * Removes the last element returned by the iterator (optional operation)

+     * from the underlying collection.   This method must be called only once per

+     * call to <tt>next</tt>.  The behavior of an iterator is unspecified if

+     * the underlying collection is modified while the iteration is in

+     * progress in any way other than by calling this method.

+     *

+     * @throws UnsupportedOperationException if the <tt>remove</tt>

+     *                                       operation is not supported by this Iterator.

+     * @throws IllegalStateException         if the <tt>next</tt> method has not

+     *                                       yet been called, or the <tt>remove</tt> method has already

+     *                                       been called after the last call to the <tt>next</tt>

+     *                                       method.

+     */

+    public void remove() {

+        if (!nextCalled) {

+            throw new IllegalStateException(

+                    "next method has not yet being called");

+        }

+        if (removeCalled) {

+            throw new IllegalStateException("remove has already being called");

+        }

+        removeCalled = true;

+

+        // since this acts on the last child there is no need to mess with the current child

+        if (lastChild == null) {

+            throw new OMException("cannot remove a child at this stage!");

+        }

+        lastChild.detach();

+    }

+

+    /**

+     * Returns <tt>true</tt> if the iteration has more elements. (In other

+     * words, returns <tt>true</tt> if <tt>next</tt> would return an element

+     * rather than throwing an exception.)

+     *

+     * @return Returns <tt>true</tt> if the iterator has more elements. This will never throw an exception even there is an

+     * exception thrown underneath.

+     */

+    public boolean hasNext() {

+        return (currentChild != null && !isExceptionThrownInAdvancingToNextElement);

+    }

+

+    /**

+     * Returns the next element in the iteration.

+     *

+     * @return Returns the next element in the iteration.

+     * @throws java.util.NoSuchElementException

+     *          iteration has no more elements.

+     */

+    public Object next() {

+        nextCalled = true;

+        removeCalled = false;

+        if (hasNext()) {

+            lastChild = currentChild;

+            try {

+                currentChild = currentChild.getNextOMSibling();

+            } catch (OMException e) {

+                isExceptionThrownInAdvancingToNextElement = true;

+            }

+            return lastChild;

+        } else {

+            throw new NoSuchElementException();

+        }

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/traverse/OMChildrenQNameIterator.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/traverse/OMChildrenQNameIterator.java
new file mode 100644
index 0000000..a81dac2
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/traverse/OMChildrenQNameIterator.java
@@ -0,0 +1,141 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.traverse;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMNode;

+

+import javax.xml.namespace.QName;

+

+/**

+ * Class OMChildrenQNameIterator

+ */

+public class OMChildrenQNameIterator extends OMChildrenIterator {

+    /**

+     * Field givenQName

+     */

+    private QName givenQName;

+

+    /**

+     * Field needToMoveForward

+     */

+    private boolean needToMoveForward = true;

+

+    /**

+     * Field isMatchingNodeFound

+     */

+    private boolean isMatchingNodeFound = false;

+

+    /**

+     * Constructor OMChildrenQNameIterator.

+     *

+     * @param currentChild

+     * @param givenQName

+     */

+    public OMChildrenQNameIterator(OMNode currentChild, QName givenQName) {

+        super(currentChild);

+        this.givenQName = givenQName;

+    }

+

+    /**

+     * Returns <tt>true</tt> if the iteration has more elements. (In other

+     * words, returns <tt>true</tt> if <tt>next</tt> would return an element

+     * rather than throwing an exception.)

+     *

+     * @return Returns <tt>true</tt> if the iterator has more elements.

+     */

+    public boolean hasNext() {

+        while (needToMoveForward) {

+            if (currentChild != null) {

+

+                // check the current node for the criteria

+                if ((currentChild instanceof OMElement)

+                        && (isQNamesMatch(

+                                ((OMElement) currentChild).getQName(),

+                                this.givenQName))) {

+                    isMatchingNodeFound = true;

+                    needToMoveForward = false;

+                } else {

+

+                    // get the next named node

+                    currentChild = currentChild.getNextOMSibling();

+                    isMatchingNodeFound = needToMoveForward = !(currentChild

+                            == null);

+                }

+            } else {

+                needToMoveForward = false;

+            }

+        }

+        return isMatchingNodeFound;

+    }

+

+    /**

+     * Returns the next element in the iteration.

+     *

+     * @return Returns the next element in the iteration.

+     * @throws java.util.NoSuchElementException

+     *          iteration has no more elements.

+     */

+    public Object next() {

+

+        // reset the flags

+        needToMoveForward = true;

+        isMatchingNodeFound = false;

+        nextCalled = true;

+        removeCalled = false;

+        lastChild = currentChild;

+        currentChild = currentChild.getNextOMSibling();

+        return lastChild;

+    }

+

+    /**

+     * Cannot use the overridden equals method of QName, as one might want to get

+     * some element just by giving the localname, even though a matching element 

+     * has a namespace uri as well.

+     * This is not supported in the equals method of the QName.

+     *

+     * @param elementQName

+     * @param qNameToBeMatched

+     * @return Returns boolean.

+     */

+    private boolean isQNamesMatch(QName elementQName, QName qNameToBeMatched) {

+

+        // if no QName was given, that means user is asking for all

+        if (qNameToBeMatched == null) {

+            return true;

+        }

+

+        // if the given localname is null, whatever value this.qname has, its a match. But can one give a QName without a localName ??

+        boolean localNameMatch =

+                (qNameToBeMatched.getLocalPart() == null)

+                || (qNameToBeMatched.getLocalPart() == "")

+                ||

+                ((elementQName != null)

+                &&

+                elementQName.getLocalPart().equalsIgnoreCase(

+                        qNameToBeMatched.getLocalPart()));

+        boolean namespaceURIMatch =

+                (qNameToBeMatched.getNamespaceURI() == null)

+                || (qNameToBeMatched.getNamespaceURI() == "")

+                ||

+                ((elementQName != null)

+                &&

+                elementQName.getNamespaceURI().equalsIgnoreCase(

+                        qNameToBeMatched.getNamespaceURI()));

+        return localNameMatch && namespaceURIMatch;

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/traverse/OMChildrenWithSpecificAttributeIterator.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/traverse/OMChildrenWithSpecificAttributeIterator.java
new file mode 100644
index 0000000..8fe3844
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/traverse/OMChildrenWithSpecificAttributeIterator.java
@@ -0,0 +1,118 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.traverse;

+

+import org.apache.axiom.om.OMAttribute;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMNode;

+

+import javax.xml.namespace.QName;

+

+/**

+ * Class OMChildrenWithSpecificAttributeIterator

+ */

+public class OMChildrenWithSpecificAttributeIterator

+        extends OMChildrenIterator {

+    /**

+     * Field attributeName

+     */

+    private QName attributeName;

+

+    /**

+     * Field attributeValue

+     */

+    private String attributeValue;

+

+    /**

+     * Field detach

+     */

+    private boolean detach;

+

+    /**

+     * Constructor OMChildrenWithSpecificAttributeIterator.

+     *

+     * @param currentChild

+     * @param attributeName

+     * @param attributeValue

+     * @param detach

+     */

+    public OMChildrenWithSpecificAttributeIterator(OMNode currentChild,

+                                                   QName attributeName,

+                                                   String attributeValue,

+                                                   boolean detach) {

+        super(currentChild);

+        this.attributeName = attributeName;

+        this.attributeValue = attributeValue;

+        this.detach = detach;

+    }

+

+    /**

+     * Method hasNext.

+     *

+     * @return Returns boolean.

+     */

+    public boolean hasNext() {

+

+        // First check whether we have a child, using the super class

+        if (currentChild == null) {

+            return false;

+        }

+        boolean isMatchingNodeFound = false;

+        boolean needToMoveForward = true;

+

+        // now we have a child to check. If its an OMElement and matches the criteria, then we are done

+        while (needToMoveForward) {

+

+            // check the current node for the criteria

+            if (currentChild instanceof OMElement) {

+                OMAttribute attr =

+                        ((OMElement) currentChild).getAttribute(

+                                attributeName);

+                if ((attr != null)

+                        && attr.getAttributeValue().equalsIgnoreCase(attributeValue)) {

+                    isMatchingNodeFound = true;

+                    needToMoveForward = false;

+                } else {

+                    currentChild = currentChild.getNextOMSibling();

+                    needToMoveForward = !(currentChild == null);

+                }

+            } else {

+

+                // get the next named node

+                currentChild = currentChild.getNextOMSibling();

+                needToMoveForward = !(currentChild == null);

+            }

+        }

+        return isMatchingNodeFound;

+    }

+

+    /**

+     * Method next.

+     *

+     * @return Returns Object.

+     */

+    public Object next() {

+        nextCalled = true;

+        removeCalled = false;

+        lastChild = currentChild;

+        currentChild = currentChild.getNextOMSibling();

+        if ((lastChild != null) && detach && lastChild.getParent() != null) {

+            lastChild.detach();

+        }

+        return lastChild;

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/util/EmptyIterator.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/util/EmptyIterator.java
new file mode 100644
index 0000000..cd2c79d
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/util/EmptyIterator.java
@@ -0,0 +1,35 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.util;

+

+import java.util.Iterator;

+

+public class EmptyIterator implements Iterator {

+    public void remove() {

+        throw new UnsupportedOperationException();

+

+    }

+

+    public boolean hasNext() {

+        return false;

+    }

+

+    public Object next() {

+        throw new UnsupportedOperationException();

+    }

+}

+

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/util/OMSerializerUtil.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/util/OMSerializerUtil.java
new file mode 100644
index 0000000..cdbcc91
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/util/OMSerializerUtil.java
@@ -0,0 +1,529 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.util;

+

+import org.apache.axiom.om.OMAttribute;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMNode;

+import org.apache.axiom.om.impl.OMNodeEx;

+import org.apache.axiom.om.impl.serialize.StreamingOMSerializer;

+

+import javax.xml.namespace.NamespaceContext;

+import javax.xml.stream.XMLStreamException;

+import javax.xml.stream.XMLStreamReader;

+import javax.xml.stream.XMLStreamWriter;

+import java.util.ArrayList;

+import java.util.Iterator;

+

+public class OMSerializerUtil {

+

+    static long nsCounter = 0;

+

+    /**

+     * Method serializeEndpart.

+     *

+     * @param writer

+     * @throws javax.xml.stream.XMLStreamException

+     *

+     */

+    public static void serializeEndpart(XMLStreamWriter writer)

+            throws XMLStreamException {

+        writer.writeEndElement();

+    }

+

+    /**

+     * Method serializeAttribute.

+     *

+     * @param attr

+     * @param writer

+     * @throws XMLStreamException

+     * @deprecated use serializeStartpart instead

+     */

+    public static void serializeAttribute(OMAttribute attr, XMLStreamWriter writer)

+            throws XMLStreamException {

+

+        // first check whether the attribute is associated with a namespace

+        OMNamespace ns = attr.getNamespace();

+        String prefix = null;

+        String namespaceName = null;

+        if (ns != null) {

+

+            // add the prefix if it's availble

+            prefix = ns.getPrefix();

+            namespaceName = ns.getNamespaceURI();

+            if (prefix != null) {

+                writer.writeAttribute(prefix, namespaceName,

+                        attr.getLocalName(), attr.getAttributeValue());

+            } else {

+                writer.writeAttribute(namespaceName, attr.getLocalName(),

+                        attr.getAttributeValue());

+            }

+        } else {

+            String localName = attr.getLocalName();

+            String attributeValue = attr.getAttributeValue();

+            writer.writeAttribute(localName, attributeValue);

+        }

+    }

+

+    /**

+     * Method serializeNamespace.

+     *

+     * @param namespace

+     * @param writer

+     * @throws XMLStreamException

+     * @deprecated Use serializeStartpart instead

+     */

+    public static void serializeNamespace(OMNamespace namespace, XMLStreamWriter writer)

+            throws XMLStreamException {

+        if (namespace == null) {

+            return;

+        }

+        String uri = namespace.getNamespaceURI();

+        String prefix = namespace.getPrefix();

+

+        if (uri != null && !"".equals(uri)) {

+            String prefixFromWriter = writer.getPrefix(uri);

+

+            // Handling Default Namespaces First

+            // Case 1 :

+            //        here we are trying define a default namespace. But has this been defined in the current context.

+            //        yes, there can be a default namespace, but it may have a different URI. If its a different URI

+            //        then explicitly define the default namespace here.

+            // Case 2 :

+            //        The passed in namespace is a default ns, but there is a non-default ns declared

+            //        in the current scope.

+            if (("".equals(prefix) && "".equals(prefixFromWriter) && !uri.equals(writer.getNamespaceContext().getNamespaceURI(""))) ||

+                    (prefix != null && "".equals(prefix) && (prefixFromWriter == null || !prefix.equals(prefixFromWriter))))

+            {

+                // this has not been declared earlier

+                writer.writeDefaultNamespace(uri);

+                writer.setDefaultNamespace(uri);

+            } else {

+                prefix = prefix == null ? getNextNSPrefix(writer) : prefix;

+                if (prefix != null && !prefix.equals(prefixFromWriter) && !checkForPrefixInTheCurrentContext(writer, uri, prefix))

+                {

+                    writer.writeNamespace(prefix, uri);

+                    writer.setPrefix(prefix, uri);

+                }

+            }

+        } else {

+            // now the nsURI passed is "" or null. Meaning we gonna work with defaultNS.

+            // check whether there is a defaultNS already declared. If yes, is it the same as this ?

+            String currentDefaultNSURI = writer.getNamespaceContext().getNamespaceURI("");

+            if( (currentDefaultNSURI != null && !currentDefaultNSURI.equals(uri)) ||

+                    uri != null && !uri.equals(currentDefaultNSURI)){

+                // this has not been declared earlier

+                writer.writeDefaultNamespace(uri);

+                writer.setDefaultNamespace(uri);

+            }

+        }

+    }

+

+    /**

+     * Unfortunately there is disagreement in the user community about the semantics of

+     * setPrefix on the XMLStreamWriter.  An example will explain the difference:

+     * writer.startElement("a")

+     * writer.setPrefix("pre", "urn://sample")

+     * writer.startElement("b")

+     * 

+     * Some user communities (woodstox) believe that the setPrefix is associate with the scope

+     * for "a" and thus remains in scope until the end of a.  The basis for this believe is 

+     * XMLStreamWriter javadoc (which some would argue is incomplete).

+     * 

+     * Some user communities believe that the setPrefix is associated with the "b" element.

+     * These communities reference an example in the specification and historical usage of SAX.

+     *

+     * This method will return true if the setPrefix is associated with the next writeStartElement.

+     * 

+     * @param writer

+     * @return true if setPrefix should be generated before startElement

+     */

+    public static boolean isSetPrefixBeforeStartElement(XMLStreamWriter writer) {

+    	NamespaceContext nc = writer.getNamespaceContext();

+    	return(nc ==null || nc.getClass().getName().indexOf("wstx") == -1);

+    }

+    

+    /**

+     * Method serializeStartpart.

+     * Serialize the start tag of an element.

+     *

+     * @param element

+     * @param writer

+     * @throws XMLStreamException

+     */

+    public static void serializeStartpart(OMElement element, 

+    		XMLStreamWriter writer) throws XMLStreamException {

+    	serializeStartpart(element, element.getLocalName(), writer);

+    }

+    

+    /**

+     * Method serializeStartpart.

+     * Serialize the start tag of an element.

+     *

+     * @param element

+     * @param localName (in some cases, the caller wants to force a different localName)

+     * @param writer

+     * @throws XMLStreamException

+     */

+    public static void serializeStartpart(OMElement element, String localName, XMLStreamWriter writer)

+            throws XMLStreamException {

+    	

+    	// Note: To serialize the start tag, we must follow the order dictated by the JSR-173 (StAX) specification.

+    	// Please keep this code in sync with the code in StreamingOMSerializer.serializeElement

+    

+        // The algorithm is:

+        // ... generate setPrefix/setDefaultNamespace for each namespace declaration if the prefix is unassociated.

+    	// ... generate setPrefix/setDefaultNamespace if the prefix of the element is unassociated

+    	// ... generate setPrefix/setDefaultNamespace for each unassociated prefix of the attributes.

+    	//

+    	// ... generate writeStartElement (See NOTE_A)

+    	//

+    	// ... generate writeNamespace/writerDefaultNamespace for the new namespace declarations determine during the "set" processing

+    	// ... generate writeAttribute for each attribute	

+    	

+    	// NOTE_A: To confuse matters, some StAX vendors (including woodstox), believe that the setPrefix bindings 

+    	// should occur after the writeStartElement.  If this is the case, the writeStartElement is generated first.

+    	

+    	ArrayList  writePrefixList = null;

+    	ArrayList  writeNSList = null;

+    

+    	// Get the namespace and prefix of the element

+    	OMNamespace eOMNamespace = element.getNamespace();

+    	String ePrefix = null;

+		String eNamespace = null;

+		if (eOMNamespace != null) {

+			ePrefix = eOMNamespace.getPrefix();

+			eNamespace = eOMNamespace.getNamespaceURI();

+		}

+		ePrefix = (ePrefix != null && ePrefix.length() == 0) ? null : ePrefix;

+		eNamespace = (eNamespace != null && eNamespace.length() == 0) ? null : eNamespace;

+		

+		// Write the startElement if required

+		boolean setPrefixFirst = isSetPrefixBeforeStartElement(writer);

+        if (!setPrefixFirst) {

+        	if (eNamespace != null) {

+        		if (ePrefix == null) {

+        			writer.writeStartElement("", localName, eNamespace);

+        		} else {

+        			writer.writeStartElement(ePrefix, localName, eNamespace);

+        		}

+        	} else {

+        		writer.writeStartElement(localName);

+        	}

+        }

+		

+    	// Generate setPrefix for the namespace declarations

+    	Iterator it = element.getAllDeclaredNamespaces();

+    	while (it != null && it.hasNext()) {

+    		OMNamespace omNamespace = (OMNamespace) it.next();

+    		String prefix = null;

+    		String namespace = null;

+    		if (omNamespace != null) {

+    			prefix = omNamespace.getPrefix();

+    			namespace = omNamespace.getNamespaceURI();

+    		}

+        	prefix = (prefix != null && prefix.length() == 0) ? null : prefix;

+        	namespace = (namespace != null && namespace.length() == 0) ? null : namespace;

+        	

+        	

+        	String newPrefix = generateSetPrefix(prefix, namespace, writer);

+        	// If this is a new association, remember it so that it can written out later

+        	if (newPrefix != null) {

+        		if (writePrefixList == null) {

+        			writePrefixList= new ArrayList();

+        			writeNSList = new ArrayList();

+        		}

+        		if (!writePrefixList.contains(newPrefix)) {

+        			writePrefixList.add(newPrefix);

+        			writeNSList.add(namespace);

+        		}

+        	}

+        }

+    	

+    	// Generate setPrefix for the element

+    	// Get the prefix and namespace of the element.  "" and null are identical.

+    	String newPrefix = generateSetPrefix(ePrefix, eNamespace, writer);

+    	// If this is a new association, remember it so that it can written out later

+    	if (newPrefix != null) {

+    		if (writePrefixList == null) {

+    			writePrefixList= new ArrayList();

+    			writeNSList = new ArrayList();

+    		}

+    		if (!writePrefixList.contains(newPrefix)) {

+    			writePrefixList.add(newPrefix);

+    			writeNSList.add(eNamespace);

+    		}

+    	}

+    	

+    	// Now Generate setPrefix for each attribute

+    	Iterator attrs = element.getAllAttributes();

+        while (attrs != null && attrs.hasNext()) {

+        	OMAttribute attr = (OMAttribute) attrs.next();

+        	OMNamespace omNamespace = attr.getNamespace();

+        	String prefix = null;

+    		String namespace = null;

+    		if (omNamespace != null) {

+    			prefix = omNamespace.getPrefix();

+    			namespace = omNamespace.getNamespaceURI();

+    		}

+        	prefix = (prefix != null && prefix.length() == 0) ? null : prefix;

+        	namespace = (namespace != null && namespace.length() == 0) ? null : namespace;

+            

+            // Default prefix referencing is not allowed on an attribute

+            if (prefix == null && namespace != null) {

+            	String writerPrefix = writer.getPrefix(namespace);

+            	writerPrefix = (writerPrefix != null && writerPrefix.length() == 0) ? null : writerPrefix;

+            	prefix = (writerPrefix != null) ? 

+            			writerPrefix : getNextNSPrefix();

+            }

+            newPrefix = generateSetPrefix(prefix, namespace, writer);

+            // If the prefix is not associated with a namespace yet, remember it so that we can

+        	// write out a namespace declaration

+        	if (newPrefix != null) {

+        		if (writePrefixList == null) {

+        			writePrefixList= new ArrayList();

+        			writeNSList = new ArrayList();

+        		}

+        		if (!writePrefixList.contains(newPrefix)) {

+        			writePrefixList.add(newPrefix);

+        			writeNSList.add(namespace);

+        		}

+        	}

+        }

+        

+        // Write the startElement if required

+        if (setPrefixFirst) {

+        	if (eNamespace != null) {

+        		if (ePrefix == null) {

+        			writer.writeStartElement("", localName, eNamespace);

+        		} else {

+        			writer.writeStartElement(ePrefix, localName, eNamespace);

+        		}

+        	} else {

+        		writer.writeStartElement(localName);

+        	}

+        }

+        

+        // Now write out the list of namespace declarations in this list that we constructed

+    	// while doing the "set" processing.

+    	if (writePrefixList != null) {

+        	for (int i=0; i<writePrefixList.size(); i++) {

+        		String prefix = (String) writePrefixList.get(i);

+        		String namespace = (String) writeNSList.get(i);	

+        		if (prefix != null) {

+            		writer.writeNamespace(prefix, namespace);

+            	} else {

+            		writer.writeDefaultNamespace(namespace);

+            	}

+        	}

+        }

+        

+        // Now write the attributes

+    	attrs = element.getAllAttributes();

+        while (attrs != null && attrs.hasNext()) {

+        	OMAttribute attr = (OMAttribute) attrs.next();

+        	OMNamespace omNamespace = attr.getNamespace();

+        	String prefix = null;

+    		String namespace = null;

+    		if (omNamespace != null) {

+    			prefix = omNamespace.getPrefix();

+    			namespace = omNamespace.getNamespaceURI();

+    		}

+        	prefix = (prefix != null && prefix.length() == 0) ? null : prefix;

+        	namespace = (namespace != null && namespace.length() == 0) ? null : namespace;

+        

+            if (prefix == null && namespace != null) {

+            	// Default namespaces are not allowed on an attribute reference.

+                // Earlier in this code, a unique prefix was added for this case...now obtain and use it

+            	prefix = writer.getPrefix(namespace);

+            } else if (namespace != null) {

+            	// Use the writer's prefix if it is different

+            	String writerPrefix = writer.getPrefix(namespace);

+            	if (!prefix.equals(writerPrefix)) {

+            		prefix = writerPrefix;

+            	}

+            }

+            if (namespace != null) {

+            	// Qualified attribute

+            	writer.writeAttribute(prefix, namespace,

+                    attr.getLocalName(),

+                    attr.getAttributeValue());

+            } else {

+            	// Unqualified attribute

+            	writer.writeAttribute(attr.getLocalName(),

+                        attr.getAttributeValue());

+            }

+        }

+    }

+

+    private static boolean checkForPrefixInTheCurrentContext(XMLStreamWriter writer, String nameSpaceName, String prefix) throws XMLStreamException {

+        Iterator prefixesIter = writer.getNamespaceContext().getPrefixes(nameSpaceName);

+        while (prefixesIter.hasNext()) {

+            String prefix_w = (String) prefixesIter.next();

+            if (prefix_w.equals(prefix)) {

+                // if found do not declare the ns

+                return true;

+            }

+        }

+        return false;

+    }

+

+    /**

+     * serializeNamespaces

+     *

+     * @param element

+     * @param writer

+     * @throws XMLStreamException

+     * @deprecated Use serializeStartpart instead

+     */

+    public static void serializeNamespaces

+            (OMElement

+                    element,

+             XMLStreamWriter writer) throws XMLStreamException {

+        Iterator namespaces = element.getAllDeclaredNamespaces();

+        if (namespaces != null) {

+            while (namespaces.hasNext()) {

+                serializeNamespace((OMNamespace) namespaces.next(), writer);

+            }

+        }

+    }

+

+    /**

+     * Serialize attributes

+     * @param element

+     * @param writer

+     * @throws XMLStreamException

+     * @deprecated Consider using serializeStartpart instead

+     */

+    public static void serializeAttributes

+            (OMElement

+                    element,

+             XMLStreamWriter writer) throws XMLStreamException {

+        Iterator attributes = element.getAllAttributes();

+        if (attributes != null && attributes.hasNext()) {

+            while (attributes.hasNext()) {

+                serializeAttribute((OMAttribute) attributes.next(),

+                        writer);

+            }

+        }

+    }

+

+    /**

+     * Method serializeNormal.

+     *

+     * @param writer

+     * @param cache

+     * @throws XMLStreamException

+     */

+    public static void serializeNormal

+            (OMElement

+                    element, XMLStreamWriter writer, boolean cache)

+            throws XMLStreamException {

+

+        if (cache) {

+            element.build();

+        }

+

+        serializeStartpart(element, writer);

+        OMNode firstChild = element.getFirstOMChild();

+        if (firstChild != null) {

+            if (cache) {

+                (firstChild).serialize(writer);

+            } else {

+                (firstChild).serializeAndConsume(writer);

+            }

+        }

+        serializeEndpart(writer);

+    }

+

+    public static void serializeByPullStream

+            (OMElement

+                    element, XMLStreamWriter writer) throws XMLStreamException {

+        serializeByPullStream(element, writer, false);

+    }

+

+    public static void serializeByPullStream

+            (OMElement

+                    element, XMLStreamWriter writer, boolean cache) throws XMLStreamException {

+        StreamingOMSerializer streamingOMSerializer = new StreamingOMSerializer();

+        if (cache) {

+            streamingOMSerializer.serialize(element.getXMLStreamReader(),

+                    writer);

+        } else {

+            XMLStreamReader xmlStreamReaderWithoutCaching = element.getXMLStreamReaderWithoutCaching();

+            streamingOMSerializer.serialize(xmlStreamReaderWithoutCaching,

+                    writer);

+        }

+    }

+

+    public static String getNextNSPrefix() {

+        return "axis2ns" + ++nsCounter % Long.MAX_VALUE;

+    }

+

+    public static String getNextNSPrefix(XMLStreamWriter writer) {

+        String prefix = getNextNSPrefix();

+        while (writer.getNamespaceContext().getNamespaceURI(prefix) != null) {

+            prefix = getNextNSPrefix();

+        }

+

+        return prefix;

+    }

+    

+    /**

+     * Generate setPrefix/setDefaultNamespace if the prefix is not associated

+     * @param prefix

+     * @param namespace

+     * @param writer

+     * @return prefix name if a setPrefix/setDefaultNamespace is performed

+     */

+    public static String generateSetPrefix(String prefix, String namespace, XMLStreamWriter writer) throws XMLStreamException {

+    	// Generate setPrefix/setDefaultNamespace if the prefix is not associated.

+    	String newPrefix = null;

+        if (namespace != null) {

+        	// Qualified Namespace

+        	

+        	// Get the namespace associated with this writer

+        	String writerNS = writer.getNamespaceContext().getNamespaceURI((prefix==null) ? "" : prefix);

+        	writerNS = (writerNS != null && writerNS.length() == 0) ? null : writerNS;

+

+        	if (writerNS == null || !writerNS.equals(namespace)) {

+        		// Writer has not associated this namespace with a prefix

+        		if (prefix == null) {

+        			writer.setDefaultNamespace(namespace);

+        			newPrefix = "";

+        		} else {

+        			writer.setPrefix(prefix, namespace);

+        			newPrefix = prefix;

+        		}

+        	} else {

+        		// No Action needed..The writer already has associated this prefix to this namespace

+        	}

+        } else {

+        	// Unqualified Namespace

+        	

+        	// Make sure the default namespace is either not used or disabled (set to "")

+        	String writerNS = writer.getNamespaceContext().getNamespaceURI("");

+        	if (writerNS != null && writerNS.length() > 0) {

+        		// Disable the default namespace

+        		writer.setDefaultNamespace("");

+        		newPrefix = "";

+        	}

+        }

+        return newPrefix;

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/Base64.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/Base64.java
new file mode 100644
index 0000000..e0d4494
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/Base64.java
@@ -0,0 +1,295 @@
+package org.apache.axiom.om.util;

+

+import java.io.IOException;

+import java.io.OutputStream;

+import java.io.Writer;

+

+/*

+ * Copyright 2001-2004 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ *

+ */

+

+public class Base64 {

+    private static final char[] S_BASE64CHAR = {'A', 'B', 'C', 'D', 'E', 'F',

+            'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',

+            'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',

+            'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',

+            't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5',

+            '6', '7', '8', '9', '+', '/'};

+

+    private static final char S_BASE64PAD = '=';

+

+    private static final byte[] S_DECODETABLE = new byte[128];

+

+    static {

+        for (int i = 0; i < S_DECODETABLE.length; i++)

+            S_DECODETABLE[i] = Byte.MAX_VALUE; // 127

+        for (int i = 0; i < S_BASE64CHAR.length; i++)

+            // 0 to 63

+            S_DECODETABLE[S_BASE64CHAR[i]] = (byte) i;

+    }

+

+    private static int decode0(char[] ibuf, byte[] obuf, int wp) {

+        int outlen = 3;

+        if (ibuf[3] == S_BASE64PAD)

+            outlen = 2;

+        if (ibuf[2] == S_BASE64PAD)

+            outlen = 1;

+        int b0 = S_DECODETABLE[ibuf[0]];

+        int b1 = S_DECODETABLE[ibuf[1]];

+        int b2 = S_DECODETABLE[ibuf[2]];

+        int b3 = S_DECODETABLE[ibuf[3]];

+        switch (outlen) {

+            case 1:

+                obuf[wp] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3);

+                return 1;

+            case 2:

+                obuf[wp++] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3);

+                obuf[wp] = (byte) (b1 << 4 & 0xf0 | b2 >> 2 & 0xf);

+                return 2;

+            case 3:

+                obuf[wp++] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3);

+                obuf[wp++] = (byte) (b1 << 4 & 0xf0 | b2 >> 2 & 0xf);

+                obuf[wp] = (byte) (b2 << 6 & 0xc0 | b3 & 0x3f);

+                return 3;

+            default:

+                throw new RuntimeException("internalError00");

+        }

+    }

+

+    /**

+     *

+     */

+    public static byte[] decode(char[] data, int off, int len) {

+        char[] ibuf = new char[4];

+        int ibufcount = 0;

+        byte[] obuf = new byte[len / 4 * 3 + 3];

+        int obufcount = 0;

+        for (int i = off; i < off + len; i++) {

+            char ch = data[i];

+            if (ch == S_BASE64PAD || ch < S_DECODETABLE.length

+                    && S_DECODETABLE[ch] != Byte.MAX_VALUE) {

+                ibuf[ibufcount++] = ch;

+                if (ibufcount == ibuf.length) {

+                    ibufcount = 0;

+                    obufcount += decode0(ibuf, obuf, obufcount);

+                }

+            }

+        }

+        if (obufcount == obuf.length)

+            return obuf;

+        byte[] ret = new byte[obufcount];

+        System.arraycopy(obuf, 0, ret, 0, obufcount);

+        return ret;

+    }

+

+    /**

+     *

+     */

+    public static byte[] decode(String data) {

+        char[] ibuf = new char[4];

+        int ibufcount = 0;

+        byte[] obuf = new byte[data.length() / 4 * 3 + 3];

+        int obufcount = 0;

+        for (int i = 0; i < data.length(); i++) {

+            char ch = data.charAt(i);

+            if (ch == S_BASE64PAD || ch < S_DECODETABLE.length

+                    && S_DECODETABLE[ch] != Byte.MAX_VALUE) {

+                ibuf[ibufcount++] = ch;

+                if (ibufcount == ibuf.length) {

+                    ibufcount = 0;

+                    obufcount += decode0(ibuf, obuf, obufcount);

+                }

+            }

+        }

+        if (obufcount == obuf.length)

+            return obuf;

+        byte[] ret = new byte[obufcount];

+        System.arraycopy(obuf, 0, ret, 0, obufcount);

+        return ret;

+    }

+

+    /**

+     *

+     */

+    public static void decode(char[] data, int off, int len,

+                              OutputStream ostream) throws IOException {

+        char[] ibuf = new char[4];

+        int ibufcount = 0;

+        byte[] obuf = new byte[3];

+        for (int i = off; i < off + len; i++) {

+            char ch = data[i];

+            if (ch == S_BASE64PAD || ch < S_DECODETABLE.length

+                    && S_DECODETABLE[ch] != Byte.MAX_VALUE) {

+                ibuf[ibufcount++] = ch;

+                if (ibufcount == ibuf.length) {

+                    ibufcount = 0;

+                    int obufcount = decode0(ibuf, obuf, 0);

+                    ostream.write(obuf, 0, obufcount);

+                }

+            }

+        }

+    }

+

+    /**

+     *

+     */

+    public static void decode(String data, OutputStream ostream)

+            throws IOException {

+        char[] ibuf = new char[4];

+        int ibufcount = 0;

+        byte[] obuf = new byte[3];

+        for (int i = 0; i < data.length(); i++) {

+            char ch = data.charAt(i);

+            if (ch == S_BASE64PAD || ch < S_DECODETABLE.length

+                    && S_DECODETABLE[ch] != Byte.MAX_VALUE) {

+                ibuf[ibufcount++] = ch;

+                if (ibufcount == ibuf.length) {

+                    ibufcount = 0;

+                    int obufcount = decode0(ibuf, obuf, 0);

+                    ostream.write(obuf, 0, obufcount);

+                }

+            }

+        }

+    }

+

+    /**

+     * Returns base64 representation of specified byte array.

+     */

+    public static String encode(byte[] data) {

+        return encode(data, 0, data.length);

+    }

+

+    /**

+     * Returns base64 representation of specified byte array.

+     */

+    public static String encode(byte[] data, int off, int len) {

+        if (len <= 0)

+            return "";

+        char[] out = new char[len / 3 * 4 + 4];

+        int rindex = off;

+        int windex = 0;

+        int rest = len - off;

+        while (rest >= 3) {

+            int i = ((data[rindex] & 0xff) << 16)

+                    + ((data[rindex + 1] & 0xff) << 8)

+                    + (data[rindex + 2] & 0xff);

+            out[windex++] = S_BASE64CHAR[i >> 18];

+            out[windex++] = S_BASE64CHAR[(i >> 12) & 0x3f];

+            out[windex++] = S_BASE64CHAR[(i >> 6) & 0x3f];

+            out[windex++] = S_BASE64CHAR[i & 0x3f];

+            rindex += 3;

+            rest -= 3;

+        }

+        if (rest == 1) {

+            int i = data[rindex] & 0xff;

+            out[windex++] = S_BASE64CHAR[i >> 2];

+            out[windex++] = S_BASE64CHAR[(i << 4) & 0x3f];

+            out[windex++] = S_BASE64PAD;

+            out[windex++] = S_BASE64PAD;

+        } else if (rest == 2) {

+            int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff);

+            out[windex++] = S_BASE64CHAR[i >> 10];

+            out[windex++] = S_BASE64CHAR[(i >> 4) & 0x3f];

+            out[windex++] = S_BASE64CHAR[(i << 2) & 0x3f];

+            out[windex++] = S_BASE64PAD;

+        }

+        return new String(out, 0, windex);

+    }

+

+    /**

+     * Outputs base64 representation of the specified byte array to a byte

+     * stream.

+     */

+    public static void encode(byte[] data, int off, int len,

+                              OutputStream ostream) throws IOException {

+        if (len <= 0)

+            return;

+        byte[] out = new byte[4];

+        int rindex = off;

+        int rest = len - off;

+        while (rest >= 3) {

+            int i = ((data[rindex] & 0xff) << 16)

+                    + ((data[rindex + 1] & 0xff) << 8)

+                    + (data[rindex + 2] & 0xff);

+            out[0] = (byte) S_BASE64CHAR[i >> 18];

+            out[1] = (byte) S_BASE64CHAR[(i >> 12) & 0x3f];

+            out[2] = (byte) S_BASE64CHAR[(i >> 6) & 0x3f];

+            out[3] = (byte) S_BASE64CHAR[i & 0x3f];

+            ostream.write(out, 0, 4);

+            rindex += 3;

+            rest -= 3;

+        }

+        if (rest == 1) {

+            int i = data[rindex] & 0xff;

+            out[0] = (byte) S_BASE64CHAR[i >> 2];

+            out[1] = (byte) S_BASE64CHAR[(i << 4) & 0x3f];

+            out[2] = (byte) S_BASE64PAD;

+            out[3] = (byte) S_BASE64PAD;

+            ostream.write(out, 0, 4);

+        } else if (rest == 2) {

+            int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff);

+            out[0] = (byte) S_BASE64CHAR[i >> 10];

+            out[1] = (byte) S_BASE64CHAR[(i >> 4) & 0x3f];

+            out[2] = (byte) S_BASE64CHAR[(i << 2) & 0x3f];

+            out[3] = (byte) S_BASE64PAD;

+            ostream.write(out, 0, 4);

+        }

+    }

+

+    /**

+     * Outputs base64 representation of the specified byte array to a character

+     * stream.

+     */

+    public static void encode(byte[] data, int off, int len, Writer writer)

+            throws IOException {

+        if (len <= 0)

+            return;

+        char[] out = new char[4];

+        int rindex = off;

+        int rest = len - off;

+        int output = 0;

+        while (rest >= 3) {

+            int i = ((data[rindex] & 0xff) << 16)

+                    + ((data[rindex + 1] & 0xff) << 8)

+                    + (data[rindex + 2] & 0xff);

+            out[0] = S_BASE64CHAR[i >> 18];

+            out[1] = S_BASE64CHAR[(i >> 12) & 0x3f];

+            out[2] = S_BASE64CHAR[(i >> 6) & 0x3f];

+            out[3] = S_BASE64CHAR[i & 0x3f];

+            writer.write(out, 0, 4);

+            rindex += 3;

+            rest -= 3;

+            output += 4;

+            if (output % 76 == 0)

+                writer.write("\n");

+        }

+        if (rest == 1) {

+            int i = data[rindex] & 0xff;

+            out[0] = S_BASE64CHAR[i >> 2];

+            out[1] = S_BASE64CHAR[(i << 4) & 0x3f];

+            out[2] = S_BASE64PAD;

+            out[3] = S_BASE64PAD;

+            writer.write(out, 0, 4);

+        } else if (rest == 2) {

+            int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff);

+            out[0] = S_BASE64CHAR[i >> 10];

+            out[1] = S_BASE64CHAR[(i >> 4) & 0x3f];

+            out[2] = S_BASE64CHAR[(i << 2) & 0x3f];

+            out[3] = S_BASE64PAD;

+            writer.write(out, 0, 4);

+        }

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/DigestGenerator.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/DigestGenerator.java
new file mode 100644
index 0000000..2a13111
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/DigestGenerator.java
@@ -0,0 +1,330 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.util;
+
+import org.apache.axiom.om.*;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.*;
+
+/**
+ * Helper class to provide the functionality of the digest value generation.
+ * This is an implementation of the DOMHASH algorithm on OM.
+ */
+public class DigestGenerator {
+
+    /**
+     * This method is an overloaded method for the digest generation for OMDocument
+     *
+     * @param document
+     * @param digestAlgorithm
+     * @return Returns a byte array representing the calculated digest
+     */
+    public byte[] getDigest(OMDocument document, String digestAlgorithm) throws OMException {
+        byte[] digest = new byte[0];
+        try {
+            MessageDigest md = MessageDigest.getInstance(digestAlgorithm);
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            DataOutputStream dos = new DataOutputStream(baos);
+            dos.writeInt(9);
+            Collection childNodes = getValidElements(document);
+            dos.writeInt(childNodes.size());
+            Iterator itr = childNodes.iterator();
+            while(itr.hasNext()) {
+                OMNode node = (OMNode) itr.next();
+                if (node.getType() == OMNode.PI_NODE)
+                    dos.write(getDigest((OMProcessingInstruction) node, digestAlgorithm)); else if (
+                        node.getType() == OMNode.ELEMENT_NODE)
+                    dos.write(getDigest((OMElement) node, digestAlgorithm));
+            }
+            dos.close();
+            md.update(baos.toByteArray());
+            digest = md.digest();
+        } catch (NoSuchAlgorithmException e) {
+            throw new OMException(e);
+        } catch (IOException e) {
+            throw new OMException(e);
+        }
+        return digest;
+    }
+
+    /**
+     * This method is an overloaded method for the digest generation for OMNode
+     *
+     * @param node
+     * @param digestAlgorithm
+     * @return Returns a byte array representing the calculated digest value
+     */
+    public byte[] getDigest(OMNode node, String digestAlgorithm) {
+        if (node.getType() == OMNode.ELEMENT_NODE) return getDigest((OMElement) node, digestAlgorithm); else if (
+                node.getType() == OMNode.TEXT_NODE)
+            return getDigest((OMText) node, digestAlgorithm); else if (node.getType() == OMNode.PI_NODE)
+            return getDigest((OMProcessingInstruction) node, digestAlgorithm); else return new byte[0];
+    }
+
+    /**
+     * This method is an overloaded method for the digest generation for OMElement
+     *
+     * @param element
+     * @param digestAlgorithm
+     * @return Returns a byte array representing the calculated digest value
+     */
+    public byte[] getDigest(OMElement element, String digestAlgorithm) throws OMException {
+        byte[] digest = new byte[0];
+        try {
+            MessageDigest md = MessageDigest.getInstance(digestAlgorithm);
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            DataOutputStream dos = new DataOutputStream(baos);
+            dos.writeInt(1);
+            dos.write(getExpandedName(element).getBytes("UnicodeBigUnmarked"));
+            dos.write((byte) 0);
+            dos.write((byte) 0);
+            Collection attrs = getAttributesWithoutNS(element);
+            dos.writeInt(attrs.size());
+            Iterator itr = attrs.iterator();
+            while(itr.hasNext())
+                dos.write(getDigest((OMAttribute) itr.next(), digestAlgorithm));
+            OMNode node = element.getFirstOMChild();
+            // adjoining Texts are merged,
+            // there is  no 0-length Text, and
+            // comment nodes are removed.
+            int length = 0;
+            itr = element.getChildElements();
+            while (itr.hasNext()) {
+                length++;
+                itr.next();
+            }
+            dos.writeInt(length);
+            while (node != null) {
+                dos.write(getDigest(node, digestAlgorithm));
+                node = node.getNextOMSibling();
+            }
+            dos.close();
+            md.update(baos.toByteArray());
+            digest = md.digest();
+        } catch (NoSuchAlgorithmException e) {
+            throw new OMException(e);
+        } catch (IOException e) {
+            throw new OMException(e);
+        }
+        return digest;
+    }
+
+    /**
+     * This method is an overloaded method for the digest generation for OMProcessingInstruction
+     *
+     * @param pi
+     * @param digestAlgorithm
+     * @return Returns a byte array representing the calculated digest value
+     */
+    public byte[] getDigest(OMProcessingInstruction pi, String digestAlgorithm) throws OMException {
+        byte[] digest = new byte[0];
+        try {
+            MessageDigest md = MessageDigest.getInstance(digestAlgorithm);
+            md.update((byte) 0);
+            md.update((byte) 0);
+            md.update((byte) 0);
+            md.update((byte) 7);
+            md.update(pi.getTarget().getBytes("UnicodeBigUnmarked"));
+            md.update((byte) 0);
+            md.update((byte) 0);
+            md.update(pi.getValue().getBytes("UnicodeBigUnmarked"));
+            digest = md.digest();
+        } catch (NoSuchAlgorithmException e) {
+            throw new OMException(e);
+        } catch (UnsupportedEncodingException e) {
+            throw new OMException(e);
+        }
+        return digest;
+    }
+
+    /**
+     * This method is an overloaded method for the digest generation for OMAttribute
+     *
+     * @param attribute
+     * @param digestAlgorithm
+     * @return Returns a byte array representing the calculated digest value
+     */
+    public byte[] getDigest(OMAttribute attribute, String digestAlgorithm) throws OMException {
+        byte[] digest = new byte[0];
+        if (!(attribute.getLocalName().equals("xmlns") || attribute.getLocalName().startsWith("xmlns:"))) try {
+            MessageDigest md = MessageDigest.getInstance(digestAlgorithm);
+            md.update((byte) 0);
+            md.update((byte) 0);
+            md.update((byte) 0);
+            md.update((byte) 2);
+            md.update(getExpandedName(attribute).getBytes("UnicodeBigUnmarked"));
+            md.update((byte) 0);
+            md.update((byte) 0);
+            md.update(attribute.getAttributeValue().getBytes("UnicodeBigUnmarked"));
+            digest = md.digest();
+        } catch (NoSuchAlgorithmException e) {
+            throw new OMException(e);
+        } catch (UnsupportedEncodingException e) {
+            throw new OMException(e);
+        }
+        return digest;
+    }
+
+    /**
+     * This method is an overloaded method for the digest generation for OMText
+     *
+     * @param text
+     * @param digestAlgorithm
+     * @return Returns a byte array representing the calculated digest value
+     */
+    public byte[] getDigest(OMText text, String digestAlgorithm)  throws OMException  {
+        byte[] digest = new byte[0];
+        try {
+            MessageDigest md = MessageDigest.getInstance(digestAlgorithm);
+            md.update((byte) 0);
+            md.update((byte) 0);
+            md.update((byte) 0);
+            md.update((byte) 3);
+            md.update(text.getText().getBytes("UnicodeBigUnmarked"));
+            digest = md.digest();
+        } catch (NoSuchAlgorithmException e) {
+            throw new OMException(e);
+        } catch (UnsupportedEncodingException e) {
+            throw new OMException(e);
+        }
+        return digest;
+    }
+
+    /**
+     * This method is an overloaded method for getting the expanded name namespaceURI followed by the local name
+     * for OMElement
+     *
+     * @param element
+     * @return Returns the expanded name of OMElement
+     */
+    public String getExpandedName(OMElement element) {
+        return element.getNamespace().getNamespaceURI() + ":" + element.getLocalName();
+    }
+
+    /**
+     * This method is an overloaded method for getting the expanded name namespaceURI followed by the local name
+     * for OMAttribute
+     *
+     * @param attribute
+     * @return Returns the expanded name of the OMAttribute
+     */
+    public String getExpandedName(OMAttribute attribute) {
+        return attribute.getNamespace().getNamespaceURI() + ":" + attribute.getLocalName();
+    }
+
+    /**
+     * Gets the collection of attributes which are none namespace declarations for an OMElement
+     *
+     * @param element
+     * @return Returns the collection of attributes which are none namespace declarations
+     */
+    public Collection getAttributesWithoutNS(OMElement element) {
+        SortedMap map = new TreeMap();
+        Iterator itr = element.getAllAttributes();
+        while (itr.hasNext()) {
+            OMAttribute attribute = (OMAttribute) itr.next();
+            if (!(attribute.getLocalName().equals("xmlns") || attribute.getLocalName().startsWith("xmlns:")))
+                map.put(getExpandedName(attribute), attribute);
+        }
+        return map.values();
+    }
+
+    /**
+     * Gets the valid element collection of an OMDocument.
+     * OMElement and OMProcessingInstruction only
+     *
+     * @param document
+     * @return Returns a collection of OMProcessingInstructions and OMElements
+     */
+    public Collection getValidElements(OMDocument document) {
+        ArrayList list = new ArrayList();
+        Iterator itr = document.getChildren();
+        while(itr.hasNext()) {
+            OMNode node = (OMNode)itr.next();
+            if(node.getType() == OMNode.ELEMENT_NODE || node.getType() == OMNode.PI_NODE) list.add(node);
+        }
+        return list;
+    }
+
+    /**
+     * Gets the String representation of the byte array
+     *
+     * @param array
+     * @return Returns the String of the byte
+     */
+    public String getStringRepresentation(byte[] array) {
+        String str = "";
+        for (int i = 0; i < array.length; i++) str += array[i];
+        return str;
+    }
+
+    /**
+     * Compares two OMNodes for the XML equality
+     *
+     * @param node
+     * @param comparingNode
+     * @param digestAlgorithm
+     * @return Returns true if the OMNode XML contents are equal
+     */
+    public boolean compareOMNode(OMNode node, OMNode comparingNode, String digestAlgorithm) {
+        return Arrays.equals(getDigest(node, digestAlgorithm), getDigest(comparingNode, digestAlgorithm));
+    }
+
+    /**
+     * Compares two OMDocuments for the XML equality
+     *
+     * @param document
+     * @param comparingDocument
+     * @param digestAlgorithm
+     * @return Returns true if the OMDocument XML content are equal
+     */
+    public boolean compareOMDocument(OMDocument document, OMDocument comparingDocument, String digestAlgorithm) {
+        return Arrays.equals(getDigest(document, digestAlgorithm), getDigest(comparingDocument,  digestAlgorithm));
+    }
+
+    /**
+     * Compares two OMAttributes for the XML equality
+     *
+     * @param attribute
+     * @param comparingAttribute
+     * @param digestAlgorithm
+     * @return Returns true if the OMDocument XML content are equal
+     */
+    public boolean compareOMAttribute(OMAttribute attribute, OMAttribute comparingAttribute, String digestAlgorithm) {
+        return Arrays.equals(getDigest(attribute, digestAlgorithm), getDigest(comparingAttribute, digestAlgorithm));
+    }
+
+    /**
+     * String representing the MD5 digest algorithm
+     */
+    public static final String md5DigestAlgorithm = "MD5";
+
+    /**
+     * String representing the SHA digest algorithm
+     */
+    public static final String shaDigestAlgorithm = "SHA";
+
+    /**
+     * String representing the SHA1 digest algorithm
+     */
+    public static final String sha1DigestAlgorithm = "SHA1";
+}
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/ElementHelper.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/ElementHelper.java
new file mode 100644
index 0000000..4e01ecb
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/ElementHelper.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.util;
+
+import org.apache.axiom.om.*;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Iterator;
+
+/**
+ * Helper class to provide extra utility stuff against elements.
+ * The code is designed to work with any element implementation.
+ */
+
+public class ElementHelper {
+
+    private OMElement element;
+
+    /**
+     * Constructs and binds to an element.
+     *
+     * @param element element to work with
+     */
+    public ElementHelper(OMElement element) {
+        this.element = element;
+    }
+
+    /**
+     * Turns a prefix:local qname string into a proper QName, evaluating it in the OMElement context.
+     *
+     * @param qname                    qname to resolve
+     * @param defaultToParentNameSpace flag that controls behaviour when there is no namespace.
+     * @return Returns null for any failure to extract a qname.
+     */
+    public QName resolveQName(String qname, boolean defaultToParentNameSpace) {
+        int colon = qname.indexOf(':');
+        if (colon < 0) {
+            if (defaultToParentNameSpace) {
+                //get the parent ns and use it for the child
+                OMNamespace namespace = element.getNamespace();
+                return new QName(namespace.getNamespaceURI(), qname, namespace.getPrefix());
+            } else {
+                //else things without no prefix are local.
+                return new QName(qname);
+            }
+        }
+        String prefix = qname.substring(0, colon);
+        String local = qname.substring(colon + 1);
+        if (local.length() == 0) {
+            //empy local, exit accordingly
+            return null;
+        }
+
+        OMNamespace namespace = element.findNamespaceURI(prefix);
+        if (namespace == null) {
+            return null;
+        }
+        return new QName(namespace.getNamespaceURI(), local, prefix);
+    }
+
+    /**
+     * Turns a prefix:local qname string into a proper QName, evaluating it in the OMElement context.
+     * Unprefixed qnames resolve to the local namespace.
+     *
+     * @param qname prefixed qname string to resolve
+     * @return Returns null for any failure to extract a qname.
+     */
+    public QName resolveQName(String qname) {
+        return resolveQName(qname, true);
+    }
+
+    public static void setNewElement(OMElement parent,
+                                     OMElement myElement,
+                                     OMElement newElement) {
+        if (myElement != null) {
+            myElement.discard();
+        }
+        parent.addChild(newElement);
+        myElement = newElement;
+    }
+
+    public static OMElement getChildWithName(OMElement parent,
+                                             String childName) {
+        Iterator childrenIter = parent.getChildren();
+        while (childrenIter.hasNext()) {
+            OMNode node = (OMNode) childrenIter.next();
+            if (node.getType() == OMNode.ELEMENT_NODE &&
+                    childName.equals(((OMElement) node).getLocalName())) {
+                return (OMElement) node;
+            }
+        }
+        return null;
+    }
+
+    public static String getContentID(XMLStreamReader parser, String charsetEncoding) {
+        String contentID;
+        String contentIDName;
+        if (parser.getAttributeCount() > 0) {
+            contentID = parser.getAttributeValue(0);
+            contentID = contentID.trim();
+            contentIDName = parser.getAttributeLocalName(0);
+            if (contentIDName.equalsIgnoreCase("href")
+                    & contentID.substring(0, 3).equalsIgnoreCase("cid")) {
+                contentID = contentID.substring(4);
+                String charEnc = charsetEncoding == null || "".equals(charsetEncoding) ? "UTF-8" : charsetEncoding;
+                try {
+                    contentID = URLDecoder.decode(contentID, charEnc);
+                } catch (UnsupportedEncodingException e) {
+                    throw new OMException("Unsupported Character Encoding Found", e);
+                }
+            } else if (!(contentIDName.equalsIgnoreCase("href")
+                    & (!contentID.equals("")))) {
+                throw new OMException(
+                        "contentID not Found in XOP:Include element");
+            }
+        } else {
+            throw new OMException(
+                    "Href attribute not found in XOP:Include element");
+        }
+        return contentID;
+    }
+
+    /**
+     * Some times two OMElements needs to be added to the same object tree. But in Axiom, a single tree should always
+     * contain object created from the same type of factory (eg: LinkedListImplFactory, DOMFactory, etc.,). If one OMElement
+     * is created from a different factory than that of the factory which was used to create the object in the existing
+     * tree, we need to convert the new OMElement to match to the factory of existing object tree.
+     * This method will convert omElement to the given omFactory.
+     *
+     */
+    public static OMElement importOMElement(OMElement omElement, OMFactory omFactory) {
+        // first check whether the given OMElement has the same omFactory
+        if (omElement.getOMFactory().getClass().isInstance(omFactory)) {
+            return omElement;
+        }else {
+            OMElement documentElement = new StAXOMBuilder(omFactory, omElement.getXMLStreamReader()).getDocumentElement();
+            documentElement.build();
+            return documentElement;
+        }
+
+    }
+
+}
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/StAXUtils.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/StAXUtils.java
new file mode 100644
index 0000000..3288176
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/StAXUtils.java
@@ -0,0 +1,137 @@
+package org.apache.axiom.om.util;

+

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLOutputFactory;

+import javax.xml.stream.XMLStreamException;

+import javax.xml.stream.XMLStreamReader;

+import javax.xml.stream.XMLStreamWriter;

+import java.io.InputStream;

+import java.io.OutputStream;

+import java.io.Reader;

+import java.io.Writer;

+import java.util.Stack;

+

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+

+public class StAXUtils {

+

+	private static Log log = LogFactory.getLog(StAXUtils.class);

+	   

+    /**

+     * Pool of XMLOutputFactory instances

+     */

+    private static Stack xmlOutputFactoryPool = new Stack();

+

+    /**

+     * Pool of XMLInputFactory instances

+     */

+    private static Stack xmlInputFactoryPool = new Stack();

+

+    /**

+     * Gets an XMLInputFactory instance from pool.

+     *

+     * @return an XMLInputFactory instance.

+     */

+    synchronized public static XMLInputFactory getXMLInputFactory() {

+        if (!xmlInputFactoryPool.empty()) {

+            return (XMLInputFactory) xmlInputFactoryPool.pop();

+        }

+        return XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", StAXUtils.class.getClassLoader());

+    }

+

+    /**

+     * Returns an XMLInputFactory instance for reuse.

+     *

+     * @param factory An XMLInputFactory instance that is available for reuse

+     */

+    synchronized public static void releaseXMLInputFactory(XMLInputFactory factory) {

+        xmlInputFactoryPool.push(factory);

+    }

+

+    public static XMLStreamReader createXMLStreamReader(InputStream in, String encoding)

+            throws XMLStreamException {

+        XMLInputFactory inputFactory = getXMLInputFactory();

+        try {

+        	XMLStreamReader reader = inputFactory.createXMLStreamReader(in, encoding);

+        	log.debug("XMLStreamReader is " + reader.getClass().getName());

+            return reader;

+        } finally {

+            releaseXMLInputFactory(inputFactory);

+        }

+    }

+

+    public static XMLStreamReader createXMLStreamReader(InputStream in)

+            throws XMLStreamException {

+        XMLInputFactory inputFactory = getXMLInputFactory();

+        try {

+            XMLStreamReader reader = inputFactory.createXMLStreamReader(in);

+            log.debug("XMLStreamReader is " + reader.getClass().getName());

+            return reader;

+        } finally {

+            releaseXMLInputFactory(inputFactory);

+        }

+    }

+

+    public static XMLStreamReader createXMLStreamReader(Reader in)

+            throws XMLStreamException {

+        XMLInputFactory inputFactory = getXMLInputFactory();

+        try {

+            XMLStreamReader reader = inputFactory.createXMLStreamReader(in);

+            log.debug("XMLStreamReader is " + reader.getClass().getName());

+            return reader;

+        } finally {

+            releaseXMLInputFactory(inputFactory);

+        }

+    }

+

+    /**

+     * Gets an XMLOutputFactory instance from pool.

+     *

+     * @return an XMLOutputFactory instance.

+     */

+    synchronized public static XMLOutputFactory getXMLOutputFactory() {

+        if (!xmlOutputFactoryPool.empty()) {

+            return (XMLOutputFactory) xmlOutputFactoryPool.pop();

+        }

+        return XMLOutputFactory.newInstance("javax.xml.stream.XMLOutputFactory", StAXUtils.class.getClassLoader());

+    }

+

+    /**

+     * Returns an XMLOutputFactory instance for reuse.

+     *

+     * @param factory An XMLOutputFactory instance that is available for reuse.

+     */

+    synchronized public static void releaseXMLOutputFactory(XMLOutputFactory factory) {

+        xmlOutputFactoryPool.push(factory);

+    }

+

+    public static XMLStreamWriter createXMLStreamWriter(OutputStream out)

+            throws XMLStreamException {

+        XMLOutputFactory outputFactory = getXMLOutputFactory();

+        try {

+            XMLStreamWriter writer = outputFactory.createXMLStreamWriter(out);

+            log.debug("XMLStreamWriter is " + writer.getClass().getName());

+            return writer;

+        } finally {

+            releaseXMLOutputFactory(outputFactory);

+        }

+    }

+

+    public static XMLStreamWriter createXMLStreamWriter(Writer out)

+            throws XMLStreamException {

+        XMLOutputFactory outputFactory = getXMLOutputFactory();

+        try {

+            XMLStreamWriter writer = outputFactory.createXMLStreamWriter(out);

+            log.debug("XMLStreamWriter is " + writer.getClass().getName());

+            return writer;

+        } finally {

+            releaseXMLOutputFactory(outputFactory);

+        }

+    }

+

+    public static void reset() {

+        xmlOutputFactoryPool.removeAllElements();

+        xmlInputFactoryPool.removeAllElements();

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/UUIDGenerator.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/UUIDGenerator.java
new file mode 100644
index 0000000..f242d79
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/UUIDGenerator.java
@@ -0,0 +1,98 @@
+package org.apache.axiom.om.util;

+

+/*

+ * Copyright 2001-2004 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ *

+ */

+

+import java.net.InetAddress;

+import java.net.UnknownHostException;

+import java.security.MessageDigest;

+import java.security.NoSuchAlgorithmException;

+import java.util.Date;

+import java.util.Random;

+

+public class UUIDGenerator {

+    /**

+     * This class will give UUIDs for axis2.

+     */

+

+    private static String baseUUID = null;

+    private static long incrementingValue = 0;

+

+

+    private static Random myRand = null;

+

+    /**

+     * MD5 a random string with localhost/date etc will return 128 bits

+     * construct a string of 18 characters from those bits.

+     *

+     * @return string

+     */

+    public static String getUUID() {

+        if (baseUUID == null) {

+            baseUUID = getInitialUUID();

+        }

+        if (++incrementingValue >= Long.MAX_VALUE) {

+            incrementingValue = 0;

+        }

+        return "urn:uuid:" + baseUUID + new Date().getTime() + incrementingValue;

+    }

+

+    protected static String getInitialUUID() {

+        if (myRand == null) {

+            myRand = new Random();

+        }

+        long rand = myRand.nextLong();

+        String sid;

+        try {

+            sid = InetAddress.getLocalHost().toString();

+        } catch (UnknownHostException e) {

+            sid = Thread.currentThread().getName();

+        }

+        StringBuffer sb = new StringBuffer();

+        sb.append(sid);

+        sb.append(":");

+        sb.append(Long.toString(rand));

+        MessageDigest md5 = null;

+        try {

+            md5 = MessageDigest.getInstance("MD5");

+        } catch (NoSuchAlgorithmException e) {

+            //System.out.println("Error: " + e);

+            //todo heve to be properly handle

+        }

+        md5.update(sb.toString().getBytes());

+        byte[] array = md5.digest();

+        StringBuffer sb2 = new StringBuffer();

+        for (int j = 0; j < array.length; ++j) {

+            int b = array[j] & 0xFF;

+            sb2.append(Integer.toHexString(b));

+        }

+        int begin = myRand.nextInt();

+        if (begin < 0) begin = begin * -1;

+        begin = begin % 8;

+        return sb2.toString().substring(begin, begin + 18).toUpperCase();

+    }

+

+    public static void main(String[] args) {

+        for (int i = 0; i < 100000; i++) {

+            UUIDGenerator.getInitialUUID();

+        }

+

+        for (int i = 0; i < 100000; i++) {

+            UUIDGenerator.getUUID();

+        }

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/XPathEvaluator.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/XPathEvaluator.java
new file mode 100644
index 0000000..808d78d
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/util/XPathEvaluator.java
@@ -0,0 +1,21 @@
+package org.apache.axiom.om.util;

+

+import org.apache.axiom.om.xpath.AXIOMXPath;

+import org.jaxen.SimpleNamespaceContext;

+

+import java.util.List;

+

+public class XPathEvaluator {

+

+    public List evaluateXpath(String xpathExpression, Object element, String nsURI) throws Exception{

+        AXIOMXPath xpath = new AXIOMXPath(xpathExpression);

+        if (nsURI!=null){

+            SimpleNamespaceContext nsContext = new SimpleNamespaceContext();

+            nsContext.addNamespace(null,nsURI);

+            xpath.setNamespaceContext(nsContext);

+        }

+        return xpath.selectNodes(element);

+    }

+

+

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/xpath/AXIOMXPath.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/xpath/AXIOMXPath.java
new file mode 100644
index 0000000..178c6e9
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/xpath/AXIOMXPath.java
@@ -0,0 +1,54 @@
+package org.apache.axiom.om.xpath;

+

+import org.jaxen.BaseXPath;

+import org.jaxen.JaxenException;

+import org.jaxen.SimpleNamespaceContext;

+

+import java.util.HashMap;

+import java.util.Map;

+

+public class AXIOMXPath extends BaseXPath {

+

+    private static final long serialVersionUID = -5839161412925154639L;

+

+    private Map namespaces = new HashMap();

+

+    /**

+     * Construct given an XPath expression string.

+     *

+     * @param xpathExpr the XPath expression.

+     * @throws org.jaxen.JaxenException if there is a syntax error while

+     *                                  parsing the expression

+     */

+    public AXIOMXPath(String xpathExpr) throws JaxenException {

+        super(xpathExpr, new DocumentNavigator());

+    }

+

+    /**

+     * This override captures any added namespaces, as the Jaxen BaseXPath class nor

+     * NamespaceContext (or SimpleNamespaceContext) exposes thier internal map of the

+     * prefixes to the namespaces. This method - although is not the ideal solution to

+     * the issue, attempts to provide an override to changing the Jaxen code.

+     * @param prefix a namespace prefix

+     * @param uri the URI to which the prefix matches

+     * @throws JaxenException if the underlying implementation throws an exception

+     */

+    public void addNamespace(String prefix, String uri) throws JaxenException {

+        try {

+            super.addNamespace(prefix, uri);

+        } catch (JaxenException e) {

+            // the intention here is to prevent us caching a namespace, if the

+            // underlying implementation does not accept it

+            throw e;

+        }

+        namespaces.put(prefix, uri);

+    }

+

+    /**

+     * Expose the prefix to namespace mapping for this expression

+     * @return a Map of namespace prefixes to the URIs

+     */

+    public Map getNamespaces() {

+        return namespaces;

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/xpath/DocumentNavigator.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/xpath/DocumentNavigator.java
new file mode 100644
index 0000000..966bc4b
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/xpath/DocumentNavigator.java
@@ -0,0 +1,754 @@
+package org.apache.axiom.om.xpath;

+

+import org.apache.axiom.om.*;

+import org.apache.axiom.om.impl.OMNamespaceImpl;

+import org.apache.axiom.om.impl.builder.StAXOMBuilder;

+import org.apache.axiom.om.util.StAXUtils;

+import org.jaxen.*;

+import org.jaxen.saxpath.SAXPathException;

+import org.jaxen.util.SingleObjectIterator;

+

+import javax.xml.namespace.QName;

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLStreamReader;

+import java.io.FileInputStream;

+import java.net.URL;

+import java.util.ArrayList;

+import java.util.HashSet;

+import java.util.Iterator;

+import java.util.List;

+

+public class DocumentNavigator extends DefaultNavigator {

+

+    private static final long serialVersionUID = 7325116153349780805L;

+

+    /**

+     * Returns a parsed form of the given xpath string, which will be suitable

+     * for queries on documents that use the same navigator as this one.

+     *

+     * @param xpath the XPath expression

+     * @return Returns a new XPath expression object.

+     * @throws SAXPathException if the string is not a syntactically

+     *                          correct XPath expression

+     * @see XPath

+     */

+    public XPath parseXPath(String xpath) throws SAXPathException {

+        return new BaseXPath(xpath, this);

+    }

+

+    /**

+     * Retrieves the namespace URI of the given element node.

+     *

+     * @param object the context element node

+     * @return Returns the namespace URI of the element node.

+     */

+    public String getElementNamespaceUri(Object object) {

+        OMElement attr = (OMElement) object;

+        return attr.getQName().getNamespaceURI();

+    }

+

+    /**

+     * Retrieves the name of the given element node.

+     *

+     * @param object the context element node

+     * @return Returns the name of the element node.

+     */

+    public String getElementName(Object object) {

+        OMElement attr = (OMElement) object;

+        return attr.getQName().getLocalPart();

+    }

+

+    /**

+     * Retrieves the QName of the given element node.

+     *

+     * @param object the context element node

+     * @return Returns the QName of the element node.

+     */

+    public String getElementQName(Object object) {

+        OMElement attr = (OMElement) object;

+        String prefix = null;

+        if (attr.getNamespace() != null) {

+            prefix = attr.getNamespace().getPrefix();

+        }

+        if (prefix == null || "".equals(prefix)) {

+            return attr.getQName().getLocalPart();

+        }

+        return prefix + ":" + attr.getNamespace().getNamespaceURI();

+    }

+

+    /**

+     * Retrieves the namespace URI of the given attribute node.

+     *

+     * @param object the context attribute node

+     * @return Returns the namespace URI of the attribute node.

+     */

+    public String getAttributeNamespaceUri(Object object) {

+        OMAttribute attr = (OMAttribute) object;

+        return attr.getQName().getNamespaceURI();

+    }

+

+    /**

+     * Retrieves the name of the given attribute node.

+     *

+     * @param object the context attribute node

+     * @return Returns the name of the attribute node.

+     */

+    public String getAttributeName(Object object) {

+        OMAttribute attr = (OMAttribute) object;

+        return attr.getQName().getLocalPart();

+    }

+

+    /**

+     * Retrieves the QName of the given attribute node.

+     *

+     * @param object the context attribute node

+     * @return Returns the qualified name of the attribute node.

+     */

+    public String getAttributeQName(Object object) {

+        OMAttribute attr = (OMAttribute) object;

+        String prefix = attr.getNamespace().getPrefix();

+        if (prefix == null || "".equals(prefix)) {

+            return attr.getQName().getLocalPart();

+        }

+        return prefix + ":" + attr.getNamespace().getNamespaceURI();

+    }

+

+    /**

+     * Returns whether the given object is a document node. A document node

+     * is the node that is selected by the xpath expression <code>/</code>.

+     *

+     * @param object the object to test

+     * @return Returns <code>true</code> if the object is a document node,

+     *         else <code>false</code> .

+     */

+    public boolean isDocument(Object object) {

+        return object instanceof OMDocument;

+    }

+

+    /**

+     * Returns whether the given object is an element node.

+     *

+     * @param object the object to test

+     * @return Returns <code>true</code> if the object is an element node,

+     *         else <code>false</code> .

+     */

+    public boolean isElement(Object object) {

+        return object instanceof OMElement;

+    }

+

+    /**

+     * Returns whether the given object is an attribute node.

+     *

+     * @param object the object to test

+     * @return Returns <code>true</code> if the object is an attribute node,

+     *         else <code>false</code> .

+     */

+    public boolean isAttribute(Object object) {

+        return object instanceof OMAttribute;

+    }

+

+    /**

+     * Returns whether the given object is a namespace node.

+     *

+     * @param object the object to test

+     * @return Returns <code>true</code> if the object is a namespace node,

+     *         else <code>false</code> .

+     */

+    public boolean isNamespace(Object object) {

+        return object instanceof OMNamespace;

+    }

+

+    /**

+     * Returns whether the given object is a comment node.

+     *

+     * @param object the object to test

+     * @return Returns <code>true</code> if the object is a comment node,

+     *         else <code>false</code> .

+     */

+    public boolean isComment(Object object) {

+        return (object instanceof OMComment);

+    }

+

+    /**

+     * Returns whether the given object is a text node.

+     *

+     * @param object the object to test

+     * @return Returns <code>true</code> if the object is a text node,

+     *         else <code>false</code> .

+     */

+    public boolean isText(Object object) {

+        return (object instanceof OMText);

+    }

+

+    /**

+     * Returns whether the given object is a processing-instruction node.

+     *

+     * @param object the object to test

+     * @return Returns <code>true</code> if the object is a processing-instruction node,

+     *         else <code>false</code> .

+     */

+    public boolean isProcessingInstruction(Object object) {

+        return (object instanceof OMProcessingInstruction);

+    }

+

+    /**

+     * Retrieves the string-value of a comment node.

+     * This may be the empty string if the comment is empty,

+     * but must not be null.

+     *

+     * @param object the comment node

+     * @return Returns the string-value of the node.

+     */

+    public String getCommentStringValue(Object object) {

+        return ((OMComment) object).getValue();

+    }

+

+    /**

+     * Retrieves the string-value of an element node.

+     * This may be the empty string if the element is empty,

+     * but must not be null.

+     *

+     * @param object the comment node.

+     * @return Returns the string-value of the node.

+     */

+    public String getElementStringValue(Object object) {

+        if (isElement(object)) {

+            return getStringValue((OMElement) object, new StringBuffer())

+                    .toString();

+        }

+        return null;

+    }

+

+    private StringBuffer getStringValue(OMNode node, StringBuffer buffer) {

+        if (isText(node)) {

+            buffer.append(((OMText) node).getText());

+        } else if (node instanceof OMElement) {

+            Iterator children = ((OMElement) node).getChildren();

+            while (children.hasNext()) {

+                getStringValue((OMNode) children.next(), buffer);

+            }

+        }

+        return buffer;

+    }

+

+    /**

+     * Retrieves the string-value of an attribute node.

+     * This should be the XML 1.0 normalized attribute value.

+     * This may be the empty string but must not be null.

+     *

+     * @param object the attribute node

+     * @return Returns the string-value of the node.

+     */

+    public String getAttributeStringValue(Object object) {

+        return ((OMAttribute) object).getAttributeValue();

+    }

+

+    /**

+     * Retrieves the string-value of a namespace node.

+     * This is generally the namespace URI.

+     * This may be the empty string but must not be null.

+     *

+     * @param object the namespace node

+     * @return Returns the string-value of the node.

+     */

+    public String getNamespaceStringValue(Object object) {

+        return ((OMNamespace) object).getNamespaceURI();

+    }

+

+    /**

+     * Retrieve the string-value of a text node.

+     * This must not be null and should not be the empty string.

+     * The XPath data model does not allow empty text nodes.

+     *

+     * @param object the text node

+     * @return Returns the string-value of the node.

+     */

+    public String getTextStringValue(Object object) {

+        return ((OMText) object).getText();

+    }

+

+    /**

+     * Retrieves the namespace prefix of a namespace node.

+     *

+     * @param object the namespace node

+     * @return Returns the prefix associated with the node.

+     */

+    public String getNamespacePrefix(Object object) {

+        return ((OMNamespace) object).getPrefix();

+    }

+

+    /**

+     * Retrieves an <code>Iterator</code> matching the <code>child</code>

+     * XPath axis.

+     *

+     * @param contextNode the original context node

+     * @return Returns an Iterator capable of traversing the axis, not null.

+     * @throws UnsupportedAxisException if the semantics of the child axis are

+     *                                  not supported by this object model

+     */

+    public Iterator getChildAxisIterator(Object contextNode) throws UnsupportedAxisException {

+        if (contextNode instanceof OMContainer) {

+            return ((OMContainer) contextNode).getChildren();

+        }

+        return JaxenConstants.EMPTY_ITERATOR;

+    }

+

+    public Iterator getDescendantAxisIterator(Object object) throws UnsupportedAxisException {

+        //TODO: Fix this better?

+        return super.getDescendantAxisIterator(object);

+    }

+

+    /**

+     * Retrieves an <code>Iterator</code> matching the <code>attribute</code>

+     * XPath axis.

+     *

+     * @param contextNode the original context node

+     * @return Returns an Iterator capable of traversing the axis, not null.

+     * @throws UnsupportedAxisException if the semantics of the attribute axis are

+     *                                  not supported by this object model

+     */

+    public Iterator getAttributeAxisIterator(Object contextNode) throws UnsupportedAxisException {

+        if (isElement(contextNode)) {

+            ArrayList attributes = new ArrayList();

+            Iterator i = ((OMElement) contextNode).getAllAttributes();

+            while (i != null && i.hasNext()) {

+                attributes.add(new OMAttributeEx((OMAttribute) i.next(),

+                        (OMContainer) contextNode, ((OMElement) contextNode)

+                        .getOMFactory()));

+            }

+            return attributes.iterator();

+        }

+        return JaxenConstants.EMPTY_ITERATOR;

+    }

+

+    /**

+     * Retrieves an <code>Iterator</code> matching the <code>namespace</code>

+     * XPath axis.

+     *

+     * @param contextNode the original context node

+     * @return Returns an Iterator capable of traversing the axis, not null.

+     * @throws UnsupportedAxisException if the semantics of the namespace axis are

+     *                                  not supported by this object model

+     */

+    public Iterator getNamespaceAxisIterator(Object contextNode) throws UnsupportedAxisException {

+        if (!(contextNode instanceof OMContainer &&

+                contextNode instanceof OMElement)) {

+            return JaxenConstants.EMPTY_ITERATOR;

+        }

+        List nsList = new ArrayList();

+        HashSet prefixes = new HashSet();

+        for (OMContainer context = (OMContainer) contextNode;

+             context != null && !(context instanceof OMDocument);

+             context = ((OMElement) context).getParent()) {

+            OMElement element = (OMElement) context;

+            ArrayList declaredNS = new ArrayList();

+            Iterator i = element.getAllDeclaredNamespaces();

+            while (i != null && i.hasNext()) {

+                declaredNS.add(i.next());

+            }

+            declaredNS.add(element.getNamespace());

+            for (Iterator iter = element.getAllAttributes();

+                 iter != null && iter.hasNext();) {

+                OMAttribute attr = (OMAttribute) iter.next();

+                OMNamespace namespace = attr.getNamespace();

+                if (namespace != null) {

+                    declaredNS.add(namespace);

+                }

+            }

+            for (Iterator iter = declaredNS.iterator();

+                 iter != null && iter.hasNext();) {

+                OMNamespace namespace = (OMNamespace) iter.next();

+                if (namespace != null) {

+                    String prefix = namespace.getPrefix();

+                    if (prefix != null && !prefixes.contains(prefix)) {

+                        prefixes.add(prefix);

+                        nsList.add(new OMNamespaceEx(namespace, context));

+                    }

+                }

+            }

+        }

+        nsList.add(

+                new OMNamespaceEx(

+                        new OMNamespaceImpl(

+                                "http://www.w3.org/XML/1998/namespace",

+                                "xml"),

+                        (OMContainer) contextNode));

+        return nsList.iterator();

+    }

+

+    /**

+     * Retrieves an <code>Iterator</code> matching the <code>self</code> xpath

+     * axis.

+     *

+     * @param contextNode the original context node

+     * @return Returns an Iterator capable of traversing the axis, not null.

+     * @throws UnsupportedAxisException if the semantics of the self axis are

+     *                                  not supported by this object model

+     */

+    public Iterator getSelfAxisIterator(Object contextNode) throws UnsupportedAxisException {

+        //TODO: Fix this better?

+        return super.getSelfAxisIterator(contextNode);

+    }

+

+    /**

+     * Retrieves an <code>Iterator</code> matching the

+     * <code>descendant-or-self</code> XPath axis.

+     *

+     * @param contextNode the original context node

+     * @return Returns an Iterator capable of traversing the axis, not null.

+     * @throws UnsupportedAxisException if the semantics of the descendant-or-self axis are

+     *                                  not supported by this object model

+     */

+    public Iterator getDescendantOrSelfAxisIterator(Object contextNode) throws UnsupportedAxisException {

+        //TODO: Fix this better?

+        return super.getDescendantOrSelfAxisIterator(contextNode);

+    }

+

+    /**

+     * Retrieves an <code>Iterator</code> matching the

+     * <code>ancestor-or-self</code> XPath axis.

+     *

+     * @param contextNode the original context node

+     * @return Returns an Iterator capable of traversing the axis, not null.

+     * @throws UnsupportedAxisException if the semantics of the ancestor-or-self axis are

+     *                                  not supported by this object model

+     */

+    public Iterator getAncestorOrSelfAxisIterator(Object contextNode) throws UnsupportedAxisException {

+        //TODO: Fix this better?

+        return super.getAncestorOrSelfAxisIterator(contextNode);

+    }

+

+    /**

+     * Retrieves an <code>Iterator</code> matching the <code>parent</code> XPath axis.

+     *

+     * @param contextNode the original context node

+     * @return Returns an Iterator capable of traversing the axis, not null.

+     * @throws UnsupportedAxisException if the semantics of the parent axis are

+     *                                  not supported by this object model

+     */

+    public Iterator getParentAxisIterator(Object contextNode) throws UnsupportedAxisException {

+        if (contextNode instanceof OMNode) {

+            return new SingleObjectIterator(((OMNode) contextNode).getParent());

+        } else if (contextNode instanceof OMNamespaceEx) {

+            return new SingleObjectIterator(

+                    ((OMNamespaceEx) contextNode).getParent());

+        } else if (contextNode instanceof OMAttributeEx) {

+            return new SingleObjectIterator(

+                    ((OMAttributeEx) contextNode).getParent());

+        }

+        return JaxenConstants.EMPTY_ITERATOR;

+    }

+

+    /**

+     * Retrieves an <code>Iterator</code> matching the <code>ancestor</code>

+     * XPath axis.

+     *

+     * @param contextNode the original context node

+     * @return Returns an Iterator capable of traversing the axis, not null.

+     * @throws UnsupportedAxisException if the semantics of the ancestor axis are

+     *                                  not supported by this object model

+     */

+    public Iterator getAncestorAxisIterator(Object contextNode) throws UnsupportedAxisException {

+        //TODO: Fix this better?

+        return super.getAncestorAxisIterator(contextNode);

+    }

+

+    /**

+     * Retrieves an <code>Iterator</code> matching the

+     * <code>following-sibling</code> XPath axis.

+     *

+     * @param contextNode the original context node

+     * @return Returns an Iterator capable of traversing the axis, not null.

+     * @throws UnsupportedAxisException if the semantics of the following-sibling axis are

+     *                                  not supported by this object model

+     */

+    public Iterator getFollowingSiblingAxisIterator(Object contextNode) throws UnsupportedAxisException {

+        ArrayList list = new ArrayList();

+        if (contextNode != null && contextNode instanceof OMNode) {

+            while (contextNode != null && contextNode instanceof OMNode) {

+                contextNode = ((OMNode) contextNode).getNextOMSibling();

+                if (contextNode != null)

+                    list.add(contextNode);

+            }

+        }

+        return list.iterator();

+    }

+

+    /**

+     * Retrieves an <code>Iterator</code> matching the

+     * <code>preceding-sibling</code> XPath axis.

+     *

+     * @param contextNode the original context node

+     * @return Returns an Iterator capable of traversing the axis, not null.

+     * @throws UnsupportedAxisException if the semantics of the preceding-sibling axis are

+     *                                  not supported by this object model

+     */

+    public Iterator getPrecedingSiblingAxisIterator(Object contextNode) throws UnsupportedAxisException {

+        ArrayList list = new ArrayList();

+        if (contextNode != null && contextNode instanceof OMNode) {

+            while (contextNode != null && contextNode instanceof OMNode) {

+                contextNode = ((OMNode) contextNode).getPreviousOMSibling();

+                if (contextNode != null)

+                    list.add(contextNode);

+            }

+        }

+        return list.iterator();

+    }

+

+    /**

+     * Retrieves an <code>Iterator</code> matching the <code>following</code>

+     * XPath axis.

+     *

+     * @param contextNode the original context node

+     * @return Returns an Iterator capable of traversing the axis, not null.

+     * @throws UnsupportedAxisException if the semantics of the following axis are

+     *                                  not supported by this object model

+     */

+    public Iterator getFollowingAxisIterator(Object contextNode) throws UnsupportedAxisException {

+        //TODO: Fix this better?

+        return super.getFollowingAxisIterator(contextNode);

+    }

+

+    /**

+     * Retrieves an <code>Iterator</code> matching the <code>preceding</code> XPath axis.

+     *

+     * @param contextNode the original context node

+     * @return Returns an Iterator capable of traversing the axis, not null.

+     * @throws UnsupportedAxisException if the semantics of the preceding axis are

+     *                                  not supported by this object model

+     */

+    public Iterator getPrecedingAxisIterator(Object contextNode) throws UnsupportedAxisException {

+        //TODO: Fix this better?

+        return super.getPrecedingAxisIterator(contextNode);

+    }

+

+    /**

+     * Loads a document from the given URI.

+     *

+     * @param uri the URI of the document to load

+     * @return Returns the document.

+     * @throws FunctionCallException if the document could not be loaded

+     */

+    public Object getDocument(String uri)

+            throws FunctionCallException {

+        try {

+            XMLStreamReader parser;

+            XMLInputFactory xmlInputFactory = StAXUtils.getXMLInputFactory();

+            Boolean oldValue = (Boolean) xmlInputFactory.getProperty(XMLInputFactory.IS_COALESCING);

+            try {

+                xmlInputFactory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);

+                if (uri.indexOf(':') == -1) {

+                    parser = xmlInputFactory.createXMLStreamReader(

+                            new FileInputStream(uri));

+                } else {

+                    URL url = new URL(uri);

+                    parser = xmlInputFactory.createXMLStreamReader(

+                            url.openStream());

+                }

+            } finally {

+                if (oldValue != null) {

+                    xmlInputFactory.setProperty(XMLInputFactory.IS_COALESCING, oldValue);

+                }

+                StAXUtils.releaseXMLInputFactory(xmlInputFactory);

+            }

+            StAXOMBuilder builder =

+                    new StAXOMBuilder(parser);

+            return builder.getDocumentElement().getParent();

+        } catch (Exception e) {

+            throw new FunctionCallException(e);

+        }

+    }

+

+    /**

+     * Returns the element whose ID is given by elementId.

+     * If no such element exists, returns null.

+     * Attributes with the name "ID" are not of type ID unless so defined.

+     * Implementations that do not know whether attributes are of type ID or

+     * not are expected to return null.

+     *

+     * @param contextNode a node from the document in which to look for the

+     *                    id

+     * @param elementId   id to look for

+     * @return Returns element whose ID is given by elementId, or null if no such

+     *         element exists in the document or if the implementation

+     *         does not know about attribute types.

+     */

+    public Object getElementById(Object contextNode, String elementId) {

+        //TODO: Fix this better?

+        return super.getElementById(contextNode, elementId);

+    }

+

+    /**

+     * Returns the document node that contains the given context node.

+     *

+     * @param contextNode the context node

+     * @return Returns the document of the context node.

+     * @see #isDocument(Object)

+     */

+    public Object getDocumentNode(Object contextNode) {

+        if (contextNode instanceof OMDocument) {

+            return contextNode;

+        }

+        OMContainer parent = ((OMNode) contextNode).getParent();

+        if (parent == null) {

+            // this node doesn't have a parent Document. So return the document element itself

+            return contextNode;

+        } else {

+            return getDocumentNode(parent);

+        }

+    }

+

+    /**

+     * Translates a namespace prefix to a namespace URI, <b>possibly</b>

+     * considering a particular element node.

+     * <p/>

+     * Strictly speaking, prefix-to-URI translation should occur

+     * irrespective of any element in the document.  This method

+     * is provided to allow a non-conforming ease-of-use enhancement.

+     * </p>

+     *

+     * @param prefix  the prefix to translate

+     * @param element the element to consider during translation

+     * @return Returns the namespace URI associated with the prefix.

+     */

+    public String translateNamespacePrefixToUri(String prefix, Object element) {

+        //TODO: Fix this better?

+        return super.translateNamespacePrefixToUri(prefix, element);

+    }

+

+    /**

+     * Retrieves the target of a processing-instruction.

+     *

+     * @param object the context processing-instruction node

+     * @return Returns the target of the processing-instruction node.

+     */

+    public String getProcessingInstructionTarget(Object object) {

+        return ((OMProcessingInstruction) object).getTarget();

+    }

+

+    /**

+     * Retrieves the data of a processing-instruction.

+     *

+     * @param object the context processing-instruction node

+     * @return Returns the data of the processing-instruction node.

+     */

+    public String getProcessingInstructionData(Object object) {

+        return ((OMProcessingInstruction) object).getValue();

+    }

+

+    /**

+     * Returns a number that identifies the type of node that the given

+     * object represents in this navigator. See org.jaxen.pattern.Pattern

+     *

+     * @param node ????

+     * @return Returns short.

+     */

+    public short getNodeType(Object node) {

+        //TODO: Fix this better?

+        return super.getNodeType(node);

+    }

+

+    /**

+     * Returns the parent of the given context node.

+     * <p/>

+     * The parent of any node must either be a document

+     * node or an element node.

+     *

+     * @param contextNode the context node

+     * @return Returns the parent of the context node, or null if this is a document node.

+     * @throws UnsupportedAxisException if the parent axis is not

+     *                                  supported by the model

+     * @see #isDocument

+     * @see #isElement

+     */

+    public Object getParentNode(Object contextNode) throws UnsupportedAxisException {

+        if (contextNode == null ||

+                contextNode instanceof OMDocument) {

+            return null;

+        } else if (contextNode instanceof OMAttributeEx) {

+            return ((OMAttributeEx) contextNode).getParent();

+        } else if (contextNode instanceof OMNamespaceEx) {

+            return ((OMNamespaceEx) contextNode).getParent();

+        }

+        return ((OMNode) contextNode).getParent();

+    }

+

+    class OMNamespaceEx implements OMNamespace {

+        OMNamespace originalNsp = null;

+        OMContainer parent = null;

+

+        OMNamespaceEx(OMNamespace nsp, OMContainer parent) {

+            originalNsp = nsp;

+            this.parent = parent;

+        }

+

+        public boolean equals(String uri, String prefix) {

+            return originalNsp.equals(uri, prefix);

+        }

+

+        public String getPrefix() {

+            return originalNsp.getPrefix();

+        }

+

+        public String getName() {

+            return originalNsp.getNamespaceURI();

+        }

+

+        public String getNamespaceURI() {

+            return originalNsp.getNamespaceURI();

+        }

+

+        public OMContainer getParent() {

+            return parent;

+        }

+    }

+

+    class OMAttributeEx implements OMAttribute {

+        OMAttribute attribute = null;

+        OMContainer parent = null;

+        OMFactory factory;

+

+        OMAttributeEx(OMAttribute attribute, OMContainer parent,

+                      OMFactory factory) {

+            this.attribute = attribute;

+            this.parent = parent;

+        }

+

+        public String getLocalName() {

+            return attribute.getLocalName();

+        }

+

+        public void setLocalName(String localName) {

+            attribute.setLocalName(localName);

+        }

+

+        public String getAttributeValue() {

+            return attribute.getAttributeValue();

+        }

+

+        public void setAttributeValue(String value) {

+            attribute.setAttributeValue(value);

+        }

+

+        public void setOMNamespace(OMNamespace omNamespace) {

+            attribute.setOMNamespace(omNamespace);

+        }

+

+        public OMNamespace getNamespace() {

+            return attribute.getNamespace();

+        }

+

+        public QName getQName() {

+            return attribute.getQName();

+        }

+

+        public OMContainer getParent() {

+            return parent;

+        }

+

+        public OMFactory getOMFactory() {

+            return this.factory;

+        }

+    }

+}

+

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP11Constants.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP11Constants.java
new file mode 100644
index 0000000..c391091
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP11Constants.java
@@ -0,0 +1,54 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+

+public interface SOAP11Constants extends SOAPConstants {

+    /**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+    public static final String SOAP_ENVELOPE_NAMESPACE_URI = "http://schemas.xmlsoap.org/soap/envelope/";

+

+    /**

+     * Field ATTR_ACTOR

+     */

+    public static final String ATTR_ACTOR = "actor";

+

+    /**

+     * Field SOAP_FAULT_CODE_LOCAL_NAME

+     */

+    public static final String SOAP_FAULT_CODE_LOCAL_NAME = "faultcode";

+    /**

+     * Field SOAP_FAULT_STRING_LOCAL_NAME

+     */

+    public static final String SOAP_FAULT_STRING_LOCAL_NAME = "faultstring";

+    /**

+     * Field SOAP_FAULT_ACTOR_LOCAL_NAME

+     */

+    public static final String SOAP_FAULT_ACTOR_LOCAL_NAME = "faultactor";

+

+    public static final String SOAP_FAULT_DETAIL_LOCAL_NAME = "detail";

+

+    //SOAP 1.2 Content Type

+    public static final String SOAP_11_CONTENT_TYPE = "text/xml";

+

+     // -------- SOAP Fault Codes ------------------------------

+    public static final String FAULT_CODE_SENDER = "Client";

+    public static final String FAULT_CODE_RECEIVER = "Server";

+

+    public static final String SOAP_ACTOR_NEXT = "http://schemas.xmlsoap.org/soap/actor/next";

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP12Constants.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP12Constants.java
new file mode 100644
index 0000000..3bcb488
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP12Constants.java
@@ -0,0 +1,70 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+

+public interface SOAP12Constants extends SOAPConstants {

+    /**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+

+    public String SOAP_ENVELOPE_NAMESPACE_URI =

+            "http://www.w3.org/2003/05/soap-envelope";

+

+    public static final String SOAP_ROLE = "role";

+    public static final String SOAP_RELAY = "relay";

+

+    // SOAP Fault Code

+    public static final String SOAP_FAULT_CODE_LOCAL_NAME = "Code";

+    public static final String SOAP_FAULT_SUB_CODE_LOCAL_NAME = "Subcode";

+    public static final String SOAP_FAULT_VALUE_LOCAL_NAME = "Value";

+

+    // SOAP Fault Codes

+    public static final String SOAP_FAULT_VALUE_VERSION_MISMATCH = "VersionMismatch";

+    public static final String SOAP_FAULT_VALUE_MUST_UNDERSTAND = "MustUnderstand";

+    public static final String SOAP_FAULT_VALUE_DATA_ENCODING_UKNOWN = "DataEncodingUnknown";

+    public static final String SOAP_FAULT_VALUE_SENDER = "Sender";

+    public static final String SOAP_FAULT_VALUE_RECEIVER = "Receiver";

+

+    // SOAP Fault Reason

+    public static final String SOAP_FAULT_REASON_LOCAL_NAME = "Reason";

+    public static final String SOAP_FAULT_TEXT_LOCAL_NAME = "Text";

+    public static final String SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME = "lang";

+    public static final String SOAP_FAULT_TEXT_LANG_ATTR_NS_URI = "http://www.w3.org/XML/1998/namespace";

+    public static final String SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX = "xml";

+

+    // SOAP Fault Node

+    public static final String SOAP_FAULT_NODE_LOCAL_NAME = "Node";

+

+    // SOAP Fault Detail

+    public static final String SOAP_FAULT_DETAIL_LOCAL_NAME = "Detail";

+

+    // SOAP Fault Role

+    public static final String SOAP_FAULT_ROLE_LOCAL_NAME = "Role";

+

+    //SOAP 1.2 Content Type

+    public static final String SOAP_12_CONTENT_TYPE = "application/soap+xml";

+

+    // -------- SOAP Fault Codes ------------------------------

+    public static final String FAULT_CODE_SENDER = "Sender";

+    public static final String FAULT_CODE_RECEIVER = "Receiver";

+

+    public static final String SOAP_ROLE_NEXT = "http://www.w3.org/2003/05/soap-envelope/role/next";

+    public static final String SOAP_ROLE_NONE = "http://www.w3.org/2003/05/soap-envelope/role/none";

+    public static final String SOAP_ROLE_ULTIMATE_RECEIVER = "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver";

+    

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPBody.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPBody.java
new file mode 100644
index 0000000..79e549a
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPBody.java
@@ -0,0 +1,72 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMException;

+

+/**

+ * An object that represents the contents of the SOAP body

+ * element in a SOAP message. B SOAP body element consists of XML data

+ * that affects the way the application-specific content is processed.

+ * <P>

+ * B <code>SOAPBody</code> object contains <code>OMBodyBlock</code>

+ * objects, which have the content for the SOAP body.

+ * B <code>SOAPFault</code> object, which carries status and/or

+ * error information, is an example of a <code>OMBodyBlock</code> object.

+ */

+public interface SOAPBody extends OMElement {

+    /**

+     * Creates a new <code>SOAPFault</code> object and adds it to

+     * this <code>SOAPBody</code> object.

+     *

+     * @param e

+     * @return the new <code>SOAPFault</code> object

+     * @throws org.apache.axiom.om.OMException

+     *          if there is a SOAP error

+     * @throws org.apache.axiom.om.OMException

+     *

+     */

+    public abstract SOAPFault addFault(Exception e) throws OMException;

+

+    /**

+     * Indicates whether a <code>SOAPFault</code> object exists in

+     * this <code>SOAPBody</code> object.

+     *

+     * @return <code>true</code> if a <code>SOAPFault</code> object exists in

+     *         this <code>SOAPBody</code> object; <code>false</code>

+     *         otherwise

+     */

+    public abstract boolean hasFault();

+

+    /**

+     * Returns the <code>SOAPFault</code> object in this <code>SOAPBody</code>

+     * object.

+     *

+     * @return the <code>SOAPFault</code> object in this <code>SOAPBody</code>

+     *         object

+     */

+    public abstract SOAPFault getFault();

+

+    /**

+     * @param soapFault

+     * @throws OMException

+     */

+    public abstract void addFault(SOAPFault soapFault) throws OMException;

+

+

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPConstants.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPConstants.java
new file mode 100644
index 0000000..5b098eb
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPConstants.java
@@ -0,0 +1,79 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+public interface SOAPConstants {

+    /**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+    /**

+     * Field SOAP_DEFAULT_NAMESPACE_PREFIX

+     */

+    public static final String SOAP_DEFAULT_NAMESPACE_PREFIX = "soapenv";

+    /**

+     * Field SOAPENVELOPE_LOCAL_NAME

+     */

+    public static final String SOAPENVELOPE_LOCAL_NAME = "Envelope";

+

+    /**

+     * Field HEADER_LOCAL_NAME

+     */

+    public static final String HEADER_LOCAL_NAME = "Header";

+

+    /**

+     * Field BODY_LOCAL_NAME

+     */

+    public static final String BODY_LOCAL_NAME = "Body";

+    /**

+     * Field BODY_NAMESPACE_PREFIX

+     */

+    public static final String BODY_NAMESPACE_PREFIX =

+            SOAP_DEFAULT_NAMESPACE_PREFIX;

+    /**

+     * Field BODY_FAULT_LOCAL_NAME

+     */

+    public static final String BODY_FAULT_LOCAL_NAME = "Fault";

+

+    /**

+     * Field ATTR_MUSTUNDERSTAND

+     */

+    public static final String ATTR_MUSTUNDERSTAND = "mustUnderstand";

+    public static final String ATTR_MUSTUNDERSTAND_TRUE = "true";

+    public static final String ATTR_MUSTUNDERSTAND_FALSE = "false";

+    public static final String ATTR_MUSTUNDERSTAND_0 = "0";

+    public static final String ATTR_MUSTUNDERSTAND_1 = "1";

+    /**

+     * Field SOAPFAULT_LOCAL_NAME

+     */

+    public static final String SOAPFAULT_LOCAL_NAME = "Fault";

+    /**

+     * Field SOAPFAULT_DETAIL_LOCAL_NAME

+     */

+    public static final String SOAPFAULT_DETAIL_LOCAL_NAME = "detail";

+

+    public static final String SOAP_FAULT_DETAIL_EXCEPTION_ENTRY = "Exception";

+

+    // -------- SOAP Fault Codes ------------------------------

+    public static final String FAULT_CODE_VERSION_MISMATCH = "VersionMismatch";

+    public static final String FAULT_CODE_MUST_UNDERSTAND  = "MustUnderstand";

+    public static final String FAULT_CODE_DATA_ENCODING_UNKNOWN = "DataEncodingUnknown";

+

+    // Followings are different in SOAP 1.1 and 1.2 specifications

+    public static final String FAULT_CODE_SENDER = "";

+    public static final String FAULT_CODE_RECEIVER = "";

+

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPEnvelope.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPEnvelope.java
new file mode 100644
index 0000000..89acb9d
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPEnvelope.java
@@ -0,0 +1,55 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMException;

+

+/**

+ * Interface SOAPEnvelope

+ */

+public interface SOAPEnvelope extends OMElement {

+    /**

+     * Returns the <CODE>SOAPHeader</CODE> object for this <CODE>

+     * SOAPEnvelope</CODE> object.

+     * <P> This SOAPHeader will just be a container for all the headers in the

+     * <CODE>OMMessage</CODE>

+     * </P>

+     *

+     * @return the <CODE>SOAPHeader</CODE> object or <CODE>

+     *         null</CODE> if there is none

+     * @throws org.apache.axiom.om.OMException

+     *          if there is a problem

+     *          obtaining the <CODE>SOAPHeader</CODE> object

+     */

+    public abstract SOAPHeader getHeader() throws OMException;

+

+    /**

+     * Returns the <CODE>SOAPBody</CODE> object associated with

+     * this <CODE>SOAPEnvelope</CODE> object.

+     * <P> This SOAPBody will just be a container for all the BodyElements in the

+     * <CODE>OMMessage</CODE>

+     * </P>

+     *

+     * @return the <CODE>SOAPBody</CODE> object for this <CODE>

+     *         SOAPEnvelope</CODE> object or <CODE>null</CODE> if there

+     *         is none

+     * @throws OMException if there is a problem

+     *                     obtaining the <CODE>SOAPBody</CODE> object

+     */

+    public abstract SOAPBody getBody() throws OMException;

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFactory.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFactory.java
new file mode 100644
index 0000000..8ac56e1
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFactory.java
@@ -0,0 +1,339 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMFactory;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMXMLParserWrapper;

+

+

+public interface SOAPFactory extends OMFactory {

+    

+    public String getSoapVersionURI();

+    

+    /**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+

+    public SOAPMessage createSOAPMessage();

+    public SOAPMessage createSOAPMessage(OMXMLParserWrapper builder);

+    public SOAPMessage createSOAPMessage(SOAPEnvelope envelope, OMXMLParserWrapper parserWrapper);

+

+    /**

+     * @return Returns SOAPEnvelope.

+     */

+    public SOAPEnvelope createSOAPEnvelope() throws SOAPProcessingException;

+    public SOAPEnvelope createSOAPEnvelope(OMXMLParserWrapper builder);

+

+    /**

+     * @param envelope

+     * @return Returns SOAPHeader.

+     */

+    public SOAPHeader createSOAPHeader(SOAPEnvelope envelope) throws SOAPProcessingException;

+    public SOAPHeader createSOAPHeader() throws SOAPProcessingException;

+

+    /**

+     * @param envelope

+     * @param builder

+     * @return Returns SOAPHeader.

+     */

+    public SOAPHeader createSOAPHeader(SOAPEnvelope envelope,

+                                       OMXMLParserWrapper builder);

+

+    /**

+     * @param localName

+     * @param ns

+     * @return Returns SOAPHeaderBlock.

+     */

+    public SOAPHeaderBlock createSOAPHeaderBlock(String localName,

+                                                 OMNamespace ns,

+                                                 SOAPHeader parent) throws SOAPProcessingException;

+    public SOAPHeaderBlock createSOAPHeaderBlock(String localName,

+                                                 OMNamespace ns) throws SOAPProcessingException;

+

+    /**

+     * @param localName

+     * @param ns

+     * @param parent

+     * @param builder

+     * @return Returns SOAPHeaderBlock.

+     */

+    public SOAPHeaderBlock createSOAPHeaderBlock(String localName,

+                                                 OMNamespace ns,

+                                                 SOAPHeader parent,

+                                                 OMXMLParserWrapper builder) throws SOAPProcessingException;

+

+    /**

+     * @param parent

+     * @param e

+     * @return Returns SOAPFault.

+     */

+    public SOAPFault createSOAPFault(SOAPBody parent, Exception e) throws SOAPProcessingException;

+

+    public SOAPFault createSOAPFault(SOAPBody parent) throws SOAPProcessingException;

+    public SOAPFault createSOAPFault() throws SOAPProcessingException;

+

+    /**

+     * @param parent

+     * @param builder

+     * @return Returns SOAPFault.

+     */

+    public SOAPFault createSOAPFault(SOAPBody parent,

+                                     OMXMLParserWrapper builder);

+

+    /**

+     * @param envelope

+     * @return Returns SOAPBody.

+     */

+    public SOAPBody createSOAPBody(SOAPEnvelope envelope) throws SOAPProcessingException;

+    public SOAPBody createSOAPBody() throws SOAPProcessingException;

+

+    /**

+     * @param envelope

+     * @param builder

+     * @return Returns SOAPBody.

+     */

+    public SOAPBody createSOAPBody(SOAPEnvelope envelope,

+                                   OMXMLParserWrapper builder);

+

+    /* ========================

+       =  SOAPFaultCode       =

+       ======================== */

+

+    /**

+     * Code eii under SOAPFault (parent)

+     *

+     * @param parent

+     * @return Returns SOAPFaultCode.

+     */

+    public SOAPFaultCode createSOAPFaultCode(SOAPFault parent) throws SOAPProcessingException;

+    public SOAPFaultCode createSOAPFaultCode() throws SOAPProcessingException;

+

+    /**

+     * Code eii under SOAPFault (parent)

+     *

+     * @param parent

+     * @param builder

+     * @return Returns SOAPFaultCode.

+     */

+    public SOAPFaultCode createSOAPFaultCode(SOAPFault parent,

+                                             OMXMLParserWrapper builder);

+

+

+    /*========================

+      =  SOAPFaultCodeValue  =

+      ======================== */

+    /**

+     * Value eii under Code (parent)

+     *

+     * @param parent

+     * @return Returns SOAPFaultValue.

+     */

+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent) throws SOAPProcessingException;

+    public SOAPFaultValue createSOAPFaultValue() throws SOAPProcessingException;

+

+    /**

+     * Value eii under Code (parent)

+     *

+     * @param parent

+     * @param builder

+     * @return Returns SOAPFaultValue.

+     */

+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent,

+                                               OMXMLParserWrapper builder);

+

+    /*========================

+      =  SOAPFaultSubCode    =

+      ======================== */

+

+    /**

+     * SubCode eii under Value (parent)

+     *

+     * @param parent

+     * @return Returns SOAPFaultValue.

+     */

+

+    //added

+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent) throws SOAPProcessingException;

+

+    //added

+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent,

+                                               OMXMLParserWrapper builder);

+

+    //changed

+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent) throws SOAPProcessingException;

+    public SOAPFaultSubCode createSOAPFaultSubCode() throws SOAPProcessingException;

+

+    /**

+     * SubCode eii under Value (parent)

+     *

+     * @param parent

+     * @param builder

+     * @return Returns SOAPFaultSubCode.

+     */

+    //changed

+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent,

+                                                   OMXMLParserWrapper builder);

+

+    /**

+     * SubCode eii under SubCode (parent)

+     *

+     * @param parent

+     * @return Returns SOAPFaultSubCode.

+     */

+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent) throws SOAPProcessingException;

+

+    /**

+     * SubCode eii under SubCode (parent)

+     *

+     * @param parent

+     * @param builder

+     * @return Returns SOAPFaultSubCode.

+     */

+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent,

+                                                   OMXMLParserWrapper builder);

+

+

+    /*========================

+      =  SOAPFaultReason     =

+      ======================== */

+

+    /**

+     * Reason eii under SOAPFault (parent)

+     *

+     * @param parent

+     * @return Returns SOAPFaultReason.

+     */

+    public SOAPFaultReason createSOAPFaultReason(SOAPFault parent) throws SOAPProcessingException;

+    public SOAPFaultReason createSOAPFaultReason() throws SOAPProcessingException;

+

+    /**

+     * Reason eii under SOAPFault (parent)

+     *

+     * @param parent

+     * @param builder

+     * @return Returns SOAPFaultReason.

+     */

+    public SOAPFaultReason createSOAPFaultReason(SOAPFault parent,

+                                                 OMXMLParserWrapper builder);

+

+    /*========================

+      =  SOAPFaultReasonText     =

+      ======================== */

+

+    /**

+     * SubCode eii under SubCode (parent)

+     *

+     * @param parent

+     * @return Returns SOAPFaultText.

+     */

+    public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent) throws SOAPProcessingException;

+    public SOAPFaultText createSOAPFaultText() throws SOAPProcessingException;

+

+    /**

+     * SubCode eii under SubCode (parent)

+     *

+     * @param parent

+     * @param builder

+     * @return Returns SOAPFaultText.

+     */

+    public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent,

+                                             OMXMLParserWrapper builder);

+

+

+    /*========================

+      =  SOAPFaultNode       =

+      ======================== */

+

+    /**

+     * Node eii under SOAPFault (parent)

+     *

+     * @param parent

+     * @return Returns SOAPFaultNode.

+     */

+    public SOAPFaultNode createSOAPFaultNode(SOAPFault parent) throws SOAPProcessingException;

+    public SOAPFaultNode createSOAPFaultNode() throws SOAPProcessingException;

+

+    /**

+     * Node eii under SOAPFault (parent)

+     *

+     * @param parent

+     * @param builder

+     * @return Returns SOAPFaultNode.

+     */

+    public SOAPFaultNode createSOAPFaultNode(SOAPFault parent,

+                                             OMXMLParserWrapper builder);

+

+    /*========================

+      =  SOAPFaultRole       =

+      ======================== */

+

+    /**

+     * Role eii under SOAPFault (parent)

+     *

+     * @param parent

+     * @return Returns SOAPFaultRole.

+     */

+    public SOAPFaultRole createSOAPFaultRole(SOAPFault parent) throws SOAPProcessingException;

+    public SOAPFaultRole createSOAPFaultRole() throws SOAPProcessingException;

+

+    /**

+     * Role eii under SOAPFault (parent)

+     *

+     * @param parent

+     * @param builder

+     * @return Returns SOAPFaultRole.

+     */

+    public SOAPFaultRole createSOAPFaultRole(SOAPFault parent,

+                                             OMXMLParserWrapper builder);

+

+    /*========================

+      =  SOAPFaultDetail     =

+      ======================== */

+

+    /**

+     * Detail eii under SOAPFault (parent)

+     *

+     * @param parent

+     * @return Returns SOAPFaultDetail.

+     */

+    public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent) throws SOAPProcessingException;

+    public SOAPFaultDetail createSOAPFaultDetail() throws SOAPProcessingException;

+

+    /**

+     * Role eii under SOAPFault (parent)

+     *

+     * @param parent

+     * @param builder

+     * @return Returns SOAPFaultDetail.

+     */

+    public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent,

+                                                 OMXMLParserWrapper builder);

+

+

+    /**

+     * Method getDefaultEnvelope

+     *

+     * @return Returns SOAPEnvelope.

+     */

+    public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException;

+

+    public SOAPEnvelope getDefaultFaultEnvelope() throws SOAPProcessingException;

+    

+    public OMNamespace getNamespace();

+    

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFault.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFault.java
new file mode 100644
index 0000000..fd23920
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFault.java
@@ -0,0 +1,107 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMException;

+

+

+/**

+ * An element in the <CODE>SOAPBody</CODE> object that contains

+ * error and/or status information. This information may relate to

+ * errors in the <CODE>OMMessage</CODE> object or to problems

+ * that are not related to the content in the message itself.

+ * Problems not related to the message itself are generally errors

+ * in processing, such as the inability to communicate with an

+ * upstream server.

+ * <P>

+ * The <CODE>SOAPFault</CODE> interface provides methods for

+ * retrieving the information contained in a <CODE>

+ * SOAPFault</CODE> object and for setting the fault code, the

+ * fault actor, and a string describing the fault. B fault code is

+ * one of the codes defined in the SOAP 1.1 specification that

+ * describe the fault. An actor is an intermediate recipient to

+ * whom a message was routed. The message path may include one or

+ * more actors, or, if no actors are specified, the message goes

+ * only to the default actor, which is the final intended

+ * recipient.

+ */

+public interface SOAPFault extends OMElement {

+

+    /**

+     * SOAPFaultCode is a mandatory item in a Fault, in SOAP 1.2 specification

+     *

+     * @param soapFaultCode

+     */

+    public void setCode(SOAPFaultCode soapFaultCode) throws SOAPProcessingException;

+

+    public SOAPFaultCode getCode();

+

+    /**

+     * SOAPFaultReason is a mandatory item in a Fault, in SOAP 1.2 specification

+     *

+     * @param reason

+     */

+    public void setReason(SOAPFaultReason reason) throws SOAPProcessingException;

+

+    public SOAPFaultReason getReason();

+

+    /**

+     * SOAPFaultNode is an optional item in a Fault, in SOAP 1.2 specification

+     *

+     * @param node

+     */

+    public void setNode(SOAPFaultNode node) throws SOAPProcessingException;

+

+    public SOAPFaultNode getNode();

+

+    /**

+     * SOAPFaultRoleImpl is an optional item in a Fault, in SOAP 1.2 specification

+     *

+     * @param role

+     */

+    public void setRole(SOAPFaultRole role) throws SOAPProcessingException;

+

+    public SOAPFaultRole getRole();

+

+    /**

+     * SOAPFaultRoleImpl is an optional item in a Fault, in SOAP 1.2 specification

+     *

+     * @param detail

+     */

+    public void setDetail(SOAPFaultDetail detail) throws SOAPProcessingException;

+

+    public SOAPFaultDetail getDetail();

+

+    /**

+     * Returns Exception if there is one in the SOAP fault.

+     * <p/>

+     * If the exception is like;

+     * <SOAPFault>

+     * <Detail>

+     * <Exception> stack trace goes here </Exception>

+     * </Detail>

+     * </SOAPFault>

+     *

+     * @return Returns Exception.

+     * @throws org.apache.axiom.om.OMException

+     *

+     */

+    public Exception getException() throws OMException;

+

+    public void setException(Exception e) throws OMException;

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultCode.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultCode.java
new file mode 100644
index 0000000..5281bf3
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultCode.java
@@ -0,0 +1,46 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMElement;

+

+public interface SOAPFaultCode extends OMElement {

+    /**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+

+    /**

+     * @param value

+     */

+    public void setValue(SOAPFaultValue value) throws SOAPProcessingException;

+

+    /**

+     * @return Returns SOAPFaultValue.

+     */

+    public SOAPFaultValue getValue();

+

+    /**

+     * @param value

+     */

+    public void setSubCode(SOAPFaultSubCode value) throws SOAPProcessingException;

+

+    /**

+     * @return Returns SOAPFaultSubCode.

+     */

+    public SOAPFaultSubCode getSubCode();

+

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultDetail.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultDetail.java
new file mode 100644
index 0000000..4e9175f
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultDetail.java
@@ -0,0 +1,42 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMElement;

+

+import java.util.Iterator;

+

+

+/**

+ * The Detail element information item is intended for carrying application

+ * specific error information related to the SOAP Body .

+ * <p/>

+ * The Detail element information item has:

+ * A [local name] of Detail .

+ * A [namespace name] of http://www.w3.org/2003/05/soap-envelope .

+ * Zero or more attribute information items in its [attributes] property.

+ * Zero or more child element information items in its [children] property.

+ */

+public interface SOAPFaultDetail extends OMElement {

+    /**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+    public void addDetailEntry(OMElement detailElement);

+

+    public Iterator getAllDetailEntries();

+

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultNode.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultNode.java
new file mode 100644
index 0000000..ce8c71f
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultNode.java
@@ -0,0 +1,39 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMElement;

+

+public interface SOAPFaultNode extends OMElement {

+    /**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+

+    /**

+     * each SOAP node is identified by a URI. The value of the Node element

+     * information item is the URI that identifies the SOAP node that generated

+     * the fault. SOAP nodes that do not act as the ultimate SOAP receiver MUST

+     * include this element information item. An ultimate SOAP receiver MAY

+     * include this element information item to indicate explicitly that it

+     * generated the fault.

+     *

+     * @param uri

+     */

+    public void setNodeValue(String uri);

+

+    public String getNodeValue();

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultReason.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultReason.java
new file mode 100644
index 0000000..13657e7
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultReason.java
@@ -0,0 +1,35 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMElement;

+

+import java.util.List;

+

+public interface SOAPFaultReason extends OMElement {

+    /**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+

+    public void addSOAPText(SOAPFaultText soapFaultText) throws SOAPProcessingException;

+

+    public SOAPFaultText getFirstSOAPText();

+

+    public List getAllSoapTexts();

+

+    public SOAPFaultText getSOAPFaultText(String language);

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultRole.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultRole.java
new file mode 100644
index 0000000..808cba3
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultRole.java
@@ -0,0 +1,44 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMElement;

+

+

+/**

+ * The Role element information item identifies the role the node was operating

+ * in at the point the fault occurred.

+ * <p/>

+ * The Role element information item has:

+ * A [local name] of Role .

+ * A [namespace name] of http://www.w3.org/2003/05/soap-envelope .

+ */

+public interface SOAPFaultRole extends OMElement {

+    /**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+    

+    /**

+     * The value of the Role element information item MUST be one of the roles

+     * assumed by the node during processing of the message

+     *

+     * @param uri

+     */

+    public void setRoleValue(String uri);

+

+    public String getRoleValue();

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultSubCode.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultSubCode.java
new file mode 100644
index 0000000..ae78934
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultSubCode.java
@@ -0,0 +1,44 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMElement;

+

+public interface SOAPFaultSubCode extends OMElement {

+    /**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+

+    /**

+     * Fault SubCode contain only one mandatory Value child. This value child contains a QName

+     *

+     * @param soapFaultSubCodeValue

+     */

+    public void setValue(SOAPFaultValue soapFaultSubCodeValue) throws SOAPProcessingException;

+

+    public SOAPFaultValue getValue();

+

+

+    /**

+     * Fault SubCode can contain an optional SubCode

+     *

+     * @param subCode

+     */

+    public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException;

+

+    public SOAPFaultSubCode getSubCode();

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultText.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultText.java
new file mode 100644
index 0000000..b6c6a75
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultText.java
@@ -0,0 +1,38 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMElement;

+

+public interface SOAPFaultText extends OMElement {

+    /**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+

+    /**

+     * lang is a mandatory attribute within the SOAPFaultText which must have

+     * SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI as the namespace URI and

+     * SOAP12constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX or a capitalization thereof as the prefix

+     *

+     * @param lang

+     */

+    public void setLang(String lang);

+

+    public String getLang();

+

+

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultValue.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultValue.java
new file mode 100644
index 0000000..1d803b9
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultValue.java
@@ -0,0 +1,25 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMElement;

+

+public interface SOAPFaultValue extends OMElement {

+    /**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPHeader.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPHeader.java
new file mode 100644
index 0000000..1d4ebc5
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPHeader.java
@@ -0,0 +1,128 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMException;

+import org.apache.axiom.om.OMNamespace;

+

+import java.util.ArrayList;

+import java.util.Iterator;

+

+/**

+ * Interface SOAPHeader

+ */

+public interface SOAPHeader extends OMElement {

+    /**

+     * Creates a new <CODE>SOAPHeaderBlock</CODE> object initialized with the

+     * specified name and adds it to this <CODE>SOAPHeader</CODE> object.

+     *

+     * @param localName

+     * @param ns

+     * @return the new <CODE>SOAPHeaderBlock</CODE> object that was inserted

+     *         into this <CODE>SOAPHeader</CODE> object

+     * @throws org.apache.axiom.om.OMException

+     *             if a SOAP error occurs

+     */

+    public abstract SOAPHeaderBlock addHeaderBlock(String localName,

+            OMNamespace ns) throws OMException;

+

+    /**

+     * Returns a list of all the <CODE>SOAPHeaderBlock</CODE> objects in this

+     * <CODE>SOAPHeader</CODE> object that have the the specified role. An

+     * role is a global attribute that indicates the intermediate parties to

+     * whom the message should be sent. An role receives the message and then

+     * sends it to the next role. The default role is the ultimate intended

+     * recipient for the message, so if no role attribute is included in a

+     * <CODE>SOAPHeader</CODE> object, the message is sent to its ultimate

+     * destination.

+     *

+     * @param role

+     *            a <CODE>String</CODE> giving the URI of the role for which

+     *            to search

+     * @return Returns an <CODE>Iterator</CODE> object over all the <CODE>

+     *         SOAPHeaderBlock</CODE> objects that contain the specified role

+     * @see #extractHeaderBlocks(java.lang.String)

+     *      extractHeaderBlocks(java.lang.String)

+     */

+    public abstract Iterator examineHeaderBlocks(String role);

+

+    /**

+     * Returns a list of all the <CODE>SOAPHeaderBlock</CODE> objects in this

+     * <CODE>SOAPHeader</CODE> object that have the the specified role and

+     * detaches them from this <CODE>SOAPHeader</CODE> object.

+     * <P>

+     * This method allows an role to process only the parts of the <CODE>

+     * SOAPHeader</CODE> object that apply to it and to remove them before

+     * passing the message on to the next role.

+     *

+     * @param role

+     *            a <CODE>String</CODE> giving the URI of the role for which

+     *            to search

+     * @return Returns an <CODE>Iterator</CODE> object over all the <CODE>

+     *         SOAPHeaderBlock</CODE> objects that contain the specified role

+     * @see #examineHeaderBlocks(java.lang.String)

+     *      examineHeaderBlocks(java.lang.String)

+     */

+    public abstract Iterator extractHeaderBlocks(String role);

+

+    /**

+     * Returns an <code>Iterator</code> over all the

+     * <code>SOAPHeaderBlock</code> objects in this <code>SOAPHeader</code>

+     * object that have the specified role and that have a MustUnderstand

+     * attribute whose value is equivalent to <code>true</code>.

+     *

+     * @param role

+     *            a <code>String</code> giving the URI of the role for which

+     *            to search

+     * @return Returns an <code>Iterator</code> object over all the

+     *         <code>SOAPHeaderBlock</code> objects that contain the specified

+     *         role and are marked as MustUnderstand.

+     */

+    public abstract Iterator examineMustUnderstandHeaderBlocks(String role);

+

+    /**

+     * Returns an <code>Iterator</code> over all the

+     * <code>SOAPHeaderBlock</code> objects in this <code>SOAPHeader</code>

+     * object.

+     *

+     * @return an <code>Iterator</code> object over all the

+     *         <code>SOAPHeaderBlock</code> objects contained by this

+     *         <code>SOAPHeader</code>. If there are no header blocks then an

+     *         empty iterator is returned.

+     */

+    public abstract Iterator examineAllHeaderBlocks();

+

+    /**

+     * Returns an <code>Iterator</code> over all the

+     * <code>SOAPHeaderBlock</code> objects in this <code>SOAPHeader </code>

+     * object and detaches them from this <code>SOAPHeader</code> object.

+     *

+     * @return Returns an <code>Iterator</code> object over all the

+     *         <code>SOAPHeaderBlock</code> objects contained by this

+     *         <code>SOAPHeader</code>

+     */

+    public abstract Iterator extractAllHeaderBlocks();

+

+    /**

+     * Return all the Headers that has the Namespace URI to given NS URI.

+     *

+     * @param nsURI

+     * @return Returns ArrayList.

+     */

+    public ArrayList getHeaderBlocksWithNSURI(String nsURI);

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPHeaderBlock.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPHeaderBlock.java
new file mode 100644
index 0000000..6215db3
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPHeaderBlock.java
@@ -0,0 +1,89 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMElement;

+

+/**

+ * <P>An object representing the contents in the SOAP header part of the SOAP

+ * envelope. The immediate children of a <CODE> SOAPHeader</CODE> object can be

+ * represented only as <CODE> SOAPHeaderBlock</CODE> objects.</P> <P>B

+ * <CODE>SOAPHeaderBlock</CODE> object can have other <CODE>OMElement</CODE>

+ * objects as its children.</P>

+ */

+public interface SOAPHeaderBlock extends OMElement {

+    /**

+     * Sets the actor associated with this <CODE> SOAPHeaderBlock</CODE> object

+     * to the specified actor.

+     *

+     * @param roleURI a <CODE>String</CODE> giving the URI of the actor to set

+     * @throws java.lang.IllegalArgumentException

+     *          if there is a problem in setting the actor.

+     * @see #getRole() getRole()

+     */

+    public abstract void setRole(String roleURI);

+

+    /**

+     * Returns the uri of the actor associated with this <CODE>

+     * SOAPHeaderBlock</CODE> object.

+     *

+     * @return a <CODE>String</CODE> giving the URI of the actor

+     * @see #setRole(java.lang.String) setRole(java.lang.String)

+     */

+    public abstract String getRole();

+

+    /**

+     * Sets the mustUnderstand attribute for this <CODE> SOAPHeaderBlock</CODE>

+     * object to be on or off. <P>If the mustUnderstand attribute is on, the

+     * actor who receives the <CODE>SOAPHeaderBlock</CODE> must process it

+     * correctly. This ensures, for example, that if the <CODE>

+     * SOAPHeaderBlock</CODE> object modifies the message, that the message is

+     * being modified correctly.</P>

+     *

+     * @param mustUnderstand <CODE>true</CODE> to set the mustUnderstand

+     *                       attribute on; <CODE>false</CODE> to turn if off

+     * @throws java.lang.IllegalArgumentException

+     *          if there is a problem in setting the actor.

+     * @see #getMustUnderstand() getMustUnderstand()

+     */

+    public abstract void setMustUnderstand(boolean mustUnderstand);

+

+    public abstract void setMustUnderstand(String mustUnderstand) throws SOAPProcessingException;

+

+    /**

+     * Returns whether the mustUnderstand attribute for this

+     * <CODE>SOAPHeaderBlock</CODE> object is turned on.

+     *

+     * @return <CODE>true</CODE> if the mustUnderstand attribute of this

+     *         <CODE>SOAPHeaderBlock</CODE> object is turned on;

+     *         <CODE>false</CODE> otherwise

+     */

+    public abstract boolean getMustUnderstand() throws SOAPProcessingException;

+

+

+    public abstract boolean isProcessed();

+

+    /**

+     * We need to know whether all the mustUnderstand headers have been

+     * processed by the node. This will done by a specific validation handler at

+     * the end of the execution chain. For this all the handlers who process a

+     * particular header block must explicitly say that he processesd the header

+     * by calling setProcessed()

+     */

+    public abstract void setProcessed();

+

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPMessage.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPMessage.java
new file mode 100644
index 0000000..278c0b8
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPMessage.java
@@ -0,0 +1,26 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMDocument;

+

+public interface SOAPMessage extends OMDocument {

+

+    public SOAPEnvelope getSOAPEnvelope() throws SOAPProcessingException;

+    public void setSOAPEnvelope(SOAPEnvelope envelope) throws SOAPProcessingException;

+

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPProcessingException.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPProcessingException.java
new file mode 100644
index 0000000..8c0ea16
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPProcessingException.java
@@ -0,0 +1,66 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMException;

+

+public class SOAPProcessingException extends OMException {

+

+    private static final long serialVersionUID = -5432612295193716211L;

+    

+    private String soapFaultCode;

+

+    /**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+    public SOAPProcessingException(String message) {

+        super(message);

+    }

+

+    public SOAPProcessingException(Throwable cause) {

+        super(cause);

+    }

+

+    /**

+     *

+     * @param messageText - this will appear as the Text in the Reason information item of SOAP Fault

+     * @param faultCode - this will appear as the Value in the Code information item of SOAP Fault

+     * @param cause - this will appear under the Detail information item of SOAP Fault

+     */

+    public SOAPProcessingException(String messageText, String faultCode, Throwable cause) {

+        super(messageText, cause);

+        this.soapFaultCode = faultCode;

+    }

+

+    /**

+     *

+     * @param messageText - this will appear as the Text in the Reason information item of SOAP Fault

+     * @param faultCode - this will appear as the Value in the Code information item of SOAP Fault

+     */

+    public SOAPProcessingException(String messageText, String faultCode) {

+        super(messageText);

+        this.soapFaultCode = faultCode;

+    }

+

+    public String getFaultCode() {

+        return soapFaultCode;

+    }

+

+    public void setFaultCode(String soapFaultCode) {

+        this.soapFaultCode = soapFaultCode;

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/SOAP11BuilderHelper.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/SOAP11BuilderHelper.java
new file mode 100644
index 0000000..72ec9a2
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/SOAP11BuilderHelper.java
@@ -0,0 +1,166 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.builder;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMText;

+import org.apache.axiom.om.impl.OMNodeEx;

+import org.apache.axiom.om.impl.exception.OMBuilderException;

+import org.apache.axiom.soap.SOAP11Constants;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPFault;

+import org.apache.axiom.soap.SOAPFaultCode;

+import org.apache.axiom.soap.SOAPFaultReason;

+import org.apache.axiom.soap.SOAPFaultText;

+import org.apache.axiom.soap.SOAPFaultValue;

+import org.apache.axiom.soap.SOAPProcessingException;

+import org.w3c.dom.Element;

+

+import javax.xml.stream.XMLStreamException;

+import javax.xml.stream.XMLStreamReader;

+

+public class SOAP11BuilderHelper extends SOAPBuilderHelper implements SOAP11Constants {

+    private SOAPFactory factory;

+    private boolean faultcodePresent = false;

+    private boolean faultstringPresent = false;

+

+    public SOAP11BuilderHelper(StAXSOAPModelBuilder builder) {

+        super(builder);

+        factory = builder.getSoapFactory();

+    }

+

+    public OMElement handleEvent(XMLStreamReader parser,

+                                 OMElement parent,

+                                 int elementLevel) throws SOAPProcessingException {

+        this.parser = parser;

+

+        OMElement element = null;

+        String localName = parser.getLocalName();

+

+        if (elementLevel == 4) {

+

+            if (SOAP_FAULT_CODE_LOCAL_NAME.equals(localName)) {

+

+                SOAPFaultCode code = factory.createSOAPFaultCode(

+                        (SOAPFault) parent, builder);

+                SOAPFaultValue value = factory.createSOAPFaultValue(code);

+                processNamespaceData(code, false);

+                processAttributes(code);

+

+                processText(parser, value);

+                ((OMNodeEx)code).setComplete(true);

+                element = code;

+                builder.elementLevel--;

+

+                faultcodePresent = true;

+            } else if (SOAP_FAULT_STRING_LOCAL_NAME.equals(localName)) {

+

+                SOAPFaultReason reason = factory.createSOAPFaultReason(

+                        (SOAPFault) parent, builder);

+                SOAPFaultText faultText = factory.createSOAPFaultText(reason);

+                processNamespaceData(reason, false);

+                processAttributes(reason);

+

+                processText(parser, faultText);

+                ((OMNodeEx)reason).setComplete(true);

+                element = reason;

+                builder.elementLevel--;

+

+

+                faultstringPresent = true;

+            } else if (SOAP_FAULT_ACTOR_LOCAL_NAME.equals(localName)) {

+                element =

+                        factory.createSOAPFaultRole((SOAPFault) parent,

+                                builder);

+                processNamespaceData(element, false);

+                processAttributes(element);

+            } else if (SOAP_FAULT_DETAIL_LOCAL_NAME.equals(localName)) {

+                element =

+                        factory.createSOAPFaultDetail((SOAPFault) parent,

+                                builder);

+                processNamespaceData(element, false);

+                processAttributes(element);

+            } else {

+                element =

+                        factory.createOMElement(

+                                localName, null, parent, builder);

+                processNamespaceData(element, false);

+                processAttributes(element);

+            }

+

+        } else if (elementLevel == 5) {

+

+        	String parentTagName = "";

+        	if(parent instanceof Element) {

+        		parentTagName = ((Element)parent).getTagName();

+        	} else {

+        		parentTagName = parent.getLocalName();

+        	}

+        	

+            if (parentTagName.equals(SOAP_FAULT_CODE_LOCAL_NAME)) {

+                throw new OMBuilderException(

+                        "faultcode element should not have children");

+            } else if (parentTagName.equals(

+                    SOAP_FAULT_STRING_LOCAL_NAME)) {

+                throw new OMBuilderException(

+                        "faultstring element should not have children");

+            } else if (parentTagName.equals(

+                    SOAP_FAULT_ACTOR_LOCAL_NAME)) {

+                throw new OMBuilderException(

+                        "faultactor element should not have children");

+            } else {

+                element =

+                        this.factory.createOMElement(

+                                localName, null, parent, builder);

+                processNamespaceData(element, false);

+                processAttributes(element);

+            }

+

+        } else if (elementLevel > 5) {

+            element =

+                    this.factory.createOMElement(localName,

+                            null,

+                            parent,

+                            builder);

+            processNamespaceData(element, false);

+            processAttributes(element);

+        }

+

+        return element;

+    }

+

+    private void processText(XMLStreamReader parser, OMElement value) {

+        try {

+            int token = parser.next();

+            while (token != XMLStreamReader.END_ELEMENT) {

+                if (token == XMLStreamReader.CHARACTERS) {

+                    OMText text = factory.createOMText(value, parser.getText());

+                    value.addChild(text);

+                } else {

+                    throw new SOAPProcessingException(

+                            "Only Characters are allowed here");

+                }

+                token = parser.next();

+            }

+

+

+        } catch (XMLStreamException e) {

+            throw new SOAPProcessingException(e);

+        }

+    }

+

+}
\ No newline at end of file
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/SOAP12BuilderHelper.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/SOAP12BuilderHelper.java
new file mode 100644
index 0000000..756f498
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/SOAP12BuilderHelper.java
@@ -0,0 +1,320 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.builder;

+

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.impl.OMNodeEx;

+import org.apache.axiom.om.impl.exception.OMBuilderException;

+import org.apache.axiom.soap.SOAP12Constants;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPFault;

+import org.apache.axiom.soap.SOAPFaultCode;

+import org.apache.axiom.soap.SOAPFaultReason;

+import org.apache.axiom.soap.SOAPFaultSubCode;

+import org.apache.axiom.soap.SOAPProcessingException;

+

+import javax.xml.stream.XMLStreamReader;

+import java.util.Vector;

+

+public class SOAP12BuilderHelper extends SOAPBuilderHelper {

+

+    private SOAPFactory factory;

+    private boolean codePresent = false;

+    private boolean reasonPresent = false;

+    private boolean nodePresent = false;

+    private boolean rolePresent = false;

+    private boolean detailPresent = false;

+    private boolean subcodeValuePresent = false;

+    private boolean subSubcodePresent = false;

+    private boolean valuePresent = false;

+    private boolean subcodePresent = false;

+    private boolean codeprocessing = false;

+    private boolean subCodeProcessing = false;

+    private boolean reasonProcessing = false;

+    private Vector detailElementNames;

+

+    public SOAP12BuilderHelper(StAXSOAPModelBuilder builder) {

+        super(builder);

+        factory = builder.getSoapFactory();

+    }

+

+    public OMElement handleEvent(XMLStreamReader parser,

+                                 OMElement parent,

+                                 int elementLevel) throws SOAPProcessingException {

+

+        this.parser = parser;

+        OMElement element = null;

+

+        if (elementLevel == 4) {

+            if (parser.getLocalName().equals(

+                    SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME)) {

+                if (codePresent) {

+                    throw new OMBuilderException(

+                            "Multiple Code element encountered");

+                } else {

+                    element =

+                            factory.createSOAPFaultCode((SOAPFault) parent,

+                                    builder);

+                    codePresent = true;

+                    codeprocessing = true;

+                }

+            } else if (parser.getLocalName().equals(

+                    SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME)) {

+                if (!codeprocessing && !subCodeProcessing) {

+                    if (codePresent) {

+                        if (reasonPresent) {

+                            throw new OMBuilderException(

+                                    "Multiple Reason Element encountered");

+                        } else {

+                            element =

+                                    factory.createSOAPFaultReason(

+                                            (SOAPFault) parent, builder);

+                            reasonPresent = true;

+                            reasonProcessing = true;

+                        }

+                    } else {

+                        throw new OMBuilderException(

+                                "Wrong element order encountred at " +

+                                parser.getLocalName());

+                    }

+                } else {

+                    if (codeprocessing) {

+                        throw new OMBuilderException(

+                                "Code doesn't have a value");

+                    } else {

+                        throw new OMBuilderException(

+                                "A subcode doesn't have a Value");

+                    }

+                }

+

+            } else if (parser.getLocalName().equals(

+                    SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME)) {

+                if (!reasonProcessing) {

+                    if (reasonPresent && !rolePresent && !detailPresent) {

+                        if (nodePresent) {

+                            throw new OMBuilderException(

+                                    "Multiple Node element encountered");

+                        } else {

+                            element =

+                                    factory.createSOAPFaultNode(

+                                            (SOAPFault) parent, builder);

+                            nodePresent = true;

+                        }

+                    } else {

+                        throw new OMBuilderException(

+                                "wrong element order encountered at " +

+                                parser.getLocalName());

+                    }

+                } else {

+                    throw new OMBuilderException(

+                            "Reason element Should have a text");

+                }

+            } else if (parser.getLocalName().equals(

+                    SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME)) {

+                if (!reasonProcessing) {

+                    if (reasonPresent && !detailPresent) {

+                        if (rolePresent) {

+                            throw new OMBuilderException(

+                                    "Multiple Role element encountered");

+                        } else {

+                            element =

+                                    factory.createSOAPFaultRole(

+                                            (SOAPFault) parent, builder);

+                            rolePresent = true;

+                        }

+                    } else {

+                        throw new OMBuilderException(

+                                "Wrong element order encountered at " +

+                                parser.getLocalName());

+                    }

+                } else {

+                    throw new OMBuilderException(

+                            "Reason element should have a text");

+                }

+            } else if (parser.getLocalName().equals(

+                    SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME)) {

+                if (!reasonProcessing) {

+                    if (reasonPresent) {

+                        if (detailPresent) {

+                            throw new OMBuilderException(

+                                    "Multiple detail element encountered");

+                        } else {

+                            element =

+                                    factory.createSOAPFaultDetail(

+                                            (SOAPFault) parent, builder);

+                            detailPresent = true;

+                        }

+                    } else {

+                        throw new OMBuilderException(

+                                "wrong element order encountered at " +

+                                parser.getLocalName());

+                    }

+                } else {

+                    throw new OMBuilderException(

+                            "Reason element should have a text");

+                }

+            } else {

+                throw new OMBuilderException(

+                        parser.getLocalName() +

+                        " unsupported element in SOAPFault element");

+            }

+

+        } else if (elementLevel == 5) {

+            if (parent.getLocalName().equals(

+                    SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME)) {

+                if (parser.getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME)) {

+                    if (!valuePresent) {

+                        element =

+                                factory.createSOAPFaultValue(

+                                        (SOAPFaultCode) parent, builder);

+                        valuePresent = true;

+                        codeprocessing = false;

+                    } else {

+                        throw new OMBuilderException(

+                                "Multiple value Encountered in code element");

+                    }

+

+                } else if (parser.getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME)) {

+                    if (!subcodePresent) {

+                        if (valuePresent) {

+                            element =

+                                    factory.createSOAPFaultSubCode(

+                                            (SOAPFaultCode) parent, builder);

+                            subcodePresent = true;

+                            subCodeProcessing = true;

+                        } else {

+                            throw new OMBuilderException(

+                                    "Value should present before the subcode");

+                        }

+

+                    } else {

+                        throw new OMBuilderException(

+                                "multiple subcode Encountered in code element");

+                    }

+                } else {

+                    throw new OMBuilderException(

+                            parser.getLocalName() +

+                            " is not supported inside the code element");

+                }

+

+            } else if (parent.getLocalName().equals(

+                    SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME)) {

+                if (parser.getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME)) {

+                    element =

+                            factory.createSOAPFaultText(

+                                    (SOAPFaultReason) parent, builder);

+                    ((OMNodeEx)element).setComplete(false);

+                    reasonProcessing = false;

+                } else {

+                    throw new OMBuilderException(

+                            parser.getLocalName() +

+                            " is not supported inside the reason");

+                }

+            } else if (parent.getLocalName().equals(

+                    SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME)) {

+                element =

+                        this.factory.createOMElement(

+                                parser.getLocalName(), null, parent, builder);

+                builder.setProcessingDetailElements(true);

+                detailElementNames = new Vector();

+                detailElementNames.add(parser.getLocalName());

+

+            } else {

+                throw new OMBuilderException(

+                        parent.getLocalName() +

+                        " should not have child element");

+            }

+

+

+        } else if (elementLevel > 5) {

+            if (parent.getLocalName().equals(

+                    SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME)) {

+                if (parser.getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME)) {

+                    if (subcodeValuePresent) {

+                        throw new OMBuilderException(

+                                "multiple subCode value encountered");

+                    } else {

+                        element =

+                                factory.createSOAPFaultValue(

+                                        (SOAPFaultSubCode) parent, builder);

+                        subcodeValuePresent = true;

+                        subSubcodePresent = false;

+                        subCodeProcessing = false;

+                    }

+                } else if (parser.getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME)) {

+                    if (subcodeValuePresent) {

+                        if (!subSubcodePresent) {

+                            element =

+                                    factory.createSOAPFaultSubCode(

+                                            (SOAPFaultSubCode) parent,

+                                            builder);

+                            subcodeValuePresent = false;

+                            subSubcodePresent = true;

+                            subCodeProcessing = true;

+                        } else {

+                            throw new OMBuilderException(

+                                    "multiple subcode encountered");

+                        }

+                    } else {

+                        throw new OMBuilderException(

+                                "Value should present before the subcode");

+                    }

+                } else {

+                    throw new OMBuilderException(

+                            parser.getLocalName() +

+                            " is not supported inside the subCode element");

+                }

+            } else if (builder.isProcessingDetailElements()) {

+                int detailElementLevel = 0;

+                boolean localNameExist = false;

+                for (int i = 0; i < detailElementNames.size(); i++) {

+                    if (parent.getLocalName().equals(

+                            detailElementNames.get(i))) {

+                        localNameExist = true;

+                        detailElementLevel = i + 1;

+                    }

+                }

+                if (localNameExist) {

+                    detailElementNames.setSize(detailElementLevel);

+                    element =

+                            this.factory.createOMElement(

+                                    parser.getLocalName(),

+                                    null,

+                                    parent,

+                                    builder);

+                    detailElementNames.add(parser.getLocalName());

+                }

+

+            } else {

+                throw new OMBuilderException(

+                        parent.getLocalName() +

+                        " should not have child at element level " +

+                        elementLevel);

+            }

+        }

+

+        processNamespaceData(element, false);

+        processAttributes(element);

+        return element;

+    }

+}
\ No newline at end of file
diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/SOAPBuilderHelper.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/SOAPBuilderHelper.java
new file mode 100644
index 0000000..74ffc91
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/SOAPBuilderHelper.java
@@ -0,0 +1,101 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.builder;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.impl.exception.OMBuilderException;

+import org.apache.axiom.soap.SOAP11Constants;

+import org.apache.axiom.soap.SOAP12Constants;

+import org.apache.axiom.soap.SOAPProcessingException;

+

+import javax.xml.stream.XMLStreamReader;

+

+public abstract class SOAPBuilderHelper {

+    protected StAXSOAPModelBuilder builder;

+    protected XMLStreamReader parser;

+

+    protected SOAPBuilderHelper(StAXSOAPModelBuilder builder) {

+        this.builder = builder;

+    }

+

+    public abstract OMElement handleEvent(XMLStreamReader parser,

+                                          OMElement element,

+                                          int elementLevel) throws SOAPProcessingException;

+

+    protected void processNamespaceData(OMElement node, boolean checkSOAPNamespace) {

+        int namespaceCount = parser.getNamespaceCount();

+        for (int i = 0; i < namespaceCount; i++) {

+            node.declareNamespace(parser.getNamespaceURI(i),

+                    parser.getNamespacePrefix(i));

+        }

+

+        // set the own namespace

+        String namespaceURI = parser.getNamespaceURI();

+        String prefix = parser.getPrefix();

+        OMNamespace namespace = null;

+        if (namespaceURI != null && namespaceURI.length() > 0) {

+            if (prefix == null) {

+                // this means, this elements has a default namespace or it has inherited a default namespace from its parent

+                namespace = node.findNamespace(namespaceURI, "");

+                if (namespace == null) {

+                    namespace = node.declareNamespace(namespaceURI, "");

+                }

+            } else {

+                namespace = node.findNamespace(namespaceURI, prefix);

+            }

+            node.setNamespace(namespace);

+        } else {

+

+        }

+

+

+

+        // TODO we got to have this to make sure OM reject mesagess that are not name space qualified

+        // But got to comment this to interop with Axis.1.x

+        // if (namespace == null) {

+        // throw new OMException("All elements must be namespace qualified!");

+        // }

+        if (checkSOAPNamespace) {

+            if (node.getNamespace() != null &&

+                    !node.getNamespace().getNamespaceURI().equals(

+                            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI) &&

+                    !node.getNamespace().getNamespaceURI().equals(

+                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {

+                throw new OMBuilderException("invalid SOAP namespace URI");

+            }

+        }

+

+    }

+

+    protected void processAttributes(OMElement node) {

+        int attribCount = parser.getAttributeCount();

+        for (int i = 0; i < attribCount; i++) {

+            OMNamespace ns = null;

+            String uri = parser.getAttributeNamespace(i);

+            if (uri.hashCode() != 0) {

+                ns = node.findNamespace(uri,

+                        parser.getAttributePrefix(i));

+            }

+

+            // todo if the attributes are supposed to namespace qualified all the time

+            // todo then this should throw an exception here

+            node.addAttribute(parser.getAttributeLocalName(i),

+                    parser.getAttributeValue(i), ns);

+        }

+    }

+}

diff --git a/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java
new file mode 100644
index 0000000..4f70658
--- /dev/null
+++ b/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java
@@ -0,0 +1,432 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.builder;

+

+import org.apache.axiom.om.OMAbstractFactory;

+import org.apache.axiom.om.OMDocument;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMException;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMNode;

+import org.apache.axiom.om.impl.OMNodeEx;

+import org.apache.axiom.om.impl.builder.StAXOMBuilder;

+import org.apache.axiom.soap.SOAP11Constants;

+import org.apache.axiom.soap.SOAP12Constants;

+import org.apache.axiom.soap.SOAPBody;

+import org.apache.axiom.soap.SOAPConstants;

+import org.apache.axiom.soap.SOAPEnvelope;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPHeader;

+import org.apache.axiom.soap.SOAPMessage;

+import org.apache.axiom.soap.SOAPProcessingException;

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+

+import javax.xml.stream.XMLStreamReader;

+

+/**

+ * Class StAXSOAPModelBuilder

+ */

+public class StAXSOAPModelBuilder extends StAXOMBuilder {

+

+    SOAPMessage soapMessage;

+    /**

+     * Field envelope

+     */

+    private SOAPEnvelope envelope;

+    private OMNamespace envelopeNamespace;

+

+

+    private SOAPFactory soapFactory;

+

+    /**

+     * Field headerPresent

+     */

+    private boolean headerPresent = false;

+

+    /**

+     * Field bodyPresent

+     */

+    private boolean bodyPresent = false;

+

+    /**

+     * Field log

+     */

+    private Log log = LogFactory.getLog(getClass());

+

+    /**

+     * element level 1 = envelope level element level 2 = Header or Body level

+     * element level 3 = HeaderElement or BodyElement level

+     */

+    protected int elementLevel = 0;

+

+    private boolean processingFault = false;

+

+

+    //added

+    /* This is used to indicate whether detail element is processing in soap 1.2 builderhelper

+    */

+    private boolean processingDetailElements = false;

+

+    private SOAPBuilderHelper builderHelper;

+    private String senderfaultCode;

+    private String receiverfaultCode;

+

+    private String charEncoding = null;

+    private String parserVersion = null;

+

+    /**

+     * Constructor StAXSOAPModelBuilder

+     * soapVersion parameter is to give the soap version from the transport. For example, in HTTP case

+     * you can identify the version of the soap message u have recd by looking at the HTTP headers.

+     * It is used to check whether the actual soap message contained is of that version.

+     * If one is creates the builder from the transport, then can just pass null for version.

+     *

+     * @param parser

+     * @param soapVersion parameter is to give the soap version for the transport.

+     */

+    public StAXSOAPModelBuilder(XMLStreamReader parser, String soapVersion) {

+        super(parser);

+        charEncoding = parser.getCharacterEncodingScheme();

+        parserVersion = parser.getVersion();

+        identifySOAPVersion(soapVersion);

+    }

+

+    /**

+     * @param parser

+     * @param factory

+     * @param soapVersion parameter is to give the soap version from the transport. For example, in

+     *                    HTTP case you can identify the version of the soap message u have recd by looking at

+     *                    the HTTP headers. It is used to check whether the actual soap message

+     *                    contained is of that version.If one is creates the builder from the transport,

+     *                    then can just pass null for version.

+     */

+    public StAXSOAPModelBuilder(XMLStreamReader parser, SOAPFactory factory, String soapVersion) {

+        super(factory, parser);

+        soapFactory = factory;

+        charEncoding = parser.getCharacterEncodingScheme();

+        parserVersion = parser.getVersion();

+        identifySOAPVersion(soapVersion);

+    }

+

+    /**

+     * @param soapVersionURIFromTransport

+     */

+    protected void identifySOAPVersion(String soapVersionURIFromTransport) {

+

+        SOAPEnvelope soapEnvelope = getSOAPEnvelope();

+        if (soapEnvelope == null) {

+            throw new SOAPProcessingException("SOAP Message does not contain an Envelope",

+                    SOAPConstants.FAULT_CODE_VERSION_MISMATCH);

+        }

+

+        envelopeNamespace = soapEnvelope.getNamespace();

+        String namespaceName = envelopeNamespace.getNamespaceURI();

+        if ((soapVersionURIFromTransport != null) && !(soapVersionURIFromTransport.equals(namespaceName)))

+        {

+            throw new SOAPProcessingException("Transport level information does not match with SOAP" +

+                    " Message namespace URI", envelopeNamespace.getPrefix() + ":" + SOAPConstants.FAULT_CODE_VERSION_MISMATCH);

+

+        }

+    }

+

+    /**

+     * Method getSOAPEnvelope.

+     *

+     * @return Returns SOAPEnvelope.

+     * @throws OMException

+     */

+    public SOAPEnvelope getSOAPEnvelope() throws OMException {

+        while ((envelope == null) && !done) {

+            next();

+        }

+        return envelope;

+    }

+

+    /**

+     * Method createOMElement.

+     *

+     * @return Returns OMNode.

+     * @throws OMException

+     */

+    protected OMNode createOMElement() throws OMException {

+        elementLevel++;

+        OMElement node;

+        String elementName = parser.getLocalName();

+        if (lastNode == null) {

+            node = constructNode(null, elementName, true);

+            setSOAPEnvelope(node);

+        } else if (lastNode.isComplete()) {

+            node =

+                    constructNode((OMElement) lastNode.getParent(),

+                            elementName,

+                            false);

+            ((OMNodeEx) lastNode).setNextOMSibling(node);

+            ((OMNodeEx) node).setPreviousOMSibling(lastNode);

+        } else {

+            OMElement e = (OMElement) lastNode;

+            node = constructNode((OMElement) lastNode, elementName, false);

+            e.setFirstChild(node);

+        }

+

+

+        log.debug("Build the OMElelment " + node.getLocalName() +

+                "By the StaxSOAPModelBuilder");

+        return node;

+    }

+

+    protected void setSOAPEnvelope(OMElement node) {

+        soapMessage.setSOAPEnvelope((SOAPEnvelope) node);

+        soapMessage.setXMLVersion(parserVersion);

+        soapMessage.setCharsetEncoding(charEncoding);

+    }

+

+    /**

+     * Method constructNode

+     *

+     * @param parent

+     * @param elementName

+     * @param isEnvelope

+     */

+    protected OMElement constructNode(OMElement parent, String elementName,

+                                      boolean isEnvelope) {

+        OMElement element;

+        if (parent == null) {

+

+            // Now I've found a SOAP Envelope, now create SOAPDocument and SOAPEnvelope here.

+

+            if (!elementName.equalsIgnoreCase(SOAPConstants.SOAPENVELOPE_LOCAL_NAME)) {

+                throw new SOAPProcessingException("First Element must contain the local name, "

+                        + SOAPConstants.SOAPENVELOPE_LOCAL_NAME, SOAPConstants.FAULT_CODE_VERSION_MISMATCH);

+            }

+

+            // determine SOAP version and from that determine a proper factory here.

+            if (soapFactory == null) {

+                String namespaceURI = this.parser.getNamespaceURI();

+                if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(namespaceURI)) {

+                    soapFactory = OMAbstractFactory.getSOAP12Factory();

+                    log.debug("Starting to process SOAP 1.2 message");

+                } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(namespaceURI)) {

+                    soapFactory = OMAbstractFactory.getSOAP11Factory();

+                    log.debug("Starting to process SOAP 1.1 message");

+                } else {

+                    throw new SOAPProcessingException("Only SOAP 1.1 or SOAP 1.2 messages are supported in the" +

+                            " system", SOAPConstants.FAULT_CODE_VERSION_MISMATCH);

+                }

+            }

+

+            // create a SOAPMessage to hold the SOAP envelope and assign the SOAP envelope in that.

+            soapMessage = soapFactory.createSOAPMessage(this);

+            this.document = soapMessage;

+            if (charEncoding != null) {

+            	document.setCharsetEncoding(charEncoding);

+             }

+

+            envelope = soapFactory.createSOAPEnvelope(this);

+            element = envelope;

+            processNamespaceData(element, true);

+            // fill in the attributes

+            processAttributes(element);

+

+        } else if (elementLevel == 2) {

+

+            // this is either a header or a body

+            if (elementName.equals(SOAPConstants.HEADER_LOCAL_NAME)) {

+                if (headerPresent) {

+                    throw new SOAPProcessingException("Multiple headers encountered!", getSenderFaultCode());

+                }

+                if (bodyPresent) {

+                    throw new SOAPProcessingException("Header Body wrong order!", getSenderFaultCode());

+                }

+                headerPresent = true;

+                element =

+                        soapFactory.createSOAPHeader((SOAPEnvelope) parent,

+                                this);

+

+                processNamespaceData(element, true);

+                processAttributes(element);

+

+            } else if (elementName.equals(SOAPConstants.BODY_LOCAL_NAME)) {

+                if (bodyPresent) {

+                    throw new SOAPProcessingException("Multiple body elements encountered", getSenderFaultCode());

+                }

+                bodyPresent = true;

+                element =

+                        soapFactory.createSOAPBody((SOAPEnvelope) parent,

+                                this);

+

+                processNamespaceData(element, true);

+                processAttributes(element);

+

+            } else {

+                throw new SOAPProcessingException(elementName

+                        +

+                        " is not supported here. Envelope can not have elements other than Header and Body.", getSenderFaultCode());

+            }

+        } else if ((elementLevel == 3)

+                &&

+                parent.getLocalName().equalsIgnoreCase(SOAPConstants.HEADER_LOCAL_NAME)) {

+

+            // this is a headerblock

+            try {

+                element =

+                        soapFactory.createSOAPHeaderBlock(elementName, null,

+                                (SOAPHeader) parent, this);

+            } catch (SOAPProcessingException e) {

+                throw new SOAPProcessingException("Can not create SOAPHeader block", getReceiverFaultCode(), e);

+            }

+            processNamespaceData(element, false);

+            processAttributes(element);

+

+        } else if ((elementLevel == 3) &&

+                parent.getLocalName().equalsIgnoreCase(SOAPConstants.BODY_LOCAL_NAME) &&

+                elementName.equalsIgnoreCase(SOAPConstants.BODY_FAULT_LOCAL_NAME)) {

+

+            // this is a headerblock

+            element = soapFactory.createSOAPFault((SOAPBody) parent, this);

+            processNamespaceData(element, false);

+            processAttributes(element);

+

+

+            processingFault = true;

+            if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(envelopeNamespace.getNamespaceURI())) {

+                builderHelper = new SOAP12BuilderHelper(this);

+            } else

+            if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(envelopeNamespace.getNamespaceURI())) {

+                builderHelper = new SOAP11BuilderHelper(this);

+            }

+

+        } else if (elementLevel > 3 && processingFault) {

+            element = builderHelper.handleEvent(parser, parent, elementLevel);

+        } else {

+

+            // this is neither of above. Just create an element

+            element = soapFactory.createOMElement(elementName, null,

+                    parent, this);

+            processNamespaceData(element, false);

+            processAttributes(element);

+

+        }

+        return element;

+    }

+

+    private String getSenderFaultCode() {

+        if (senderfaultCode == null) {

+            senderfaultCode = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(envelopeNamespace.getNamespaceURI()) ? SOAP12Constants.FAULT_CODE_SENDER : SOAP11Constants.FAULT_CODE_SENDER;

+        }

+        return senderfaultCode;

+    }

+

+    private String getReceiverFaultCode() {

+        if (receiverfaultCode == null) {

+            receiverfaultCode = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(envelopeNamespace.getNamespaceURI()) ? SOAP12Constants.FAULT_CODE_RECEIVER : SOAP11Constants.FAULT_CODE_RECEIVER;

+        }

+        return receiverfaultCode;

+    }

+

+    public void endElement() {

+        if (lastNode.isComplete()) {

+            OMElement parent = (OMElement) lastNode.getParent();

+            ((OMNodeEx) parent).setComplete(true);

+            lastNode = parent;

+        } else {

+            OMNode e = lastNode;

+            ((OMNodeEx) e).setComplete(true);

+        }

+        elementLevel--;

+    }

+

+    /**

+     * Method createDTD.

+     * Overriding the default behaviour as a SOAPMessage should not have a DTD.

+     */

+    protected OMNode createDTD() throws OMException {

+        throw new OMException("SOAP message MUST NOT contain a Document Type Declaration(DTD)");

+    }

+

+    /**

+     * Method createPI.

+     * Overriding the default behaviour as a SOAP Message should not have a PI.

+     */

+    protected OMNode createPI() throws OMException {

+        throw new OMException("SOAP message MUST NOT contain Processing Instructions(PI)");

+    }

+

+    /**

+     * Method getDocumentElement.

+     *

+     * @return Returns OMElement.

+     */

+    public OMElement getDocumentElement() {

+        return getSOAPEnvelope();

+    }

+

+    /**

+     * Method processNamespaceData.

+     *

+     * @param node

+     * @param isSOAPElement

+     */

+    protected void processNamespaceData(OMElement node, boolean isSOAPElement) {

+

+        super.processNamespaceData(node);

+

+        if (isSOAPElement) {

+            if (node.getNamespace() != null &&

+                    !node.getNamespace().getNamespaceURI().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI) &&

+                    !node.getNamespace().getNamespaceURI().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI))

+            {

+                throw new SOAPProcessingException("invalid SOAP namespace URI. " +

+                        "Only " + SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI +

+                        " and " + SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI +

+                        " are supported.", SOAP12Constants.FAULT_CODE_SENDER);

+            }

+        }

+

+    }

+

+/*these three methods to set and check detail element processing or mandatory fault element are present

+*/

+

+    public OMNamespace getEnvelopeNamespace() {

+        return envelopeNamespace;

+    }

+

+    public boolean isProcessingDetailElements() {

+        return processingDetailElements;

+    }

+

+    public void setProcessingDetailElements(boolean value) {

+        processingDetailElements = value;

+    }

+

+    public SOAPMessage getSoapMessage() {

+        return soapMessage;

+    }

+

+    public OMDocument getDocument() {

+        return this.soapMessage;

+    }

+

+    /**

+     * @return Returns the soapFactory.

+     */

+    protected SOAPFactory getSoapFactory() {

+        return soapFactory;

+    }

+

+}

diff --git a/axiom/modules/axiom-dom/pom.xml b/axiom/modules/axiom-dom/pom.xml
new file mode 100644
index 0000000..e289e00
--- /dev/null
+++ b/axiom/modules/axiom-dom/pom.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+    xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.ws.commons.axiom</groupId>
+    <artifactId>axiom-parent</artifactId>
+    <version>SNAPSHOT</version> <!-- Should better be ${axiom.version} -->
+  </parent>
+  <artifactId>axiom-dom</artifactId>
+  <name>Axiom DOM</name>
+  <description>The Axiom DOM implementation.</description>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.ws.commons.axiom</groupId>
+      <artifactId>axiom-api</artifactId>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
new file mode 100644
index 0000000..acf6c60
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
@@ -0,0 +1,406 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMConstants;
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
+import org.w3c.dom.Attr;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.TypeInfo;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * Implementation of <code>org.w3c.dom.Attr</code> and
+ * <code>org.apache.axiom.om.OMAttribute</code>
+ */
+public class AttrImpl extends NodeImpl implements OMAttribute, Attr {
+
+    /**
+     * Name of the attribute
+     */
+    private String attrName;
+
+    /**
+     * Attribute value
+     */
+    private TextImpl attrValue;
+
+    /**
+     * Attribute namespace
+     */
+    private NamespaceImpl namespace;
+
+    /**
+     * Flag to indicate whether this attr is used or not
+     */
+    private boolean used;
+
+    /**
+     * Owner of this attribute
+     */
+    protected ParentNode parent;
+
+    /**
+     * Flag used to mark an attribute as per the DOM Level 3 specification
+     */
+    protected boolean isId;
+    
+    protected AttrImpl(DocumentImpl ownerDocument, OMFactory factory) {
+        super(ownerDocument, factory);
+    }
+
+    public AttrImpl(DocumentImpl ownerDocument, String localName,
+                    OMNamespace ns, String value, OMFactory factory) {
+        super(ownerDocument, factory);
+        this.attrName = localName;
+        this.attrValue = new TextImpl(ownerDocument, value, factory);
+        this.namespace = (NamespaceImpl) ns;
+    }
+
+    public AttrImpl(DocumentImpl ownerDocument, String name, String value,
+                    OMFactory factory) {
+        super(ownerDocument, factory);
+        this.attrName = name;
+        this.attrValue = new TextImpl(ownerDocument, value, factory);
+    }
+
+    public AttrImpl(DocumentImpl ownerDocument, String name, OMFactory factory) {
+        super(ownerDocument, factory);
+        this.attrName = name;
+        //If this is a default namespace attr
+        if(OMConstants.XMLNS_NS_PREFIX.equals(name)) {
+            this.namespace = new NamespaceImpl(
+                    OMConstants.XMLNS_NS_URI, OMConstants.XMLNS_NS_PREFIX);
+        }
+    }
+
+    public AttrImpl(DocumentImpl ownerDocument, String localName,
+                    OMNamespace namespace, OMFactory factory) {
+        super(ownerDocument, factory);
+        this.attrName = localName;
+        this.namespace = (NamespaceImpl) namespace;
+    }
+
+    // /
+    // /org.w3c.dom.Node methods
+    // /
+    /**
+     * Returns the name of this attribute.
+     */
+    public String getNodeName() {
+        return (this.namespace != null
+                && !"".equals(this.namespace.getPrefix()) && !(OMConstants.XMLNS_NS_PREFIX.equals(this.attrName)))
+                ? this.namespace.getPrefix()+ ":" + this.attrName
+                : this.attrName;
+    }
+
+    /**
+     * Returns the node type.
+     * 
+     * @see org.w3c.dom.Node#getNodeType()
+     */
+    public short getNodeType() {
+        return Node.ATTRIBUTE_NODE;
+    }
+
+    /**
+     * Returns the value of this attribute.
+     * 
+     * @see org.w3c.dom.Node#getNodeValue()
+     */
+    public String getNodeValue() throws DOMException {
+        return (this.attrValue == null) ? "" : this.attrValue.getData();
+    }
+
+    /**
+     * Returns the value of this attribute.
+     * 
+     * @see org.w3c.dom.Attr#getValue()
+     */
+    public String getValue() {
+        return (this.attrValue == null) ? null : this.attrValue.getText();
+    }
+
+    // /
+    // /org.w3c.dom.Attr methods
+    // /
+    public String getName() {
+        return (this.namespace == null) ? this.attrName
+                : OMConstants.XMLNS_NS_PREFIX + ":" + this.attrName;
+    }
+
+    /**
+     * Returns the owner element.
+     * 
+     * @see org.w3c.dom.Attr#getOwnerElement()
+     */
+    public Element getOwnerElement() {
+        // Owned is set to an element instance when the attribute is added to an
+        // element
+        return (Element) (isOwned() ? parent : null);
+    }
+
+    public boolean getSpecified() {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    /**
+     * Not supported: Cannot detach attributes. Use the operations available in
+     * the owner node.
+     * 
+     * @see org.apache.axiom.om.OMNode#detach()
+     */
+    public OMNode detach() throws OMException {
+        throw new UnsupportedOperationException("Not supported");
+    }
+
+    /**
+     * Not supported: Cannot discard attributes. Use the operations available in
+     * the owner node.
+     * 
+     * @see org.apache.axiom.om.OMNode#discard()
+     */
+    public void discard() throws OMException {
+        throw new UnsupportedOperationException("Not supported");
+    }
+
+    /**
+     * Returns the type of this attribute node.
+     * 
+     * @see org.apache.axiom.om.OMNode#getType()
+     */
+    public int getType() {
+        return -1;
+    }
+
+    /**
+     * This is not supported since attributes serialization is handled by the
+     * serialization of the owner nodes.
+     */
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
+        throw new UnsupportedOperationException("Not supported");
+    }
+
+    /**
+     * This is not supported since attributes serialization is handled by the
+     * serialization of the owner nodes.
+     * 
+     * @see org.apache.axiom.om.impl.OMNodeEx#internalSerializeAndConsume
+     * (org.apache.axiom.om.impl.MTOMXMLStreamWriter)
+     */
+    public void internalSerializeAndConsume(XMLStreamWriter writer)
+            throws XMLStreamException {
+        throw new UnsupportedOperationException("Not supported");
+    }
+
+    /**
+     * Returns the namespace of the attribute as an <code>OMNamespace</code>.
+     * 
+     * @see org.apache.axiom.om.OMAttribute#getNamespace()
+     */
+    public OMNamespace getNamespace() {
+        return this.namespace;
+    }
+
+    /**
+     * Returns a qname representing the attribute.
+     * 
+     * @see org.apache.axiom.om.OMAttribute#getQName()
+     */
+    public QName getQName() {
+        return (this.namespace == null) ? new QName(this.attrName) : new QName(
+                this.namespace.getNamespaceURI(), this.attrName, this.namespace
+                        .getPrefix());
+
+    }
+
+    /**
+     * Returns the attribute value.
+     * 
+     * @see org.apache.axiom.om.OMAttribute#getAttributeValue()
+     */
+    public String getAttributeValue() {
+        return this.attrValue.getText();
+    }
+
+    /**
+     * Sets the name of attribute.
+     * 
+     * @see org.apache.axiom.om.OMAttribute#setLocalName(java.lang.String)
+     */
+    public void setLocalName(String localName) {
+        this.attrName = localName;
+    }
+
+    /**
+     * Sets the namespace of this attribute node.
+     * 
+     * @see org.apache.axiom.om.OMAttribute#setOMNamespace
+     * (org.apache.axiom.om.OMNamespace)
+     */
+    public void setOMNamespace(OMNamespace omNamespace) {
+        this.namespace = (NamespaceImpl) omNamespace;
+    }
+
+    /**
+     * Sets the attribute value.
+     * 
+     * @see org.apache.axiom.om.OMAttribute#setAttributeValue(java.lang.String)
+     */
+    public void setAttributeValue(String value) {
+        if (isReadonly()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NO_MODIFICATION_ALLOWED_ERR", null);
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    msg);
+        }
+        this.attrValue = (TextImpl) this.getOwnerDocument().createTextNode(
+                value);
+    }
+
+    /**
+     * Sets the parent element to the given OMContainer.
+     * 
+     * @see org.apache.axiom.om.impl.OMNodeEx#setParent
+     * (org.apache.axiom.om.OMContainer)
+     */
+    public void setParent(OMContainer element) {
+        this.parent = (ParentNode) element;
+    }
+
+    /**
+     * Sets the type. NOT IMPLEMENTED: Unnecessary.
+     * 
+     * @see org.apache.axiom.om.impl.OMNodeEx#setType(int)
+     */
+    public void setType(int nodeType) throws OMException {
+        // not necessary ???
+    }
+
+    /**
+     * @return Returns boolean.
+     */
+    protected boolean isUsed() {
+        return used;
+    }
+
+    /**
+     * @param used
+     *            The used to set.
+     */
+    protected void setUsed(boolean used) {
+        this.used = used;
+    }
+
+    /**
+     * Sets the value of the attribute.
+     * 
+     * @see org.w3c.dom.Attr#setValue(java.lang.String)
+     */
+    public void setValue(String value) throws DOMException {
+        this.attrValue = (TextImpl) this.getOwnerDocument().createTextNode(
+                value);
+    }
+
+    /**
+     * Returns the parent node of this attribute.
+     * 
+     * @see org.apache.axiom.om.OMNode#getParent()
+     */
+    public OMContainer getParent() {
+        return this.parent;
+    }
+
+    /**
+     * Returns the attribute name.
+     * 
+     * @see org.w3c.dom.Node#getLocalName()
+     */
+    public String getLocalName() {
+        return (this.namespace == null) ? this.attrName : DOMUtil
+                .getLocalName(this.attrName);
+    }
+
+    /**
+     * Returns the namespace URI of this attr node.
+     * 
+     * @see org.w3c.dom.Node#getNamespaceURI()
+     */
+    public String getNamespaceURI() {
+        if (this.namespace != null) {
+            return namespace.getNamespaceURI();
+        }
+        return null;
+    }
+
+    /**
+     * Returns the namespace prefix of this attr node.
+     * 
+     * @see org.w3c.dom.Node#getPrefix()
+     */
+    public String getPrefix() {
+        // TODO Error checking
+        return (this.namespace == null) ? null : this.namespace.getPrefix();
+    }
+
+    public Node cloneNode(boolean deep) {
+
+        AttrImpl clone = (AttrImpl) super.cloneNode(deep);
+
+        if (clone.attrValue == null) {
+            // Need to break the association w/ original kids
+            clone.attrValue = new TextImpl(this.attrValue.toString(), factory);
+            if (this.attrValue.nextSibling != null) {
+                throw new UnsupportedOperationException(
+                        "Attribute value can contain only a text " +
+                        "node with out any siblings");
+            }
+        }
+        clone.isSpecified(true);
+        return clone;
+    }
+
+    /*
+     * DOM-Level 3 methods
+     */
+    public TypeInfo getSchemaTypeInfo() {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public boolean isId() {
+        return isId;
+    }
+
+    public String toString() {
+        return (this.namespace == null) ? this.attrName : this.namespace
+                .getPrefix()
+                + ":" + this.attrName;
+    }
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java
new file mode 100644
index 0000000..9b096b4
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttributeMap.java
@@ -0,0 +1,227 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Node;
+
+import java.util.Vector;
+
+public class AttributeMap extends NamedNodeMapImpl {
+
+    /**
+     * @param ownerNode
+     */
+    protected AttributeMap(ParentNode ownerNode) {
+        super(ownerNode);
+    }
+
+    public Node removeNamedItem(String name) throws DOMException {
+        // TODO Set used to false
+        return super.removeNamedItem(name);
+    }
+
+    public Node removeNamedItemNS(String namespaceURI, String name)
+            throws DOMException {
+        // TODO
+        return super.removeNamedItemNS(namespaceURI, name);
+    }
+
+    /**
+     * Almost a copy of the Xerces impl.
+     */
+    public Node setNamedItem(Node attribute) throws DOMException {
+
+        if (isReadOnly()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NO_MODIFICATION_ALLOWED_ERR", null);
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    msg);
+        }
+        if (attribute.getOwnerDocument() != ownerNode.getOwnerDocument()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null);
+            throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, msg);
+        }
+        if (attribute.getNodeType() != Node.ATTRIBUTE_NODE) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN, "HIERARCHY_REQUEST_ERR",
+                    null);
+            throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, msg);
+        }
+
+        AttrImpl attr = (AttrImpl) attribute;
+        if (attr.isOwned()) { // If the attribute is owned then:
+            if (attr.getOwnerElement() != this.ownerNode) // the owner must be
+                                                            // the owner of this
+                                                            // list
+                throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR,
+                        DOMMessageFormatter.formatMessage(
+                                DOMMessageFormatter.DOM_DOMAIN,
+                                "INUSE_ATTRIBUTE_ERR", null));
+            else
+                return attr; // No point adding the 'same' attr again to the
+                                // same element
+        }
+
+        attr.parent = this.ownerNode; // Set the owner node
+        attr.isOwned(true); // To indicate that this attr belong to an element
+        attr.setUsed(true); // Setting used to true
+
+        int i = findNamePoint(attr.getNodeName(), 0);
+
+        AttrImpl previous = null;
+        if (i >= 0) { // There's an attribute already with this attr's name
+            previous = (AttrImpl) nodes.elementAt(i);
+            nodes.setElementAt(attr, i);
+            previous.parent = this.ownerNode;
+            previous.isOwned(false);
+
+            // make sure it won't be mistaken with defaults in case it's reused
+            previous.isSpecified(true);
+        } else {
+            i = -1 - i; // Insert point (may be end of list)
+            if (null == nodes) {
+                nodes = new Vector(5, 10);
+            }
+            nodes.insertElementAt(attr, i);
+        }
+
+        // - Not sure whether we really need this
+        // // notify document
+        // ownerNode.getOwnerDocument().setAttrNode(attr, previous);
+
+        // If the new attribute is not normalized,
+        // the owning element is inherently not normalized.
+        if (!attr.isNormalized()) {
+            ownerNode.isNormalized(false);
+        }
+        return previous;
+
+    }
+
+    /**
+     * Almost a copy of the Xerces impl.
+     */
+    public Node setNamedItemNS(Node attribute) throws DOMException {
+        if (isReadOnly()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NO_MODIFICATION_ALLOWED_ERR", null);
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    msg);
+        }
+        if (attribute.getOwnerDocument() != ownerNode.getOwnerDocument()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null);
+            throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, msg);
+        }
+        if (attribute.getNodeType() != Node.ATTRIBUTE_NODE) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN, "HIERARCHY_REQUEST_ERR",
+                    null);
+            throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, msg);
+        }
+
+        AttrImpl attr = (AttrImpl) attribute;
+        if (attr.isOwned()) { // If the attribute is owned then:
+            //the owner must be the owner of this list
+            if (attr.getOwnerElement() != this.ownerNode) 
+                throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR,
+                        DOMMessageFormatter.formatMessage(
+                                DOMMessageFormatter.DOM_DOMAIN,
+                                "INUSE_ATTRIBUTE_ERR", null));
+            else
+                return attr; // No point adding the 'same' attr again to the
+                                // same element
+        }
+        //Set the owner node
+        attr.ownerNode = (DocumentImpl) this.ownerNode.getOwnerDocument(); 
+        attr.isOwned(true); // To indicate that this attr belong to an element
+
+        int i = findNamePoint(attr.getNamespaceURI(), attr.getLocalName());
+        AttrImpl previous = null;
+
+        if (i >= 0) {
+            previous = (AttrImpl) nodes.elementAt(i);
+            nodes.setElementAt(attr, i);
+            previous.ownerNode = (DocumentImpl) this.ownerNode
+                    .getOwnerDocument();
+            previous.isOwned(false);
+            // make sure it won't be mistaken with defaults in case it's reused
+            previous.isSpecified(true);
+        } else {
+            // If we can't find by namespaceURI, localName, then we find by
+            // nodeName so we know where to insert.
+            i = findNamePoint(attr.getNodeName(), 0);
+            if (i >= 0) {
+                previous = (AttrImpl) nodes.elementAt(i);
+                nodes.insertElementAt(attr, i);
+            } else {
+                i = -1 - i; // Insert point (may be end of list)
+                if (null == nodes) {
+                    nodes = new Vector(5, 10);
+                }
+                nodes.insertElementAt(attr, i);
+            }
+        }
+
+        // If the new attribute is not normalized,
+        // the owning element is inherently not normalized.
+        if (!attr.isNormalized()) {
+            ownerNode.isNormalized(false);
+        }
+        return previous;
+    }
+
+    /**
+     * BORROWED from Xerces impl. Cloning a NamedNodeMap is a DEEP OPERATION; it
+     * always clones all the nodes contained in the map.
+     */
+
+    public NamedNodeMapImpl cloneMap(NodeImpl ownerNode) {
+        AttributeMap newmap = new AttributeMap((ParentNode) ownerNode);
+        newmap.hasDefaults(hasDefaults());
+        newmap.cloneContent(this);
+        return newmap;
+    } // cloneMap():AttributeMap
+
+    /**
+     * BORROWED from Xerces impl.
+     */
+    protected void cloneContent(NamedNodeMapImpl srcmap) {
+        Vector srcnodes = srcmap.nodes;
+        if (srcnodes != null) {
+            int size = srcnodes.size();
+            if (size != 0) {
+                if (nodes == null) {
+                    nodes = new Vector(size);
+                }
+                nodes.setSize(size);
+                for (int i = 0; i < size; ++i) {
+                    NodeImpl n = (NodeImpl) srcnodes.elementAt(i);
+                    NodeImpl clone = (NodeImpl) n.cloneNode(true);
+                    clone.isSpecified(n.isSpecified());
+                    nodes.setElementAt(clone, i);
+                    clone.ownerNode = this.ownerNode.ownerNode;
+                    clone.isOwned(true);
+                }
+            }
+        }
+    } // cloneContent():AttributeMap
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CharacterImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CharacterImpl.java
new file mode 100644
index 0000000..a026b1d
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CharacterImpl.java
@@ -0,0 +1,174 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.OMFactory;
+import org.w3c.dom.CharacterData;
+import org.w3c.dom.DOMException;
+
+/**
+ * This implements the OMText operations which are to be inherited by 
+ * TextImpl, CommentImpl, CDATASectionImpl.
+ */
+public abstract class CharacterImpl extends ChildNode implements CharacterData {
+
+	protected StringBuffer textValue;
+	
+	protected CharacterImpl(OMFactory factory) {
+        super(factory);
+	}
+	
+	/**
+	 * @param ownerNode
+	 */
+	public CharacterImpl(DocumentImpl ownerNode, OMFactory factory) {
+		super(ownerNode, factory);
+	}
+
+	public CharacterImpl(DocumentImpl ownerNode, String value, OMFactory factory){
+		super(ownerNode, factory);
+        this.textValue = (value != null) ? new StringBuffer(value)
+                : new StringBuffer("");
+	}
+	
+	///
+	///org.w3c.dom.CharacterData mrthods
+	///
+	
+	public void appendData(String value) throws DOMException {
+		
+		if (this.isReadonly()) {
+			throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+					DOMMessageFormatter.formatMessage(
+							DOMMessageFormatter.DOM_DOMAIN,
+							"NO_MODIFICATION_ALLOWED_ERR", null));
+		}
+		
+		this.textValue.append(value);
+	}
+	
+	/**
+	 * 
+	 */
+	public void deleteData(int offset, int count) throws DOMException {
+		this.replaceData(offset,count,null);
+	}
+	
+	/**
+	 * If the given data is null the content will be deleted.
+	 */
+	public void replaceData(int offset, int count, String data) throws
+                                                             DOMException {
+		
+		if (this.isReadonly()) {
+			throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+					DOMMessageFormatter.formatMessage(
+							DOMMessageFormatter.DOM_DOMAIN,
+							"NO_MODIFICATION_ALLOWED_ERR", null));
+		}
+			
+		int length = this.textValue.length();
+		if (offset < 0 || offset > length - 1 || count < 0) {
+			throw new DOMException(DOMException.INDEX_SIZE_ERR,
+					DOMMessageFormatter.formatMessage(
+							DOMMessageFormatter.DOM_DOMAIN, "INDEX_SIZE_ERR",
+							null));
+		} else {
+
+			int end = Math.min(count + offset, length);
+
+			if (data == null) {
+				this.textValue.delete(offset, end);
+			} else {
+				this.textValue.replace(offset, end, data);
+			}
+		}
+
+	}
+	
+	
+	
+	/**
+	 * Returns the value of the data.
+	 */
+	public String getData() throws DOMException {
+		return (this.textValue != null) ? this.textValue.toString() : "";
+	}
+	
+	/**
+	 * Inserts a string at the specified offset.
+	 */
+	public void insertData(int offset, String data) throws DOMException {
+		int length = this.getLength();
+		
+		if (this.isReadonly()) {
+			throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+					DOMMessageFormatter.formatMessage(
+							DOMMessageFormatter.DOM_DOMAIN,
+							"NO_MODIFICATION_ALLOWED_ERR", null));
+		}
+		
+		if(offset < 0 || offset > length-1) {
+			throw new DOMException(DOMException.INDEX_SIZE_ERR,
+					DOMMessageFormatter.formatMessage(
+							DOMMessageFormatter.DOM_DOMAIN,
+							"INDEX_SIZE_ERR", null));
+		}
+		
+		this.textValue.insert(offset,data);
+
+	}
+
+	/**
+	 * Sets the text value of data.
+	 */
+	public void setData(String data) throws DOMException {
+		if (!this.isReadonly()) {
+			this.textValue.replace(0,this.getLength(), data);
+		} else {
+			throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+					DOMMessageFormatter.formatMessage(
+							DOMMessageFormatter.DOM_DOMAIN,
+							"NO_MODIFICATION_ALLOWED_ERR", null));
+		}
+	}
+	
+	/**
+	 * Extracts a range of data from the node.
+	 * @return Returns the specified substring. If the sum of offset and count 
+     * exceeds the length, then all 16-bit units to the end of the data are 
+     * returned.
+	 */
+	public String substringData(int offset, int count) throws DOMException {
+		if(offset < 0 || offset > this.getLength() || count < 0) {
+			throw new DOMException(DOMException.INDEX_SIZE_ERR,
+					DOMMessageFormatter.formatMessage(
+							DOMMessageFormatter.DOM_DOMAIN,
+							"INDEX_SIZE_ERR", null));
+		}
+		
+		int end = Math.min( count + offset, textValue.length());
+		return this.textValue.substring(offset, end);
+	}
+	
+	/**
+	 * Returns the length of the string value.
+	 */
+	public int getLength() {
+		return (this.textValue != null) ? this.textValue.length() : 0;
+	}
+		
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java
new file mode 100644
index 0000000..f7bfe6d
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ChildNode.java
@@ -0,0 +1,217 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.w3c.dom.Node;
+
+public abstract class ChildNode extends NodeImpl {
+
+    protected ChildNode previousSibling;
+
+    protected ChildNode nextSibling;
+
+    protected ParentNode parentNode;
+
+    /**
+     * @param ownerDocument
+     */
+    protected ChildNode(DocumentImpl ownerDocument, OMFactory factory) {
+        super(ownerDocument, factory);
+    }
+
+    protected ChildNode(OMFactory factory) {
+        super(factory);
+    }
+
+    public OMNode getNextOMSibling() throws OMException {
+        while ((nextSibling == null) && !this.parentNode.done) {
+            this.parentNode.buildNext();
+        }
+        return nextSibling;
+    }
+
+    public Node getNextSibling() {
+        return (Node) this.getNextOMSibling();
+    }
+
+    public OMNode getPreviousOMSibling() {
+        return this.previousSibling;
+    }
+
+    public Node getPreviousSibling() {
+        return this.previousSibling;
+    }
+
+    // /
+    // /OMNode methods
+    // /
+    public void setNextOMSibling(OMNode node) {
+        if (node == null) {
+            this.nextSibling = null;
+            return;
+        }
+        if (node instanceof ChildNode) {
+            this.nextSibling = (ChildNode) node;
+        } else {
+            throw new OMException("The node is not a " + ChildNode.class);
+        }
+    }
+
+    public void setPreviousOMSibling(OMNode node) {
+        if (node == null) {
+            this.previousSibling = null;
+            return;
+        }
+        if (node instanceof ChildNode) {
+            this.previousSibling = (ChildNode) node;
+        } else {
+            throw new OMException("The node is not a " + ChildNode.class);
+        }
+    }
+
+    public OMContainer getParent() throws OMException {
+        return this.parentNode;
+    }
+
+    public Node getParentNode() {
+        return this.parentNode;
+    }
+
+    public void setParent(OMContainer element) {
+        if (element instanceof ParentNode) {
+            this.parentNode = (ParentNode) element;
+        } else {
+            throw new OMException("The given parent is not of the type "
+                                  + ParentNode.class);
+        }
+
+    }
+
+    public OMNode detach() throws OMException {
+        if (this.parentNode == null) {
+            throw new OMException("Parent level elements cannot be detached");
+        } else {
+            if (!done) {
+                build();
+            }
+            if (previousSibling == null) { // This is the first child
+                if (nextSibling != null) {
+                    this.parentNode.setFirstChild(nextSibling);
+                } else {
+                    this.parentNode.firstChild = null;
+                    this.parentNode.lastChild = null;
+                }
+            } else {
+                this.previousSibling.setNextOMSibling(nextSibling);
+                if(nextSibling == null){
+                    this.previousSibling.parentNode.done = true;
+                }
+            }
+            if (this.nextSibling != null) {
+                this.nextSibling.setPreviousOMSibling(this.previousSibling);
+            }
+            if (this.parentNode != null && this.parentNode.lastChild == this) {
+                this.parentNode.lastChild = previousSibling;
+            }
+            this.parentNode = null;
+        }
+        return this;
+    }
+
+    public void discard() throws OMException {
+        throw new UnsupportedOperationException("Cannot discard this node");
+    }
+
+    /**
+     * Inserts the given sibling next to this item.
+     */
+    public void insertSiblingAfter(OMNode sibling) throws OMException {
+
+        if (this.parentNode != null) {
+            ((OMNodeEx) sibling).setParent(this.parentNode);
+        } else if(this == sibling){
+            throw new OMException("Inserting self as the sibling is not allowed");
+        }
+
+        if (sibling instanceof ChildNode) {
+            ChildNode domSibling = (ChildNode) sibling;
+            domSibling.previousSibling = this;
+            if (this.nextSibling != null) {
+                this.nextSibling.previousSibling = domSibling;
+            }
+            domSibling.nextSibling = this.nextSibling;
+            this.nextSibling = domSibling;
+
+        } else {
+            throw new OMException("The given child is not of type "
+                                  + ChildNode.class);
+        }
+    }
+
+    /**
+     * Inserts the given sibling before this item.
+     */
+    public void insertSiblingBefore(OMNode sibling) throws OMException {
+        // ((OMNodeEx)sibling).setParent(this.parentNode);
+        if(this == sibling){
+            throw new OMException("Inserting self as the sibling is not allowed");
+        }
+        if (sibling instanceof ChildNode) {
+            // ChildNode domSibling = (ChildNode)sibling;
+            // domSibling.nextSibling = this;
+            // if(this.previousSibling != null) {
+            // this.previousSibling.nextSibling = domSibling;
+            // }
+            // domSibling.previousSibling = this.previousSibling;
+            // this.previousSibling = domSibling;
+            ChildNode siblingImpl = (ChildNode) sibling;
+            siblingImpl.nextSibling = this;
+            if (previousSibling == null) {
+                this.parentNode.setFirstChild(siblingImpl);
+                siblingImpl.previousSibling = null;
+            } else {
+                siblingImpl.setParent(this.parentNode);
+                previousSibling.setNextOMSibling(siblingImpl);
+                siblingImpl.setPreviousOMSibling(previousSibling);
+            }
+            previousSibling = siblingImpl;
+
+        } else {
+            throw new OMException("The given child is not of type "
+                                  + ChildNode.class);
+        }
+
+    }
+
+    public Node cloneNode(boolean deep) {
+
+        ChildNode newnode = (ChildNode) super.cloneNode(deep);
+
+        // Need to break the association w/ original kids
+        newnode.previousSibling = null;
+        newnode.nextSibling = null;
+        newnode.isFirstChild(false);
+        newnode.parentNode = null;
+
+        return newnode;
+    }
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CommentImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CommentImpl.java
new file mode 100644
index 0000000..5364808
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/CommentImpl.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.OMComment;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNode;
+import org.w3c.dom.Comment;
+import org.w3c.dom.Node;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class CommentImpl extends CharacterImpl implements Comment, OMComment {
+
+    public CommentImpl(DocumentImpl ownerNode, OMFactory factory) {
+        super(ownerNode, factory);
+        this.done = true;
+    }
+
+    public CommentImpl(DocumentImpl ownerNode, String value, OMFactory factory) {
+        super(ownerNode, value, factory);
+        this.done = true;
+    }
+
+    public String getNodeName() {
+        return "#comment";
+    }
+
+    public short getNodeType() {
+        return Node.COMMENT_NODE;
+    }
+
+    public String getValue() {
+        return this.getData();
+    }
+
+    public void setValue(String text) {
+        this.textValue.delete(0, this.textValue.length());
+        this.textValue.append(text);
+    }
+
+    public int getType() {
+        return OMNode.COMMENT_NODE;
+    }
+
+    public void setType(int nodeType) throws OMException {
+        throw new UnsupportedOperationException(
+                "You should not set the node type of a comment");
+    }
+
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
+        writer.writeComment(this.textValue.toString());
+    }
+
+    public void internalSerializeAndConsume(XMLStreamWriter writer)
+            throws XMLStreamException {
+        internalSerialize(writer);
+    }
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMImplementationImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMImplementationImpl.java
new file mode 100644
index 0000000..3048770
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMImplementationImpl.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentType;
+
+public class DOMImplementationImpl implements DOMImplementation {
+
+    public boolean hasFeature(String arg0, String arg1) {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public Document createDocument(String namespaceURI, String qualifiedName,
+            DocumentType doctype) throws DOMException {
+        
+        // TODO Handle docType stuff
+        OMDOMFactory fac = new OMDOMFactory();
+        DocumentImpl doc = new DocumentImpl(fac);
+        fac.setDocument(doc);
+
+        new ElementImpl(doc, DOMUtil.getLocalName(qualifiedName),
+                new NamespaceImpl(namespaceURI, DOMUtil
+                        .getPrefix(qualifiedName)),fac);
+
+        return doc;
+    }
+
+    public DocumentType createDocumentType(String qualifiedName,
+            String publicId, String systemId) throws DOMException {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    /*
+     * DOM-Level 3 methods
+     */
+
+    public Object getFeature(String arg0, String arg1) {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMMessageFormatter.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMMessageFormatter.java
new file mode 100644
index 0000000..9658f6d
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMMessageFormatter.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.dom;
+
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.PropertyResourceBundle;
+import java.util.ResourceBundle;
+
+/**
+ * Used to format DOM error messages, using the system locale.
+ */
+public class DOMMessageFormatter {
+    public static final String DOM_DOMAIN = "http://www.w3.org/dom/DOMTR";
+
+    public static final String XML_DOMAIN = 
+                                "http://www.w3.org/TR/1998/REC-xml-19980210";
+
+    public static final String SERIALIZER_DOMAIN = 
+                                "http://apache.org/xml/serializer";
+
+    private static ResourceBundle domResourceBundle = null;
+
+    private static ResourceBundle xmlResourceBundle = null;
+
+    private static ResourceBundle serResourceBundle = null;
+
+    private static Locale locale = null;
+
+    public static final String LEVEL3_NOT_SUPPORTED = 
+                                "DOM Level 3 operations are not supported";
+
+    public static final String NOT_REQUIRED_FOR_XMLSEC_OR_WSS4J = 
+            "This method is not required by Apache XML-Security Impl or WSS4J";
+
+    DOMMessageFormatter() {
+        locale = Locale.getDefault();
+    }
+
+    /**
+     * Formats a message with the specified arguments using the given locale
+     * information.
+     * 
+     * @param domain
+     *            domain from which error string is to come.
+     * @param key
+     *            The message key.
+     * @param arguments
+     *            The message replacement text arguments. The order of the
+     *            arguments must match that of the placeholders in the actual
+     *            message.
+     * 
+     * @return Returns the formatted message.
+     * 
+     * @throws MissingResourceException
+     *             Thrown if the message with the specified key cannot be found.
+     */
+    public static String formatMessage(String domain, String key,
+            Object[] arguments) throws MissingResourceException {
+        ResourceBundle resourceBundle = getResourceBundle(domain);
+        if (resourceBundle == null) {
+            init();
+            resourceBundle = getResourceBundle(domain);
+            if (resourceBundle == null)
+                throw new MissingResourceException("Unknown domain" + domain,
+                        null, key);
+        }
+        // format message
+        String msg;
+        try {
+            msg = key + ": " + resourceBundle.getString(key);
+            if (arguments != null) {
+                try {
+                    msg = java.text.MessageFormat.format(msg, arguments);
+                } catch (Exception e) {
+                    msg = resourceBundle.getString("FormatFailed");
+                    msg += " " + resourceBundle.getString(key);
+                }
+            }
+        } // error
+        catch (MissingResourceException e) {
+            msg = resourceBundle.getString("BadMessageKey");
+            throw new MissingResourceException(key, msg, key);
+        }
+
+        // no message
+        if (msg == null) {
+            msg = key;
+            if (arguments.length > 0) {
+                StringBuffer str = new StringBuffer(msg);
+                str.append('?');
+                for (int i = 0; i < arguments.length; i++) {
+                    if (i > 0) {
+                        str.append('&');
+                    }
+                    str.append(String.valueOf(arguments[i]));
+                }
+            }
+        }
+
+        return msg;
+    }
+
+    static ResourceBundle getResourceBundle(String domain) {
+        if (domain == DOM_DOMAIN || domain.equals(DOM_DOMAIN))
+            return domResourceBundle;
+        else if (domain == XML_DOMAIN || domain.equals(XML_DOMAIN))
+            return xmlResourceBundle;
+        else if (domain == SERIALIZER_DOMAIN
+                || domain.equals(SERIALIZER_DOMAIN))
+            return serResourceBundle;
+        return null;
+    }
+
+    /**
+     * Initializes Message Formatter.
+     */
+    public static void init() {
+        if (locale != null) {
+            domResourceBundle = PropertyResourceBundle.getBundle(
+                    "org.apache.axiom.om.impl.dom.msg.DOMMessages", locale);
+            serResourceBundle = PropertyResourceBundle.getBundle(
+                    "org.apache.axiom.om.impl.dom.msg.XMLSerializerMessages",
+                    locale);
+            xmlResourceBundle = PropertyResourceBundle.getBundle(
+                    "org.apache.axiom.om.impl.dom.msg.XMLMessages", locale);
+        } else {
+            domResourceBundle = PropertyResourceBundle
+                    .getBundle("org.apache.axiom.om.impl.dom.msg.DOMMessages");
+            serResourceBundle = PropertyResourceBundle
+                    .getBundle("org.apache.axiom.om.impl.dom.msg.XMLSerializerMessages");
+            xmlResourceBundle = PropertyResourceBundle
+                    .getBundle("org.apache.axiom.om.impl.dom.msg.XMLMessages");
+        }
+    }
+
+    /**
+     * Sets Locale to be used by the formatter.
+     * 
+     * @param dlocale
+     */
+    public static void setLocale(Locale dlocale) {
+        locale = dlocale;
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMNavigator.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMNavigator.java
new file mode 100644
index 0000000..d26f411
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMNavigator.java
@@ -0,0 +1,194 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNode;
+
+/**
+ * This is exactly the same as org.apache.axiom.om.impl.om.OMNavigator, only the
+ * llom specifics are changed to dom. Refer to the testClass to find out how to
+ * use features like isNavigable, isComplete and step.
+ */
+public class DOMNavigator {
+    /**
+     * Field node
+     */
+    protected OMNode node;
+
+    /**
+     * Field visited
+     */
+    private boolean visited;
+
+    /**
+     * Field next
+     */
+    private OMNode next;
+
+    // root is the starting element. Once the navigator comes back to the
+    // root, the traversal is terminated
+
+    /**
+     * Field root
+     */
+    private OMNode root;
+
+    /**
+     * Field backtracked
+     */
+    private boolean backtracked;
+
+    // flags that tell the status of the navigator
+
+    /**
+     * Field end
+     */
+    private boolean end = false;
+
+    /**
+     * Field start
+     */
+    private boolean start = true;
+
+    /**
+     * Constructor OMNavigator.
+     */
+    public DOMNavigator() {
+    }
+
+    /**
+     * Constructor OMNavigator.
+     * 
+     * @param node
+     */
+    public DOMNavigator(OMNode node) {
+        init(node);
+    }
+
+    /**
+     * Method init.
+     * 
+     * @param node
+     */
+    public void init(OMNode node) {
+        next = node;
+        root = node;
+        backtracked = false;
+    }
+
+    /**
+     * Gets the next node.
+     * 
+     * @return Returns OMNode in the sequence of preorder traversal. Note
+     *         however that an element node is treated slightly differently.
+     *         Once the element is passed it returns the same element in the
+     *         next encounter as well.
+     */
+    public OMNode next() {
+        if (next == null) {
+            return null;
+        }
+        node = next;
+        visited = backtracked;
+        backtracked = false;
+        updateNextNode();
+
+        // set the starting and ending flags
+        if (root.equals(node)) {
+            if (!start) {
+                end = true;
+            } else {
+                start = false;
+            }
+        }
+        return node;
+    }
+
+    /**
+     * Private method to encapsulate the searching logic
+     */
+    private void updateNextNode() {
+        if ((next instanceof OMElement) && !visited) {
+            ElementImpl e = (ElementImpl) next;
+            if (e.firstChild != null) {
+                next = e.firstChild;
+            } else if (e.isComplete()) {
+                backtracked = true;
+            } else {
+                next = null;
+            }
+        } else {
+            OMNode nextSibling = ((ChildNode) next).nextSibling;
+            OMContainer parent = next.getParent();
+            if (nextSibling != null) {
+                next = nextSibling;
+            } else if ((parent != null) && parent.isComplete()) {
+                next = (NodeImpl) parent;
+                backtracked = true;
+            } else {
+                next = null;
+            }
+        }
+    }
+
+    /**
+     * Method visited.
+     * 
+     * @return Returns boolean.
+     */
+    public boolean visited() {
+        return visited;
+    }
+
+    /**
+     * This is a very special method. This allows the navigator to step once it
+     * has reached the existing OM. At this point the isNavigable method will
+     * return false but the isComplete method may return false which means that
+     * the navigating the given element is not complete but the navigator cannot
+     * proceed.
+     */
+    public void step() {
+        if (!end) {
+            next = node;
+            updateNextNode();
+        }
+    }
+
+    /**
+     * Returns the navigable status.
+     * 
+     * @return Returns boolean.
+     */
+    public boolean isNavigable() {
+        if (end) {
+            return false;
+        } else {
+            return !(next == null);
+        }
+    }
+
+    /**
+     * Returns the completed status.
+     * 
+     * @return Returns boolean.
+     */
+    public boolean isCompleted() {
+        return end;
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMStAXWrapper.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMStAXWrapper.java
new file mode 100644
index 0000000..8eaf253
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMStAXWrapper.java
@@ -0,0 +1,1198 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMComment;
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.EmptyOMLocation;
+import org.apache.axiom.om.impl.exception.OMStreamingException;
+import org.w3c.dom.Attr;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.util.Iterator;
+import java.util.Stack;
+
+/**
+ * This is exactly the same as org.apache.axiom.om.impl.llom.OMStAXWrapper. BUT
+ * this uses the org.apache.axis2.om.impl.dom.DOMNavigator.
+ * 
+ * Note - This class also implements the streaming constants interface to get
+ * access to the StAX constants.
+ */
+public class DOMStAXWrapper implements XMLStreamReader, XMLStreamConstants {
+    /**
+     * Field navigator
+     */
+    private DOMNavigator navigator;
+
+    /**
+     * Field builder
+     */
+    private OMXMLParserWrapper builder;
+
+    /**
+     * Field parser
+     */
+    private XMLStreamReader parser;
+
+    /**
+     * Field rootNode
+     */
+    private OMNode rootNode;
+
+    /**
+     * Field isFirst
+     */
+    private boolean isFirst = true;
+
+    // Navigable means the output should be taken from the navigator
+    // as soon as the navigator returns a null navigable will be reset
+    // to false and the subsequent events will be taken from the builder
+    // or the parser directly.
+
+    /**
+     * Field NAVIGABLE
+     */
+    private static final short NAVIGABLE = 0;
+
+    private static final short SWITCH_AT_NEXT = 1;
+
+    private static final short COMPLETED = 2;
+
+    private static final short SWITCHED = 3;
+
+    private static final short DOCUMENT_COMPLETE = 4;
+
+    /**
+     * Field state
+     */
+    private short state;
+
+    /**
+     * Field currentEvent Default set to START_DOCUMENT
+     */
+    private int currentEvent = START_DOCUMENT;
+
+    // SwitchingAllowed is set to false by default
+    // this means that unless the user explicitly states
+    // that he wants things not to be cached, everything will
+    // be cached
+
+    /**
+     * Field switchingAllowed
+     */
+    boolean switchingAllowed = false;
+
+    /**
+     * Field elementStack
+     */
+    private Stack elementStack = new Stack();
+
+    // keeps the next event. The parser actually keeps one step ahead to
+    // detect the end of navigation. (at the end of the stream the navigator
+    // returns a null
+
+    /**
+     * Field nextNode
+     */
+    private OMNode nextNode = null;
+
+    // holder for the current node. Needs this to generate events from the
+    // current node
+
+    /**
+     * Field currentNode
+     */
+    private OMNode currentNode = null;
+
+    // needs this to refer to the last known node
+
+    /**
+     * Field lastNode
+     */
+    private OMNode lastNode = null;
+
+    private boolean needToThrowEndDocument = false;
+
+    /**
+     * Method setAllowSwitching.
+     * 
+     * @param b
+     */
+    public void setAllowSwitching(boolean b) {
+        this.switchingAllowed = b;
+    }
+
+    /**
+     * Method isAllowSwitching.
+     * 
+     * @return Returns boolean.
+     */
+    public boolean isAllowSwitching() {
+        return switchingAllowed;
+    }
+
+    /**
+     * When constructing the OMStaxWrapper, the creator must produce the builder
+     * (an instance of the OMXMLparserWrapper of the input) and the Element Node
+     * to start parsing. The wrapper parses(proceed) until the end of the given
+     * element. Hence care must be taken to pass the root element if the entire
+     * document is needed.
+     * 
+     * @param builder
+     * @param startNode
+     */
+    public DOMStAXWrapper(OMXMLParserWrapper builder, OMElement startNode) {
+        this(builder, startNode, false);
+    }
+
+    /**
+     * Constructor OMStAXWrapper
+     * 
+     * @param builder
+     * @param startNode
+     * @param cache
+     */
+    public DOMStAXWrapper(OMXMLParserWrapper builder, OMElement startNode,
+            boolean cache) {
+
+        // create a navigator
+        this.navigator = new DOMNavigator(startNode);
+        this.builder = builder;
+        this.rootNode = startNode;
+        if (rootNode != null && rootNode.getParent() != null
+                && rootNode.getParent() instanceof OMDocument) {
+            needToThrowEndDocument = true;
+        }
+
+        // initaite the next and current nodes
+        // Note - navigator is written in such a way that it first
+        // returns the starting node at the first call to it
+        currentNode = navigator.next();
+        updateNextNode();
+        switchingAllowed = !cache;
+    }
+
+    /**
+     * @return Returns String.
+     * @see javax.xml.stream.XMLStreamReader#getPrefix()
+     */
+    public String getPrefix() {
+        String returnStr = null;
+        if (parser != null) {
+            returnStr = parser.getPrefix();
+        } else {
+            if ((currentEvent == START_ELEMENT)
+                    || (currentEvent == END_ELEMENT)) {
+                OMNamespace ns = ((OMElement) lastNode).getNamespace();
+                returnStr = (ns == null) ? null : ns.getPrefix();
+            }
+        }
+        return returnStr;
+    }
+
+    /**
+     * @return Returns String.
+     * @see javax.xml.stream.XMLStreamReader#getNamespaceURI()
+     */
+    public String getNamespaceURI() {
+        String returnStr = null;
+        if (parser != null) {
+            returnStr = parser.getNamespaceURI();
+        } else {
+            if ((currentEvent == START_ELEMENT)
+                    || (currentEvent == END_ELEMENT)
+                    || (currentEvent == NAMESPACE)) {
+                OMNamespace ns = ((OMElement) lastNode).getNamespace();
+                returnStr = (ns == null) ? null : ns.getNamespaceURI();
+            }
+        }
+        return returnStr;
+    }
+
+    /**
+     * @return Returns String.
+     * @see javax.xml.stream.XMLStreamReader#hasName()
+     */
+    public boolean hasName() {
+        if (parser != null) {
+            return parser.hasName();
+        } else {
+            return ((currentEvent == START_ELEMENT) || 
+                    (currentEvent == END_ELEMENT));
+        }
+    }
+
+    /**
+     * @return Returns String.
+     * @see javax.xml.stream.XMLStreamReader#getLocalName()
+     */
+    public String getLocalName() {
+        String returnStr = null;
+        if (parser != null) {
+            returnStr = parser.getLocalName();
+        } else {
+            if ((currentEvent == START_ELEMENT)
+                    || (currentEvent == END_ELEMENT)
+                    || (currentEvent == ENTITY_REFERENCE)) {
+                returnStr = ((OMElement) lastNode).getLocalName();
+            }
+        }
+        return returnStr;
+    }
+
+    /**
+     * @return Returns QName.
+     * @see javax.xml.stream.XMLStreamReader#getName()
+     */
+    public QName getName() {
+        QName returnName = null;
+        if (parser != null) {
+            returnName = parser.getName();
+        } else {
+            if ((currentEvent == START_ELEMENT)
+                    || (currentEvent == END_ELEMENT)) {
+                returnName = getQName((OMElement) lastNode);
+            }
+        }
+        return returnName;
+    }
+
+    /**
+     * @return Returns boolean.
+     * @see javax.xml.stream.XMLStreamReader#hasText()
+     */
+    public boolean hasText() {
+        return ((currentEvent == CHARACTERS) || (currentEvent == DTD)
+                || (currentEvent == ENTITY_REFERENCE)
+                || (currentEvent == COMMENT) || (currentEvent == SPACE));
+    }
+
+    /**
+     * @return Returns int.
+     * @see javax.xml.stream.XMLStreamReader#getTextLength()
+     */
+    public int getTextLength() {
+        int returnLength = 0;
+        if (parser != null) {
+            returnLength = parser.getTextLength();
+        } else {
+            OMText textNode = (OMText) lastNode;
+            returnLength = textNode.getText().length();
+        }
+        return returnLength;
+    }
+
+    /**
+     * @return Returns int.
+     * @see javax.xml.stream.XMLStreamReader#getTextStart()
+     */
+    public int getTextStart() {
+        int returnLength = 0;
+        if (parser != null) {
+            returnLength = parser.getTextStart();
+        }
+
+        // Note - this has no relevant method in the OM
+        return returnLength;
+    }
+
+    /**
+     * @param i
+     * @param chars
+     * @param i1
+     * @param i2
+     * @return Returns int.
+     * @throws XMLStreamException
+     * @see javax.xml.stream.XMLStreamReader#getTextCharacters(int, char[], int,
+     *      int)
+     */
+    public int getTextCharacters(int i, char[] chars, int i1, int i2)
+            throws XMLStreamException {
+        int returnLength = 0;
+        if (hasText()) {
+            if (parser != null) {
+                try {
+                    returnLength = parser.getTextCharacters(i, chars, i1, i2);
+                } catch (XMLStreamException e) {
+                    throw new OMStreamingException(e);
+                }
+            }
+
+            // Note - this has no relevant method in the OM
+        }
+        return returnLength;
+    }
+
+    /**
+     * @return Returns char[].
+     * @see javax.xml.stream.XMLStreamReader#getTextCharacters()
+     */
+    public char[] getTextCharacters() {
+        char[] returnArray = null;
+        if (parser != null) {
+            returnArray = parser.getTextCharacters();
+        } else {
+            if (hasText()) {
+                OMText textNode = (OMText) lastNode;
+                String str = textNode.getText();
+                returnArray = str.toCharArray();
+            }
+        }
+        return returnArray;
+    }
+
+    /**
+     * @return Returns String.
+     * @see javax.xml.stream.XMLStreamReader#getText()
+     */
+    public String getText() {
+        String returnString = null;
+        if (parser != null) {
+            returnString = parser.getText();
+        } else {
+            if (hasText()) {
+                if (lastNode instanceof OMText) {
+                    returnString = ((OMText) lastNode).getText();
+                } else if (lastNode instanceof OMComment) {
+                    returnString = ((OMComment) lastNode).getValue();
+                }
+            }
+        }
+        return returnString;
+    }
+
+    /**
+     * @return Returns int.
+     * @see javax.xml.stream.XMLStreamReader#getEventType()
+     */
+
+    // todo this should be improved
+    public int getEventType() {
+        return currentEvent;
+    }
+
+    /**
+     * @param i
+     * @return Returns String.
+     * @see javax.xml.stream.XMLStreamReader#getNamespaceURI
+     */
+    public String getNamespaceURI(int i) {
+        String returnString = null;
+        if (parser != null) {
+            returnString = parser.getNamespaceURI(i);
+        } else {
+            if (isStartElement() || isEndElement()
+                    || (currentEvent == NAMESPACE)) {
+                OMNamespace ns = (OMNamespace) getItemFromIterator(
+                        ((OMElement) lastNode).getAllDeclaredNamespaces(), i);
+                returnString = (ns == null) ? null : ns.getNamespaceURI();
+            }
+        }
+        return returnString;
+    }
+
+    /**
+     * @param i
+     * @return Returns String.
+     * @see javax.xml.stream.XMLStreamReader#getNamespacePrefix
+     */
+    public String getNamespacePrefix(int i) {
+        String returnString = null;
+        if (parser != null) {
+            returnString = parser.getNamespacePrefix(i);
+        } else {
+            if (isStartElement() || isEndElement()
+                    || (currentEvent == NAMESPACE)) {
+                OMNamespace ns = (OMNamespace) getItemFromIterator(
+                        ((OMElement) lastNode).getAllDeclaredNamespaces(), i);
+                returnString = (ns == null) ? null : ns.getPrefix();
+            }
+        }
+        return returnString;
+    }
+
+    /**
+     * @return Returns int.
+     * @see javax.xml.stream.XMLStreamReader#getNamespaceCount()
+     */
+    public int getNamespaceCount() {
+        int returnCount = 0;
+        if (parser != null) {
+            returnCount = parser.getNamespaceCount();
+        } else {
+            if (isStartElement() || isEndElement()
+                    || (currentEvent == NAMESPACE)) {
+                returnCount = getCount(((OMElement) lastNode)
+                        .getAllDeclaredNamespaces());
+            }
+        }
+        return returnCount;
+    }
+
+    /**
+     * @param i
+     * @return Returns boolean.
+     * @see javax.xml.stream.XMLStreamReader#isAttributeSpecified
+     */
+    public boolean isAttributeSpecified(int i) {
+        boolean returnValue = false;
+        if (parser != null) {
+            returnValue = parser.isAttributeSpecified(i);
+        } else {
+            if (isStartElement() || (currentEvent == ATTRIBUTE)) {
+
+                // theres nothing to be returned here
+            } else {
+                throw new IllegalStateException(
+                        "attribute type accessed in illegal event!");
+            }
+        }
+        return returnValue;
+    }
+
+    /**
+     * @param i
+     * @return Returns String.
+     * @see javax.xml.stream.XMLStreamReader#getAttributeValue
+     */
+    public String getAttributeValue(int i) {
+        String returnString = null;
+        if (parser != null) {
+            returnString = parser.getAttributeValue(i);
+        } else {
+            if (isStartElement() || (currentEvent == ATTRIBUTE)) {
+                OMAttribute attrib = getAttribute((OMElement) lastNode, i);
+                if (attrib != null) {
+                    returnString = attrib.getAttributeValue();
+                }
+            } else {
+                throw new IllegalStateException(
+                        "attribute type accessed in illegal event!");
+            }
+        }
+        return returnString;
+    }
+
+    /**
+     * @param i
+     * @return Returns String.
+     * @see javax.xml.stream.XMLStreamReader#getAttributeType
+     */
+    public String getAttributeType(int i) {
+        String returnString = null;
+        if (parser != null) {
+            returnString = parser.getAttributeType(i);
+        } else {
+            if (isStartElement() || (currentEvent == ATTRIBUTE)) {
+
+                // todo implement this
+            } else {
+                throw new IllegalStateException(
+                        "attribute type accessed in illegal event!");
+            }
+        }
+        return returnString;
+    }
+
+    /**
+     * @param i
+     * @return Returns String.
+     * @see javax.xml.stream.XMLStreamReader#getAttributePrefix
+     */
+    public String getAttributePrefix(int i) {
+        String returnString = null;
+        if (parser != null) {
+            returnString = parser.getAttributePrefix(i);
+        } else {
+            if (isStartElement() || (currentEvent == ATTRIBUTE)) {
+                OMAttribute attrib = getAttribute((OMElement) lastNode, i);
+                if (attrib != null) {
+                    OMNamespace nameSpace = attrib.getNamespace();
+                    if (nameSpace != null) {
+                        returnString = nameSpace.getPrefix();
+                    }
+                }
+            } else {
+                throw new IllegalStateException(
+                        "attribute prefix accessed in illegal event!");
+            }
+        }
+        return returnString;
+    }
+
+    /**
+     * @param i
+     * @return Returns String.
+     * @see javax.xml.stream.XMLStreamReader#getAttributeLocalName
+     */
+    public String getAttributeLocalName(int i) {
+        String returnString = null;
+        if (parser != null) {
+            returnString = parser.getAttributeLocalName(i);
+        } else {
+            if (isStartElement() || (currentEvent == ATTRIBUTE)) {
+                OMAttribute attrib = getAttribute((OMElement) lastNode, i);
+                if (attrib != null) {
+                    if (attrib.getNamespace() != null) {
+                        returnString = attrib.getLocalName();
+                    } else {
+                        returnString = ((Attr) attrib).getNodeName();
+                    }
+                }
+            } else {
+                throw new IllegalStateException(
+                        "attribute localName accessed in illegal event!");
+            }
+        }
+        return returnString;
+    }
+
+    /**
+     * @param i
+     * @return Returns String.
+     * @see javax.xml.stream.XMLStreamReader#getAttributeNamespace
+     */
+    public String getAttributeNamespace(int i) {
+        String returnString = null;
+        if (parser != null) {
+            returnString = parser.getAttributeNamespace(i);
+        } else {
+            if (isStartElement() || (currentEvent == ATTRIBUTE)) {
+                OMAttribute attrib = getAttribute((OMElement) lastNode, i);
+                if (attrib != null) {
+                    OMNamespace nameSpace = attrib.getNamespace();
+                    if (nameSpace != null) {
+                        returnString = nameSpace.getNamespaceURI();
+                    }
+                }
+            } else {
+                throw new IllegalStateException(
+                        "attribute nameSpace accessed in illegal event!");
+            }
+        }
+        return returnString;
+    }
+
+    /**
+     * @param i
+     * @return Returns QName.
+     * @see javax.xml.stream.XMLStreamReader#getAttributeName
+     */
+    public QName getAttributeName(int i) {
+        QName returnQName = null;
+        if (parser != null) {
+            returnQName = parser.getAttributeName(i);
+        } else {
+            if (isStartElement() || (currentEvent == ATTRIBUTE)) {
+                returnQName = getAttribute((OMElement) lastNode, i).getQName();
+            } else {
+                throw new IllegalStateException(
+                        "attribute count accessed in illegal event!");
+            }
+        }
+        return returnQName;
+    }
+
+    /**
+     * @return Returns int.
+     * @see javax.xml.stream.XMLStreamReader#getAttributeCount
+     */
+    public int getAttributeCount() {
+        int returnCount = 0;
+        if (parser != null) {
+            returnCount = parser.getAttributeCount();
+        } else {
+            if (isStartElement() || (currentEvent == ATTRIBUTE)) {
+                OMElement elt = (OMElement) lastNode;
+                returnCount = getCount(elt.getAllAttributes());
+            } else {
+                throw new IllegalStateException(
+                        "attribute count accessed in illegal event ("
+                                + currentEvent + ")!");
+            }
+        }
+        return returnCount;
+    }
+
+    // todo
+
+    /**
+     * Method getAttributeValue.
+     * 
+     * @param s
+     * @param s1
+     * @return Returns String.
+     */
+    public String getAttributeValue(String s, String s1) {
+        String returnString = null;
+        if (parser != null) {
+            returnString = parser.getAttributeValue(s, s1);
+        } else {
+            if (isStartElement() || (currentEvent == ATTRIBUTE)) {
+                QName qname = new QName(s, s1);
+                OMAttribute attrib = ((OMElement) lastNode).getAttribute(qname);
+                if (attrib != null) {
+                    returnString = attrib.getAttributeValue();
+                }
+            } else {
+                throw new IllegalStateException(
+                        "attribute type accessed in illegal event!");
+            }
+        }
+        return returnString;
+    }
+
+    /**
+     * Method isWhiteSpace.
+     * 
+     * @return Returns boolean.
+     */
+    public boolean isWhiteSpace() {
+        boolean b;
+        if (parser != null) {
+            b = parser.isWhiteSpace();
+        } else {
+            b = (currentEvent == SPACE);
+        }
+        return b;
+    }
+
+    /**
+     * Method isCharacters.
+     * 
+     * @return Returns boolean.
+     */
+    public boolean isCharacters() {
+        boolean b;
+        if (parser != null) {
+            b = parser.isCharacters();
+        } else {
+            b = (currentEvent == CHARACTERS);
+        }
+        return b;
+    }
+
+    /**
+     * Method isEndElement.
+     * 
+     * @return Returns boolean.
+     */
+    public boolean isEndElement() {
+        boolean b;
+        if (parser != null) {
+            b = parser.isEndElement();
+        } else {
+            b = (currentEvent == END_ELEMENT);
+        }
+        return b;
+    }
+
+    /**
+     * @param i
+     * @param s
+     * @param s1
+     * @throws XMLStreamException
+     * @see javax.xml.stream.XMLStreamReader#require(int, String, String)
+     */
+    public void require(int i, String s, String s1) throws XMLStreamException {
+        throw new XMLStreamException();
+    }
+
+    /**
+     * Method isStartElement.
+     * 
+     * @return Returns boolean.
+     */
+    public boolean isStartElement() {
+        boolean b;
+        if (parser != null) {
+            b = parser.isStartElement();
+        } else {
+            b = (currentEvent == START_ELEMENT);
+        }
+        return b;
+    }
+
+    /**
+     * Method getNamespaceURI.
+     * 
+     * @param s
+     * @return Returns String.
+     */
+    public String getNamespaceURI(String s) {
+        String returnString = null;
+        if (parser != null) {
+            returnString = parser.getNamespaceURI(s);
+        } else {
+            if (isStartElement() || isEndElement()
+                    || (currentEvent == NAMESPACE)) {
+
+                // Nothing to do here! How to get the namespacace references
+            }
+        }
+        return returnString;
+    }
+
+    /**
+     * Method close.
+     * 
+     * @throws XMLStreamException
+     */
+    public void close() throws XMLStreamException {
+
+        // this doesnot mean anything with respect to the OM
+        if (parser != null) {
+            parser.close();
+        }
+    }
+
+    /**
+     * Method hasNext.
+     * 
+     * @return Returns boolean.
+     * @throws XMLStreamException
+     */
+    public boolean hasNext() throws XMLStreamException {
+        if (needToThrowEndDocument) {
+            return !(state == DOCUMENT_COMPLETE);
+        } else {
+            return (state != COMPLETED && currentEvent != END_DOCUMENT);
+        }
+    }
+
+    /**
+     * Not implemented yet
+     * 
+     * @return Returns int.
+     * @throws org.apache.axiom.om.impl.exception.OMStreamingException
+     * 
+     * @throws XMLStreamException
+     */
+    public int nextTag() throws XMLStreamException {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * @return Returns String.
+     * @throws XMLStreamException
+     * @see javax.xml.stream.XMLStreamReader#getElementText()
+     */
+    public String getElementText() throws XMLStreamException {
+        String returnText = "";
+        if (parser != null) {
+            try {
+                returnText = parser.getElementText();
+            } catch (XMLStreamException e) {
+                throw new OMStreamingException(e);
+            }
+        } else {
+            if (currentNode.getType() == OMNode.ELEMENT_NODE) {
+                returnText = ((OMElement) currentNode).getText();
+            } else if (currentNode.getType() == OMNode.TEXT_NODE) {
+                returnText = ((OMText) currentNode).getText();
+            }
+        }
+        return returnText;
+    }
+
+    /**
+     * Method next.
+     * 
+     * @return Returns int.
+     * @throws XMLStreamException
+     */
+    public int next() throws XMLStreamException {
+        switch (state) {
+        case DOCUMENT_COMPLETE:
+            throw new XMLStreamException("End of the document reached");
+        case COMPLETED:
+            state = DOCUMENT_COMPLETE;
+            currentEvent = END_DOCUMENT;
+            break;
+        case SWITCH_AT_NEXT:
+            state = SWITCHED;
+
+            // load the parser
+            try {
+                parser = (XMLStreamReader) builder.getParser();
+            } catch (Exception e) {
+                throw new XMLStreamException("problem accessing the parser", e);
+            }
+
+            if ((currentEvent == START_DOCUMENT)
+                    && (currentEvent == parser.getEventType())) {
+                currentEvent = parser.next();
+            } else {
+                currentEvent = parser.getEventType();
+            }
+            updateCompleteStatus();
+            break;
+        case NAVIGABLE:
+            currentEvent = generateEvents(currentNode);
+            updateCompleteStatus();
+            updateLastNode();
+            break;
+        case SWITCHED:
+            currentEvent = parser.next();
+            updateCompleteStatus();
+            break;
+        default:
+            throw new OMStreamingException("unsuppported state!");
+        }
+        return currentEvent;
+    }
+
+    /**
+     * Method getProperty.
+     * 
+     * @param s
+     * @return Returns Object.
+     * @throws IllegalArgumentException
+     */
+    public Object getProperty(String s) throws IllegalArgumentException {
+        throw new IllegalArgumentException();
+    }
+
+    /**
+     * This is a very important method. This keeps the navigator one step ahead
+     * and pushes the navigator one event ahead. If the nextNode is null then
+     * navigable is set to false; At the same time the parser and builder are
+     * set up for the upcoming event generation
+     * 
+     * @throws XMLStreamException
+     */
+    private void updateLastNode() throws XMLStreamException {
+        lastNode = currentNode;
+        currentNode = nextNode;
+        try {
+            updateNextNode();
+        } catch (Exception e) {
+            throw new XMLStreamException(e);
+        }
+    }
+
+    /**
+     * Method updateNextNode.
+     */
+    private void updateNextNode() {
+        if (navigator.isNavigable()) {
+            nextNode = navigator.next();
+        } else {
+            if (!switchingAllowed) {
+                if (navigator.isCompleted()) {
+                    nextNode = null;
+
+                } else {
+                    builder.next();
+                    navigator.step();
+                    nextNode = navigator.next();
+                }
+            } else {
+
+                // reset caching (the default is ON so it was not needed in the
+                // earlier case!
+                builder.setCache(false);
+                state = SWITCH_AT_NEXT;
+            }
+        }
+    }
+
+    /**
+     * Method updateCompleteStatus.
+     */
+    private void updateCompleteStatus() {
+        if (state == NAVIGABLE) {
+            if (rootNode == currentNode) {
+                if (isFirst) {
+                    isFirst = false;
+                } else {
+                    state = COMPLETED;
+                }
+            }
+        } else {
+            state = (currentEvent == END_DOCUMENT) ? DOCUMENT_COMPLETE : state;
+        }
+    }
+
+    /**
+     * Method getNamespaceContext.
+     * 
+     * @return Returns NamespaceContext.
+     */
+    public NamespaceContext getNamespaceContext() {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Method getEncoding.
+     * 
+     * @return Returns String.
+     */
+    public String getEncoding() {
+        return null;
+    }
+
+    /**
+     * Method getLocation.
+     * 
+     * @return Returns Location.
+     */
+    public Location getLocation() {
+        return new EmptyOMLocation();
+    }
+
+    /**
+     * Method getVersion.
+     * 
+     * @return Returns String.
+     */
+    public String getVersion() {
+        return "1.0"; // todo put the constant
+    }
+
+    /**
+     * Method isStandalone.
+     * 
+     * @return Returns boolean.
+     */
+    public boolean isStandalone() {
+        return true;
+    }
+
+    /**
+     * Method standaloneSet.
+     * 
+     * @return Returns boolean.
+     */
+    public boolean standaloneSet() {
+        return false;
+    }
+
+    /**
+     * Method getCharacterEncodingScheme.
+     * 
+     * @return Returns String.
+     */
+    public String getCharacterEncodingScheme() {
+        return "utf-8";
+    }
+
+    /**
+     * Method getPITarget.
+     * 
+     * @return Returns String.
+     */
+    public String getPITarget() {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Method getPIData.
+     * 
+     * @return Returns String.
+     */
+    public String getPIData() {
+        throw new UnsupportedOperationException();
+    }
+
+    /*
+     * 
+     * ################################################################
+     * Generator methods for the OMNodes returned by the navigator
+     * ################################################################
+     * 
+     */
+
+    /**
+     * Method generateEvents
+     * 
+     * @param node
+     * @return Returns int.
+     */
+    private int generateEvents(OMNode node) {
+        int returnEvent = 0;
+        int nodeType = node.getType();
+        switch (nodeType) {
+        case OMNode.ELEMENT_NODE:
+            OMElement element = (OMElement) node;
+            returnEvent = generateElementEvents(element);
+            break;
+        case OMNode.TEXT_NODE:
+            returnEvent = generateTextEvents();
+            break;
+        case OMNode.COMMENT_NODE:
+            returnEvent = generateCommentEvents();
+            break;
+        case OMNode.CDATA_SECTION_NODE:
+            returnEvent = generateCdataEvents();
+            break;
+        default:
+            break; // just ignore any other nodes
+        }
+        return returnEvent;
+    }
+
+    /**
+     * Method generateElementEvents.
+     * 
+     * @param elt
+     * @return Returns int.
+     */
+    private int generateElementEvents(OMElement elt) {
+        int returnValue = START_ELEMENT;
+        if (!elementStack.isEmpty() && elementStack.peek().equals(elt)) {
+            returnValue = END_ELEMENT;
+            elementStack.pop();
+        } else {
+            elementStack.push(elt);
+        }
+        return returnValue;
+    }
+
+    /**
+     * Method generateTextEvents.
+     * 
+     * @return Returns int.
+     * @noinspection SameReturnValue
+     */
+    private int generateTextEvents() {
+        return CHARACTERS;
+    }
+
+    /**
+     * Method generateCommentEvents.
+     * 
+     * @return Returns int.
+     * @noinspection SameReturnValue
+     */
+    private int generateCommentEvents() {
+        return COMMENT;
+    }
+
+    /**
+     * Method generateCdataEvents.
+     * 
+     * @return Returns int.
+     */
+    private int generateCdataEvents() {
+        return CDATA;
+    }
+
+    /*
+     * ####################################################################
+     * Other helper methods
+     * ####################################################################
+     */
+
+    /**
+     * helper method.
+     * 
+     * @param it
+     * @return Returns int.
+     */
+    private int getCount(Iterator it) {
+        int count = 0;
+        if (it != null) {
+            while (it.hasNext()) {
+                it.next();
+                count++;
+            }
+        }
+        return count;
+    }
+
+    /**
+     * Helper method.
+     * 
+     * @param it
+     * @param index
+     * @return Returns Object.
+     */
+    private Object getItemFromIterator(Iterator it, int index) {
+        int count = 0;
+        Object returnObject = null;
+        boolean found = false;
+        if (it != null) {
+            while (it.hasNext()) {
+                returnObject = it.next();
+                if (index == count++) {
+                    found = true;
+                    break;
+                }
+            }
+        }
+        if (found) {
+            return returnObject;
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Helper method.
+     * 
+     * @param element
+     * @return Returns QName.
+     */
+    private QName getQName(OMElement element) {
+        QName returnName;
+        OMNamespace ns = element.getNamespace();
+        String localPart = element.getLocalName();
+        if (ns != null) {
+            String prefix = ns.getPrefix();
+            String uri = ns.getNamespaceURI();
+            if ((prefix == null) || prefix.equals("")) {
+                returnName = new QName(uri, localPart);
+            } else {
+                returnName = new QName(uri, localPart, prefix);
+            }
+        } else {
+            returnName = new QName(localPart);
+        }
+        return returnName;
+    }
+
+    /**
+     * @param elt
+     * @param index
+     * @return Returns OMAttribute.
+     */
+    private OMAttribute getAttribute(OMElement elt, int index) {
+        OMAttribute returnAttrib = null;
+        if (elt != null) {
+            returnAttrib = (OMAttribute) getItemFromIterator(elt
+                    .getAllAttributes(), index);
+        }
+        return returnAttrib;
+    }
+
+    public void setParser(XMLStreamReader parser) {
+        this.parser = parser;
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMUtil.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMUtil.java
new file mode 100644
index 0000000..3217590
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMUtil.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom;
+
+/**
+ * Utility class for the OM-DOM implementation
+ */
+class DOMUtil {
+
+    public static boolean isValidChras(String value) {
+        // TODO check for valid characters
+        // throw new UnsupportedOperationException("TODO");
+        return true;
+    }
+
+    public static boolean isValidNamespace(String namespaceURI,
+            String qualifiedname) {
+        // TODO check for valid namespace
+        /**
+         * if the qualifiedName has a prefix and the namespaceURI is null, if
+         * the qualifiedName has a prefix that is "xml" and the namespaceURI is
+         * different from " http://www.w3.org/XML/1998/namespace", or if the
+         * qualifiedName, or its prefix, is "xmlns" and the namespaceURI is
+         * different from " http://www.w3.org/2000/xmlns/".
+         */
+        // throw new UnsupportedOperationException("TODO");
+        // temporary fix
+        return true;
+    }
+
+    /**
+     * Get the local name from a qualified name
+     * 
+     * @param qualifiedName
+     */
+    public static String getLocalName(String qualifiedName) {
+        if (qualifiedName.indexOf(":") > -1
+                && !qualifiedName.trim().endsWith(":")) {
+            return qualifiedName.split(":")[1];
+        } else {
+            return qualifiedName;
+        }
+    }
+
+    /**
+     * Get the prefix from a qualified name
+     * 
+     * @param qualifiedName
+     */
+    public static String getPrefix(String qualifiedName) {
+        if (qualifiedName.indexOf(":") > -1) {
+            return qualifiedName.split(":")[0];
+        } else {
+            return null;
+        }
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOOMAbstractFactory.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOOMAbstractFactory.java
new file mode 100644
index 0000000..04db146
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOOMAbstractFactory.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
+import org.apache.axiom.soap.impl.dom.soap12.SOAP12Factory;
+
+public class DOOMAbstractFactory {
+
+    public static OMFactory getOMFactory() {
+        return new OMDOMFactory();
+    }
+
+    public static SOAPFactory getSOAP11Factory() {
+        return new SOAP11Factory();
+    }
+
+    public static SOAPFactory getSOAP12Factory() {
+        return new SOAP12Factory();
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentimpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentimpl.java
new file mode 100644
index 0000000..ea33aa7
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentFragmentimpl.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Node;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class DocumentFragmentimpl extends ParentNode implements
+        DocumentFragment {
+
+    /**
+     * @param ownerDocument
+     */
+    public DocumentFragmentimpl(DocumentImpl ownerDocument, OMFactory factory) {
+        super(ownerDocument, factory);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.w3c.dom.Node#getNodeType()
+     */
+    public short getNodeType() {
+        return Node.DOCUMENT_FRAGMENT_NODE;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.w3c.dom.Node#getNodeName()
+     */
+    public String getNodeName() {
+        return "#document-fragment";
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.axiom.om.OMNode#getType()
+     */
+    public int getType() throws OMException {
+        return -1;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.axiom.om.OMNode#setType(int)
+     */
+    public void setType(int nodeType) throws OMException {
+        // DO Nothing :-?
+    }
+
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public void internalSerializeAndConsume(XMLStreamWriter writer)
+            throws XMLStreamException {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public void serializeAndConsume(XMLStreamWriter xmlWriter)
+            throws XMLStreamException {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
new file mode 100644
index 0000000..01781be
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
@@ -0,0 +1,570 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.OMConstants;
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
+import org.w3c.dom.Attr;
+import org.w3c.dom.CDATASection;
+import org.w3c.dom.Comment;
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.DocumentType;
+import org.w3c.dom.Element;
+import org.w3c.dom.EntityReference;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.ProcessingInstruction;
+import org.w3c.dom.Text;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import java.io.OutputStream;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+public class DocumentImpl extends ParentNode implements Document, OMDocument {
+
+    private String xmlVersion;
+
+    private String charEncoding;
+
+    private Vector idAttrs;
+    
+    protected ElementImpl documentElement;
+    
+    protected Hashtable identifiers;
+
+    /**
+     * @param ownerDocument
+     */
+    public DocumentImpl(DocumentImpl ownerDocument, OMFactory factory) {
+        super(ownerDocument, factory);
+        ((OMDOMFactory)factory).setDocument(this);
+        this.done = true;
+    }
+
+    public DocumentImpl(OMXMLParserWrapper parserWrapper, OMFactory factory) {
+        super(factory);
+        this.builder = parserWrapper;
+        ((OMDOMFactory)factory).setDocument(this);
+    }
+
+    public DocumentImpl(OMFactory factory) {
+        super(factory);
+        ((OMDOMFactory)factory).setDocument(this);
+        this.done = true;
+    }
+
+    // /
+    // /OMNode methods
+    // //
+    public void setType(int nodeType) throws OMException {
+        throw new UnsupportedOperationException(
+                "In OM Document object doesn't have a type");
+    }
+
+    public int getType() throws OMException {
+        throw new UnsupportedOperationException(
+                "In OM Document object doesn't have a type");
+    }
+
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
+        // TODO Auto-generated method stub
+    }
+
+    // /
+    // /Overrides ChildNode specific methods.
+    // /
+    public OMNode getNextOMSibling() throws OMException {
+        throw new UnsupportedOperationException("This is the document node");
+    }
+
+    public Node getNextSibling() {
+        throw new UnsupportedOperationException("This is the document node");
+    }
+
+    public OMContainer getParent() throws OMException {
+        throw new UnsupportedOperationException("This is the document node");
+    }
+
+    public OMNode getPreviousOMSibling() {
+        throw new UnsupportedOperationException("This is the document node");
+    }
+
+    public Node getPreviousSibling() {
+        throw new UnsupportedOperationException("This is the document node");
+    }
+
+    public void setNextOMSibling(OMNode node) {
+        throw new UnsupportedOperationException("This is the document node");
+    }
+
+    public void setParent(OMContainer element) {
+        throw new UnsupportedOperationException("This is the document node");
+    }
+
+    public void setPreviousOMSibling(OMNode node) {
+        throw new UnsupportedOperationException("This is the document node");
+    }
+
+    // /
+    // /org.w3c.dom.Node methods
+    // /
+    public String getNodeName() {
+        return "#document";
+    }
+
+    public short getNodeType() {
+        return Node.DOCUMENT_NODE;
+    }
+
+    // /org.w3c.dom.Document methods
+    // /
+
+    public Attr createAttribute(String name) throws DOMException {
+        if (!DOMUtil.isValidChras(name)) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR",
+                    null);
+            throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
+        }
+        return new AttrImpl(this, name, this.factory);
+    }
+
+    public Attr createAttributeNS(String namespaceURI, String qualifiedName)
+            throws DOMException {
+        String localName = DOMUtil.getLocalName(qualifiedName);
+        String prefix = DOMUtil.getPrefix(qualifiedName);
+
+        if(!OMConstants.XMLNS_NS_PREFIX.equals(localName)) {
+            this.checkQName(prefix, localName);
+        } else {
+            return this.createAttribute(localName);
+        }
+
+        return new AttrImpl(this, localName, new NamespaceImpl(
+                namespaceURI, prefix), this.factory);
+    }
+
+    public CDATASection createCDATASection(String arg0) throws DOMException {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public Comment createComment(String data) {
+        return new CommentImpl(this, data, this.factory);
+    }
+
+    public DocumentFragment createDocumentFragment() {
+        return new DocumentFragmentimpl(this, this.factory);
+    }
+
+    public Element createElement(String tagName) throws DOMException {
+        return new ElementImpl(this, tagName, this.factory);
+    }
+
+    public Element createElementNS(String ns, String qualifiedName)
+            throws DOMException {
+
+        String localName = DOMUtil.getLocalName(qualifiedName);
+        String prefix = DOMUtil.getPrefix(qualifiedName);
+
+        if (ns != null && (prefix != null || "".equals(prefix))) {
+            this.checkQName(prefix, localName);
+        }
+
+        NamespaceImpl namespace = new NamespaceImpl(ns, prefix == null ? "" : prefix);
+        return new ElementImpl(this, localName, namespace, this.factory);
+    }
+
+    public EntityReference createEntityReference(String arg0)
+            throws DOMException {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public ProcessingInstruction createProcessingInstruction(String arg0,
+            String arg1) throws DOMException {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public Text createTextNode(String value) {
+        return new TextImpl(this, value, this.factory);
+    }
+
+    public DocumentType getDoctype() {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public Element getElementById(String elementId) {
+        
+        //If there are no id attrs
+        if(this.idAttrs == null) {
+            return null;
+        }
+        
+        Enumeration attrEnum = this.idAttrs.elements();
+        while(attrEnum.hasMoreElements()) {
+            Attr tempAttr = (Attr)attrEnum.nextElement();
+            if(tempAttr.getValue().equals(elementId)) {
+                return tempAttr.getOwnerElement();
+            }
+        }
+        
+        //If we reach this point then, there's no such attr 
+        return null;
+    }
+
+    public NodeList getElementsByTagName(String arg0) {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public NodeList getElementsByTagNameNS(String arg0, String arg1) {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public DOMImplementation getImplementation() {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public Node importNode(Node importedNode, boolean deep) throws DOMException {
+
+        short type = importedNode.getNodeType();
+        Node newNode = null;
+        switch (type) {
+        case Node.ELEMENT_NODE: {
+            Element newElement;
+            if (importedNode.getLocalName() == null) {
+                newElement = this.createElement(importedNode.getNodeName());
+            } else {
+                newElement = createElementNS(importedNode.getNamespaceURI(),
+                        importedNode.getNodeName());
+            }
+
+            // Copy element's attributes, if any.
+            NamedNodeMap sourceAttrs = importedNode.getAttributes();
+            if (sourceAttrs != null) {
+                int length = sourceAttrs.getLength();
+                for (int index = 0; index < length; index++) {
+                    Attr attr = (Attr) sourceAttrs.item(index);
+                    if (attr.getNamespaceURI() != null
+                            && !attr.getNamespaceURI().equals(
+                                    OMConstants.XMLNS_NS_URI)) {
+                        Attr newAttr = (Attr) importNode(attr, true);
+                        newElement.setAttributeNodeNS(newAttr);
+                    } else { // if (attr.getLocalName() == null) {
+                        Attr newAttr = (Attr) importNode(attr, true);
+                        newElement.setAttributeNode(newAttr);
+                    }
+
+                }
+            }
+            newNode = newElement;
+            break;
+        }
+
+        case Node.ATTRIBUTE_NODE: {
+            if ("".equals(importedNode.getNamespaceURI())
+                    || importedNode.getNamespaceURI() == null) {
+                newNode = createAttribute(importedNode.getNodeName());
+            } else {
+                //Check whether it is a default ns decl
+                if(OMConstants.XMLNS_NS_PREFIX.equals(importedNode.getNodeName())) {
+                    newNode = createAttribute(importedNode.getNodeName());
+                } else {
+                    newNode = createAttributeNS(importedNode.getNamespaceURI(),
+                            importedNode.getNodeName());
+                }
+            }
+            ((Attr) newNode).setValue(importedNode.getNodeValue());
+            break;
+        }
+
+        case Node.TEXT_NODE: {
+            newNode = createTextNode(importedNode.getNodeValue());
+            break;
+        }
+
+        case Node.DOCUMENT_FRAGMENT_NODE: {
+            newNode = createDocumentFragment();
+            // No name, kids carry value
+            break;
+        }
+
+        case Node.CDATA_SECTION_NODE:
+        case Node.ENTITY_REFERENCE_NODE:
+        case Node.ENTITY_NODE:
+        case Node.PROCESSING_INSTRUCTION_NODE:
+        case Node.COMMENT_NODE:
+        case Node.DOCUMENT_TYPE_NODE:
+        case Node.NOTATION_NODE:
+            throw new UnsupportedOperationException("TODO");
+
+        case Node.DOCUMENT_NODE: // Can't import document nodes
+        default: { // Unknown node type
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN, "NOT_SUPPORTED_ERR", null);
+            throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg);
+        }
+
+        }
+
+        // If deep, replicate and attach the kids.
+        if (deep) {
+            for (Node srckid = importedNode.getFirstChild(); srckid != null; 
+                    srckid = srckid.getNextSibling()) {
+                newNode.appendChild(importNode(srckid, true));
+            }
+        }
+
+        return newNode;
+
+    }
+
+    public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public void internalSerializeAndConsume(XMLStreamWriter writer)
+            throws XMLStreamException {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public void serializeAndConsume(XMLStreamWriter xmlWriter)
+            throws XMLStreamException {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    // /
+    // /OMDocument Methods
+    // /
+    public String getCharsetEncoding() {
+        return this.charEncoding;
+    }
+
+    public String getXMLVersion() {
+        return this.xmlVersion;
+    }
+
+    public String isStandalone() {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public void setCharsetEncoding(String charsetEncoding) {
+        this.charEncoding = charsetEncoding;
+    }
+
+    public void setOMDocumentElement(OMElement rootElement) {
+        this.firstChild = (ElementImpl) rootElement;
+    }
+
+    public void setStandalone(String isStandalone) {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public void serializeAndConsume(OutputStream output, OMOutputFormat format)
+            throws XMLStreamException {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public void serialize(OutputStream output, OMOutputFormat format)
+            throws XMLStreamException {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public void setXMLVersion(String version) {
+        this.xmlVersion = version;
+    }
+
+    /**
+     * Returns the document element.
+     * 
+     * @see org.apache.axiom.om.OMDocument#getOMDocumentElement()
+     */
+    public OMElement getOMDocumentElement() {
+        
+        //We'r sure that only an element can be the first child of a Document
+        if (this.documentElement == null && !this.done) {
+            this.builder.next();
+        }
+        return this.documentElement;
+    }
+
+    /**
+     * Returns the document element.
+     * 
+     * @see org.w3c.dom.Document#getDocumentElement()
+     */
+    public Element getDocumentElement() {
+
+        return (Element) this.getOMDocumentElement();
+    }
+
+    /**
+     * Borrowed from the Xerces impl. Checks if the given qualified name is
+     * legal with respect to the version of XML to which this document must
+     * conform.
+     * 
+     * @param prefix
+     *            prefix of qualified name
+     * @param local
+     *            local part of qualified name
+     */
+    protected final void checkQName(String prefix, String local) {
+
+        // check that both prefix and local part match NCName
+        boolean validNCName = (prefix == null || XMLChar.isValidNCName(prefix))
+                && XMLChar.isValidNCName(local);
+
+        if (!validNCName) {
+            // REVISIT: add qname parameter to the message
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR",
+                    null);
+            throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
+        }
+
+        if (prefix == null || prefix.equals("")) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN, "NAMESPACE_ERR", null);
+            throw new DOMException(DOMException.NAMESPACE_ERR, msg);
+        }
+    }
+
+    public void build() {
+        if(this.firstChild != null && !this.firstChild.done) {
+            this.firstChild.build();
+        }
+        this.done = true;
+    }
+    
+    protected void addIdAttr(Attr attr) {
+        if(this.idAttrs == null) {
+            this.idAttrs = new Vector();
+        }
+        this.idAttrs.add(attr);
+    }
+    
+    protected void removeIdAttr(Attr attr) {
+        if(this.idAttrs != null) {
+            this.idAttrs.remove(attr);
+        }
+        
+    }
+    
+    /*
+     * DOM-Level 3 methods
+     */
+
+    public Node adoptNode(Node node) throws DOMException {
+        //OK... I'm cheating here,  a BIG TODO
+        return this.importNode(node, true);
+    }
+
+    public String getDocumentURI() {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public DOMConfiguration getDomConfig() {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public String getInputEncoding() {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public boolean getStrictErrorChecking() {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public String getXmlEncoding() {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public boolean getXmlStandalone() {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public String getXmlVersion() {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public void normalizeDocument() {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public Node renameNode(Node arg0, String arg1, String arg2)
+            throws DOMException {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public void setDocumentURI(String arg0) {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public void setStrictErrorChecking(boolean arg0) {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public void setXmlStandalone(boolean arg0) throws DOMException {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public void setXmlVersion(String arg0) throws DOMException {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
new file mode 100644
index 0000000..f950ec6
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
@@ -0,0 +1,1480 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom;
+
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMConstants;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
+import org.apache.axiom.om.impl.traverse.OMChildElementIterator;
+import org.apache.axiom.om.impl.util.EmptyIterator;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.om.util.ElementHelper;
+import org.w3c.dom.Attr;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.TypeInfo;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+/**
+ * Implementation of the org.w3c.dom.Element and org.apache.axiom.om.Element
+ * interfaces.
+ */
+public class ElementImpl extends ParentNode implements Element, OMElement,
+        OMConstants {
+
+    private int lineNumber;
+
+    protected OMNamespace namespace;
+
+    protected String localName;
+
+    private AttributeMap attributes;
+
+    private HashMap namespaces;
+
+    private static final EmptyIterator EMPTY_ITERATOR = new EmptyIterator();
+    
+    /**
+     * @param ownerDocument
+     */
+    public ElementImpl(DocumentImpl ownerDocument, String tagName,
+                       OMFactory factory) {
+        super(ownerDocument, factory);
+        if (ownerDocument.firstChild == null) {
+            ownerDocument.firstChild = this;
+        }
+        this.localName = tagName;
+        this.attributes = new AttributeMap(this);
+        this.done = true;
+    }
+
+    /**
+     * Creates a new element with the namespace.
+     *
+     * @param ownerDocument
+     * @param tagName
+     * @param ns
+     */
+    public ElementImpl(DocumentImpl ownerDocument, String tagName,
+                       NamespaceImpl ns, OMFactory factory) {
+        super(ownerDocument, factory);
+        this.localName = tagName;
+        this.namespace = ns;
+        this.declareNamespace(ns);
+        this.attributes = new AttributeMap(this);
+        this.done = true;
+    }
+
+    public ElementImpl(DocumentImpl ownerDocument, String tagName,
+                       NamespaceImpl ns, OMXMLParserWrapper builder, OMFactory factory) {
+        super(ownerDocument, factory);
+        this.localName = tagName;
+        this.namespace = ns;
+        this.builder = builder;
+        this.declareNamespace(ns);
+        this.attributes = new AttributeMap(this);
+    }
+
+    public ElementImpl(ParentNode parentNode, String tagName, NamespaceImpl ns,
+                       OMFactory factory) {
+        this((DocumentImpl) parentNode.getOwnerDocument(), tagName, ns, factory);
+        this.parentNode = parentNode;
+        this.parentNode.addChild(this);
+        this.done = true;
+    }
+
+    public ElementImpl(ParentNode parentNode, String tagName, NamespaceImpl ns,
+                       OMXMLParserWrapper builder, OMFactory factory) {
+        this(tagName, ns, builder, factory);
+        if (parentNode != null) {
+            this.ownerNode = (DocumentImpl) parentNode.getOwnerDocument();
+            this.isOwned(true);
+            this.parentNode = parentNode;
+            this.parentNode.addChild(this);
+        }
+
+    }
+
+    public ElementImpl(String tagName, NamespaceImpl ns,
+                       OMXMLParserWrapper builder, OMFactory factory) {
+        this(factory);
+        this.localName = tagName;
+        this.namespace = ns;
+        this.builder = builder;
+        if (ns != null) {
+            this.declareNamespace(ns);
+        }
+        this.attributes = new AttributeMap(this);
+    }
+
+    public ElementImpl(OMFactory factory) {
+        super(factory);
+        this.ownerNode = ((OMDOMFactory) factory).getDocument();
+    }
+
+    // /
+    // /org.w3c.dom.Node methods
+    // /
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.w3c.dom.Node#getNodeType()
+     */
+    public short getNodeType() {
+        return Node.ELEMENT_NODE;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.w3c.dom.Node#getNodeName()
+     */
+    public String getNodeName() {
+        if (this.namespace != null) {
+            if (this.namespace.getPrefix() == null
+                    || "".equals(this.namespace.getPrefix())) {
+                return this.localName;
+            } else {
+                return this.namespace.getPrefix() + ":" + this.localName;
+            }
+        } else {
+            return this.localName;
+        }
+    }
+
+    /**
+     * Returns the value of the namespace URI.
+     */
+    public String getNamespaceURI() {
+        return (this.namespace != null) ? this.namespace.getNamespaceURI() : null;
+    }
+
+    // /
+    // /org.apache.axiom.om.OMNode methods
+    // /
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.axiom.om.OMNode#getType()
+     */
+    public int getType() throws OMException {
+        return OMNode.ELEMENT_NODE;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.axiom.om.OMNode#setType(int)
+     */
+    public void setType(int nodeType) throws OMException {
+        // Do nothing ...
+        // This is an Eement Node...
+    }
+
+    // /
+    // / org.w3c.dom.Element methods
+    // /
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.w3c.dom.Element#getTagName()
+     */
+    public String getTagName() {
+        return this.getNodeName();
+    }
+
+    /**
+     * Removes an attribute by name.
+     *
+     * @param name The name of the attribute to remove
+     * @see org.w3c.dom.Element#removeAttribute(String)
+     */
+    public void removeAttribute(String name) throws DOMException {
+        if (this.isReadonly()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NO_MODIFICATION_ALLOWED_ERR", null);
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    msg);
+        }
+
+        if (name.startsWith(OMConstants.XMLNS_NS_PREFIX)) {
+            String namespacePrefix = DOMUtil.getLocalName(name);
+            if (this.findNamespaceURI(namespacePrefix) != null) {
+                this.removeNamespace(namespacePrefix);
+            }
+        }
+
+        if (this.attributes != null) {
+            this.attributes.removeNamedItem(name);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.w3c.dom.Element#removeAttributeNS(java.lang.String,
+     *      java.lang.String)
+     */
+    public void removeAttributeNS(String namespaceURI, String localName)
+            throws DOMException {
+        if (this.isReadonly()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NO_MODIFICATION_ALLOWED_ERR", null);
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    msg);
+        }
+
+        if(OMConstants.XMLNS_NS_URI.equals(namespaceURI)) {
+            //look in the ns list
+            if(this.namespaces != null) {
+                this.namespaces.remove(DOMUtil.getLocalName(localName));
+            }
+            
+        } else if (this.attributes != null) {
+            this.attributes.removeNamedItemNS(namespaceURI, localName);
+        }
+    }
+
+    /**
+     * Removes the specified attribute node.
+     *
+     * @see org.w3c.dom.Element#removeAttributeNode(org.w3c.dom.Attr)
+     */
+    public Attr removeAttributeNode(Attr oldAttr) throws DOMException {
+        if (isReadonly()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NO_MODIFICATION_ALLOWED_ERR", null);
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    msg);
+        }
+        if (this.attributes == null
+                || this.attributes.getNamedItem(oldAttr.getName()) == null) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR", null);
+            throw new DOMException(DOMException.NOT_FOUND_ERR, msg);
+        }
+        return (AttrImpl) this.attributes.removeNamedItem(oldAttr
+                .getName());
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.w3c.dom.Element#hasAttribute(java.lang.String)
+     */
+    public boolean hasAttribute(String name) {
+        return this.getAttributeNode(name) != null;
+    }
+
+    /**
+     * Returns whether the given attribute is available or not.
+     *
+     * @see org.w3c.dom.Element#hasAttributeNS(String,
+     *      String)
+     */
+    public boolean hasAttributeNS(String namespaceURI, String localName) {
+        return this.getAttributeNodeNS(namespaceURI, localName) != null;
+    }
+
+    /**
+     * Looks in the local list of attributes and returns if found. If the local
+     * list is null, returns "".
+     *
+     * @see org.w3c.dom.Element#getAttribute(String)
+     */
+    public String getAttribute(String name) {
+        if (attributes == null) {
+            return "";
+        } else {
+            Attr attr = ((Attr) attributes.getNamedItem(name));
+            return (attr != null) ? attr.getValue() : "";
+        }
+    }
+
+    /**
+     * Retrieves an attribute node by name.
+     *
+     * @see org.w3c.dom.Element#getAttributeNode(String)
+     */
+    public Attr getAttributeNode(String name) {
+        return (this.attributes == null) ? null : (AttrImpl) this.attributes
+                .getNamedItem(name);
+    }
+
+    /**
+     * Retrieves an attribute value by local name and namespace URI.
+     *
+     * @see org.w3c.dom.Element#getAttributeNS(String,
+     *      String)
+     */
+    public String getAttributeNS(String namespaceURI, String localName) {
+        if (this.attributes == null) {
+            return "";
+        }
+        Attr attributeNodeNS = this.getAttributeNodeNS(namespaceURI, localName);
+        return attributeNodeNS == null ? "" : attributeNodeNS.getValue();
+    }
+
+    /**
+     * Retrieves an attribute node by local name and namespace URI.
+     *
+     * @see org.w3c.dom.Element#getAttributeNodeNS(String,
+     *      String)
+     */
+    public Attr getAttributeNodeNS(String namespaceURI, String localName) {
+
+        if (namespaceURI == OMConstants.XMLNS_NS_URI) {
+            OMNamespace ns = this.findNamespaceURI(localName);
+            AttrImpl namespaceAttr = new AttrImpl(this.ownerNode, localName, ns
+                    .getNamespaceURI(), this.factory);
+            NamespaceImpl xmlNs = new NamespaceImpl(OMConstants.XMLNS_NS_URI);
+            namespaceAttr.setOMNamespace(xmlNs);
+            return namespaceAttr;
+        }
+
+        return (this.attributes == null) ? null : (Attr) this.attributes
+                .getNamedItemNS(namespaceURI, localName);
+
+    }
+
+    /**
+     * Adds a new attribute node.
+     *
+     * @see org.w3c.dom.Element#setAttributeNode(org.w3c.dom.Attr)
+     */
+    public Attr setAttributeNode(Attr attr) throws DOMException {
+        AttrImpl attrImpl = (AttrImpl) attr;
+
+        if (attrImpl.isOwned()) {// check for ownership
+            if (!this.getOwnerDocument().equals(attr.getOwnerDocument())) {
+                String msg = DOMMessageFormatter.formatMessage(
+                        DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR",
+                        null);
+                throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, msg);
+            }
+        }
+
+        if (this.isReadonly()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NO_MODIFICATION_ALLOWED_ERR", null);
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    msg);
+        }
+
+        // check whether the attr is in use
+        if (attrImpl.isUsed()) {
+            String msg = DOMMessageFormatter
+                    .formatMessage(DOMMessageFormatter.DOM_DOMAIN,
+                            "INUSE_ATTRIBUTE_ERR", null);
+            throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, msg);
+        }
+
+        if (attr.getNodeName().startsWith(OMConstants.XMLNS_NS_PREFIX + ":")) {
+            // This is a ns declaration
+            this.declareNamespace(attr.getNodeValue(), DOMUtil
+                    .getLocalName(attr.getName()));
+        }
+        if (this.attributes == null) {
+            this.attributes = new AttributeMap(this);
+        }
+
+        return (Attr) this.attributes.setNamedItem(attr);
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.w3c.dom.Element#setAttribute(java.lang.String, java.lang.String)
+     */
+    public void setAttribute(String name, String value) throws DOMException {
+        // Check for invalid charaters
+        if (!DOMUtil.isValidChras(name)) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR",
+                    null);
+            throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
+        }
+        if (name.startsWith(OMConstants.XMLNS_NS_PREFIX + ":")) {
+            // This is a ns declaration
+            this.declareNamespace(value, DOMUtil.getLocalName(name));
+        } else {
+            this.setAttributeNode(new AttrImpl(this.ownerNode, name, value,
+                    this.factory));
+        }
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.w3c.dom.Element#setAttributeNodeNS(org.w3c.dom.Attr)
+     */
+    public Attr setAttributeNodeNS(Attr attr) throws DOMException {
+
+        // Check whether the attr is a namespace declaration
+        // if so add a namespace NOT an attribute
+        if (attr.getNamespaceURI() != null
+                && attr.getNamespaceURI().equals(OMConstants.XMLNS_NS_URI)) {
+            this.declareNamespace(attr.getName(), attr.getValue());
+            return attr;
+        } else {
+            AttrImpl attrImpl = (AttrImpl) attr;
+
+            if (attrImpl.isOwned()) {// check for ownership
+                if (!this.getOwnerDocument().equals(attr.getOwnerDocument())) {
+                    String msg = DOMMessageFormatter.formatMessage(
+                            DOMMessageFormatter.DOM_DOMAIN,
+                            "WRONG_DOCUMENT_ERR", null);
+                    throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, msg);
+                }
+            }
+
+            if (this.isReadonly()) {
+                String msg = DOMMessageFormatter.formatMessage(
+                        DOMMessageFormatter.DOM_DOMAIN,
+                        "NO_MODIFICATION_ALLOWED_ERR", null);
+                throw new DOMException(
+                        DOMException.NO_MODIFICATION_ALLOWED_ERR, msg);
+            }
+
+            // check whether the attr is in use
+            if (attrImpl.isUsed()) {
+                String msg = DOMMessageFormatter.formatMessage(
+                        DOMMessageFormatter.DOM_DOMAIN, "INUSE_ATTRIBUTE_ERR",
+                        null);
+                throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, msg);
+            }
+
+            if (this.attributes == null) {
+                this.attributes = new AttributeMap(this);
+            }
+
+            // handle the namespaces
+            if (attr.getNamespaceURI() != null
+                    && findNamespace(attr.getNamespaceURI(), attr.getPrefix())
+                    == null) {
+                // TODO checkwhether the same ns is declared with a different
+                // prefix and remove it
+                this.declareNamespace(new NamespaceImpl(attr.getNamespaceURI(),
+                        attr.getPrefix()));
+            }
+
+            return (Attr) this.attributes.setNamedItemNS(attr);
+        }
+    }
+
+    /**
+     * Adds a new attribute.
+     *
+     * @see org.w3c.dom.Element#setAttributeNS(String,
+     *      String, String)
+     */
+    public void setAttributeNS(String namespaceURI, String qualifiedName,
+                               String value) throws DOMException {
+
+        if (namespaceURI != null && !"".equals(namespaceURI)) {
+            if (namespaceURI.equals(OMConstants.XMLNS_NS_URI)) {
+                this.declareNamespace(value, DOMUtil
+                        .getLocalName(qualifiedName));
+            } else {
+                AttrImpl attr = new AttrImpl(this.ownerNode, DOMUtil
+                        .getLocalName(qualifiedName), value, this.factory);
+                attr.setOMNamespace(new NamespaceImpl(namespaceURI, DOMUtil
+                        .getPrefix(qualifiedName)));
+
+                this.setAttributeNodeNS(attr);
+            }
+        } else {
+            // When the namespace is null, the attr name given better not be
+            // a qualified name
+            // But anyway check and set it
+            this.setAttribute(DOMUtil.getLocalName(qualifiedName), value);
+        }
+
+    }
+
+    private OMAttribute addAttribute(String namespaceURI, String qualifiedName,
+                                     String value) throws DOMException {
+        if (!DOMUtil.isValidChras(qualifiedName)) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR",
+                    null);
+            throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
+        }
+
+        if (this.isReadonly()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NO_MODIFICATION_ALLOWED_ERR", null);
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    msg);
+        }
+
+        if (this.attributes == null) {
+            this.attributes = new AttributeMap(this);
+        }
+        if (namespaceURI != null) {
+            if (!DOMUtil.isValidNamespace(namespaceURI, qualifiedName)) {
+                String msg = DOMMessageFormatter.formatMessage(
+                        DOMMessageFormatter.DOM_DOMAIN, "NAMESPACE_ERR", null);
+                throw new DOMException(DOMException.NAMESPACE_ERR, msg);
+            }
+            // Check whether there's an existing Attr with same local name and
+            // namespace URI
+            Attr attributeNode = this.getAttributeNodeNS(namespaceURI, DOMUtil
+                    .getLocalName(qualifiedName));
+            if (attributeNode != null) {
+                AttrImpl tempAttr = ((AttrImpl) attributeNode);
+                tempAttr.setOMNamespace(new NamespaceImpl(namespaceURI, DOMUtil
+                        .getPrefix(qualifiedName)));
+                tempAttr.setAttributeValue(value);
+                this.attributes.setNamedItem(tempAttr);
+                return tempAttr;
+            } else {
+                NamespaceImpl ns = new NamespaceImpl(namespaceURI, DOMUtil
+                        .getPrefix(qualifiedName));
+                AttrImpl attr = new AttrImpl((DocumentImpl) this
+                        .getOwnerDocument(), DOMUtil
+                        .getLocalName(qualifiedName), ns, value, this.factory);
+                this.attributes.setNamedItem(attr);
+                return attr;
+            }
+        } else {
+            Attr attributeNode = this.getAttributeNode(qualifiedName);
+            if (attributeNode != null) {
+                AttrImpl tempAttr = ((AttrImpl) attributeNode);
+                tempAttr.setAttributeValue(value);
+                this.attributes.setNamedItem(tempAttr);
+                return tempAttr;
+            } else {
+                AttrImpl attr = new AttrImpl((DocumentImpl) this
+                        .getOwnerDocument(), qualifiedName, value, this.factory);
+                this.attributes.setNamedItem(attr);
+                return attr;
+            }
+        }
+    }
+
+    /**
+     * Returns whether this element contains any attribute or not.
+     */
+    public boolean hasAttributes() {
+
+        boolean flag = false;
+        if (this.attributes != null) {
+            flag = (this.attributes.getLength() > 0);
+        }
+
+        //The namespaces
+        flag = this.namespace != null;
+
+        if (!flag) {
+            if (this.namespaces != null) {
+                flag = !this.namespaces.isEmpty();
+            } else if (this.namespace != null) {
+                flag = true;
+            }
+        }
+
+
+        return flag;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.w3c.dom.Element#getElementsByTagNameNS(java.lang.String,
+     *      java.lang.String)
+     */
+    public NodeList getElementsByTagNameNS(String namespaceURI,
+                                           String localName) {
+        return new NodeListImpl(this, namespaceURI, localName);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.w3c.dom.Element#getElementsByTagName(java.lang.String)
+     */
+    public NodeList getElementsByTagName(String name) {
+        return new NodeListImpl(this, name);
+    }
+
+    // /
+    // /OmElement methods
+    // /
+
+    /**
+     * @see org.apache.axiom.om.OMElement#addAttribute
+     *      (org.apache.axiom.om.OMAttribute)
+     */
+    public OMAttribute addAttribute(OMAttribute attr) {
+        OMNamespace namespace = attr.getNamespace();
+        if (namespace != null
+                && this.findNamespace(namespace.getNamespaceURI(), namespace
+                .getPrefix()) == null) {
+            this.declareNamespace(namespace.getNamespaceURI(), namespace.getPrefix());
+        }
+
+        if (attr.getNamespace() != null) { // If the attr has a namespace
+            return (AttrImpl) this.setAttributeNode((Attr) attr);
+        } else {
+            return (AttrImpl) this.setAttributeNodeNS((Attr) attr);
+        }
+    }
+
+    /**
+     * The behaviour of this is the same as org.w3c.dom.Element#setAttributeNS
+     *
+     * @see org.apache.axiom.om.OMElement#addAttribute(String,
+     *      String, org.apache.axiom.om.OMNamespace)
+     */
+    public OMAttribute addAttribute(String attributeName, String value,
+                                    OMNamespace ns) {
+        if (ns != null && findNamespace(ns.getNamespaceURI(), ns.getPrefix()) != null) {
+            declareNamespace(ns);
+        }
+        if (ns != null) {
+            return this.addAttribute(ns.getNamespaceURI(), ns.getPrefix() + ":"
+                    + attributeName, value);
+        } else {
+            return this.addAttribute(null, attributeName, value);
+        }
+
+    }
+
+    /**
+     * Allows overriding an existing declaration if the same prefix was used.
+     *
+     * @see org.apache.axiom.om.OMElement#declareNamespace
+     *      (org.apache.axiom.om.OMNamespace)
+     */
+    public OMNamespace declareNamespace(OMNamespace namespace) {
+        if (namespaces == null) {
+            this.namespaces = new HashMap(5);
+        }
+
+        if (namespace != null) {
+            String prefix = namespace.getPrefix();
+            if ("".equals(prefix)) {
+                namespace = declareDefaultNamespace(namespace.getNamespaceURI());
+            } else if (prefix == null) {
+                prefix = OMSerializerUtil.getNextNSPrefix();
+                namespace = new NamespaceImpl(namespace.getNamespaceURI(), prefix);
+            }
+
+            if (!namespace.getPrefix().startsWith(OMConstants.XMLNS_NS_PREFIX)) {
+                namespaces.put(namespace.getPrefix(), namespace);
+            }
+        }
+        return namespace;
+    }
+
+    /**
+     * Allows overriding an existing declaration if the same prefix was used.
+     *
+     * @see org.apache.axiom.om.OMElement#declareNamespace(String,
+     *      String)
+     */
+    public OMNamespace declareNamespace(String uri, String prefix) {
+        if ("".equals(prefix))
+            prefix = OMSerializerUtil.getNextNSPrefix();
+        NamespaceImpl ns = new NamespaceImpl(uri, prefix);
+        return declareNamespace(ns);
+    }
+
+    /**
+     * We use "" to store the default namespace of this element. As one can see user can not give ""
+     * as the prefix, when he declare a usual namespace.
+     *
+     * @param uri
+     */
+    public OMNamespace declareDefaultNamespace(String uri) {
+        NamespaceImpl ns = new NamespaceImpl(uri, "");
+        if (namespaces == null) {
+            this.namespaces = new HashMap(5);
+        }
+        namespaces.put("", ns);
+        return ns;
+    }
+
+    public OMNamespace getDefaultNamespace() {
+        if (namespaces != null) {
+            NamespaceImpl defaultNS = (NamespaceImpl) namespaces.get("");
+            if (defaultNS != null) {
+                return defaultNS;
+            }
+        }
+
+        if (parentNode instanceof ElementImpl) {
+            ElementImpl element = (ElementImpl) parentNode;
+            element.getDefaultNamespace();
+        }
+        return null;
+    }
+
+    /**
+     * @see org.apache.axiom.om.OMElement#findNamespace(java.lang.String,
+     *      java.lang.String)
+     */
+    public OMNamespace findNamespace(String uri, String prefix) {
+
+        // check in the current element
+        OMNamespace namespace = findDeclaredNamespace(uri, prefix);
+        if (namespace != null) {
+            return namespace;
+        }
+
+        // go up to check with ancestors
+        if (this.parentNode != null) {
+            // For the OMDocumentImpl there won't be any explicit namespace
+            // declarations, so going up the parent chain till the document
+            // element should be enough.
+            if (parentNode instanceof OMElement) {
+                namespace = ((ElementImpl) parentNode).findNamespace(uri,
+                        prefix);
+            }
+        }
+
+        if (namespace == null && uri != null && prefix != null
+                && prefix.equals(OMConstants.XMLNS_PREFIX)
+                && uri.equals(OMConstants.XMLNS_URI)) {
+            declareNamespace(OMConstants.XMLNS_URI, OMConstants.XMLNS_PREFIX);
+            namespace = findNamespace(uri, prefix);
+        }
+        return namespace;
+    }
+
+    public OMNamespace findNamespaceURI(String prefix) {
+        OMNamespace ns =  this.namespaces==null?
+                null:
+                (OMNamespace)this.namespaces.get(prefix);
+
+        if (ns == null && this.parentNode instanceof OMElement) {
+            // try with the parent
+            ns = ((OMElement) this.parentNode).findNamespaceURI(prefix);
+        }
+        return ns;
+    }
+
+    /**
+     * Checks for the namespace <B>only</B> in the current Element. This can
+     * also be used to retrieve the prefix of a known namespace URI.
+     */
+    private OMNamespace findDeclaredNamespace(String uri, String prefix) {
+
+        if (uri == null) {
+            return null;
+        }
+        // If the prefix is available and uri is available and its the xml
+        // namespace
+        if (prefix != null && prefix.equals(OMConstants.XMLNS_PREFIX)
+                && uri.equals(OMConstants.XMLNS_URI)) {
+            return new NamespaceImpl(uri, prefix);
+        }
+
+        if (namespaces == null) {
+            return null;
+        }
+
+        if (prefix == null || "".equals(prefix)) {
+            Iterator namespaceListIterator = namespaces.values().iterator();
+            while (namespaceListIterator.hasNext()) {
+                OMNamespace omNamespace = (OMNamespace) namespaceListIterator
+                        .next();
+                String nsURI = omNamespace.getNamespaceURI();
+                if (nsURI != null && nsURI.equals(uri)) {
+                    return omNamespace;
+                }
+            }
+
+        } else {
+            OMNamespace namespace = (OMNamespace) namespaces.get(prefix);
+            if (namespace != null && uri.equalsIgnoreCase(namespace.getNamespaceURI())) {
+                return namespace;
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * Returns a named attribute if present.
+     *
+     * @see org.apache.axiom.om.OMElement#getAttribute
+     *      (javax.xml.namespace.QName)
+     */
+    public OMAttribute getAttribute(QName qname) {
+        if (this.attributes == null) {
+            return null;
+        }
+
+        if (qname.getNamespaceURI() == null
+                || qname.getNamespaceURI().equals("")) {
+            return (AttrImpl) this.getAttributeNode(qname.getLocalPart());
+        } else {
+            return (AttrImpl) this.getAttributeNodeNS(qname.getNamespaceURI(),
+                    qname.getLocalPart());
+        }
+    }
+
+    /**
+     * Returns a named attribute's value, if present.
+     *
+     * @param qname the qualified name to search for
+     * @return Returns a String containing the attribute value, or null.
+     */
+    public String getAttributeValue(QName qname) {
+        OMAttribute attr = getAttribute(qname);
+        return (attr == null) ? null : attr.getAttributeValue();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.axiom.om.OMElement#getBuilder()
+     */
+    public OMXMLParserWrapper getBuilder() {
+        return this.builder;
+    }
+
+    /**
+     * Returns the first Element node.
+     *
+     * @see org.apache.axiom.om.OMElement#getFirstElement()
+     */
+    public OMElement getFirstElement() {
+        OMNode node = getFirstOMChild();
+        while (node != null) {
+            if (node.getType() == Node.ELEMENT_NODE) {
+                return (OMElement) node;
+            } else {
+                node = node.getNextOMSibling();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Returns the namespace of this element.
+     *
+     * @see org.apache.axiom.om.OMElement#getNamespace()
+     */
+    public OMNamespace getNamespace() throws OMException {
+        return namespace != null ? namespace : getDefaultNamespace();
+    }
+
+    /**
+     * Returns the QName of this element.
+     *
+     * @see org.apache.axiom.om.OMElement#getQName()
+     */
+    public QName getQName() {
+        QName qName;
+        if (namespace != null) {
+            if (namespace.getPrefix() != null) {
+                qName = new QName(namespace.getNamespaceURI(), this.localName,
+                        namespace.getPrefix());
+            } else {
+                qName = new QName(namespace.getNamespaceURI(), this.localName);
+            }
+        } else {
+            qName = new QName(this.localName);
+        }
+        return qName;
+    }
+
+    /**
+     * Gets all the text children and concatinates them to a single string.
+     *
+     * @see org.apache.axiom.om.OMElement#getText()
+     */
+    public String getText() {
+        String childText = "";
+        OMNode child = this.getFirstOMChild();
+        OMText textNode;
+
+        while (child != null) {
+            if (child.getType() == OMNode.TEXT_NODE) {
+                textNode = (OMText) child;
+                if (textNode.getText() != null
+                        && !"".equals(textNode.getText())) {
+                    childText += textNode.getText();
+                }
+            }
+            child = child.getNextOMSibling();
+        }
+
+        return childText;
+    }
+
+    public QName getTextAsQName() {
+        String childText = "";
+        OMNode child = this.getFirstOMChild();
+        OMText textNode;
+
+        while (child != null) {
+            if (child.getType() == OMNode.TEXT_NODE) {
+                textNode = (OMText) child;
+                if (textNode.getText() != null
+                        && !"".equals(textNode.getText())) {
+                    String namespaceURI = textNode.getTextAsQName().getNamespaceURI();
+                    if (namespaceURI != null && !"".equals(namespaceURI)) {
+                        return textNode.getTextAsQName();
+                    }
+                    childText += textNode.getText();
+                }
+            }
+            child = child.getNextOMSibling();
+        }
+
+        return new QName(childText);
+    }
+
+    /**
+     * Removes an attribute from the element.
+     *
+     * @see org.apache.axiom.om.OMElement#removeAttribute
+     *      (org.apache.axiom.om.OMAttribute)
+     */
+    public void removeAttribute(OMAttribute attr) {
+        this.removeAttributeNode((AttrImpl) attr);
+    }
+
+    /**
+     * Sets the OM builder.
+     *
+     * @see org.apache.axiom.om.OMElement#setBuilder
+     *      (org.apache.axiom.om.OMXMLParserWrapper)
+     */
+    public void setBuilder(OMXMLParserWrapper wrapper) {
+        this.builder = wrapper;
+    }
+
+    /**
+     * Sets the local name.
+     *
+     * @see org.apache.axiom.om.OMElement#setLocalName(String)
+     */
+    public void setLocalName(String localName) {
+        this.localName = localName;
+    }
+
+    /**
+     * Sets the namespace.
+     *
+     * @see org.apache.axiom.om.OMElement#setNamespace
+     *      (org.apache.axiom.om.OMNamespace)
+     */
+    public void setNamespace(OMNamespace namespace) {
+        this.namespace = namespace;
+    }
+
+    public void setNamespaceWithNoFindInCurrentScope(OMNamespace namespace) {
+        this.namespace = namespace;
+    }
+
+    /**
+     * Creates a text node with the given value and adds it to the element.
+     *
+     * @see org.apache.axiom.om.OMElement#setText(String)
+     */
+    public void setText(String text) {
+        if (this.isReadonly()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NO_MODIFICATION_ALLOWED_ERR", null);
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    msg);
+        }
+
+        // if we already have other text nodes remove them
+        OMNode child = this.getFirstOMChild();
+        while (child != null) {
+            if (child.getType() == OMNode.TEXT_NODE) {
+                child.detach();
+            }
+            child = child.getNextOMSibling();
+        }
+
+        TextImpl textNode = (TextImpl) (this.ownerNode)
+                .createTextNode(text);
+        this.addChild(textNode);
+    }
+
+    public void setText(QName text) {
+        throw new UnsupportedOperationException();
+    }
+
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
+        internalSerialize(writer, true);
+    }
+
+    public void internalSerializeAndConsume(XMLStreamWriter writer)
+            throws XMLStreamException {
+        this.internalSerialize(writer, false);
+    }
+
+    protected void internalSerialize(XMLStreamWriter writer,
+                                     boolean cache) throws XMLStreamException {
+
+        if (!cache) {
+            // in this case we don't care whether the elements are built or not
+            // we just call the serializeAndConsume methods
+            OMSerializerUtil.serializeStartpart(this, writer);
+            // serilize children
+            Iterator children = this.getChildren();
+            while (children.hasNext()) {
+                ((OMNodeEx) children.next()).internalSerialize(writer);
+            }
+            OMSerializerUtil.serializeEndpart(writer);
+
+        } else {
+            // Now the caching is supposed to be off. However caching been
+            // switched off
+            // has nothing to do if the element is already built!
+            if (this.done) {
+                OMSerializerUtil.serializeStartpart(this, writer);
+                ChildNode child = this.firstChild;
+                while (child != null
+                        && ((!(child instanceof OMElement)) || child
+                        .isComplete())) {
+                    child.internalSerializeAndConsume(writer);
+                    child = child.nextSibling;
+                }
+                if (child != null) {
+                    OMElement element = (OMElement) child;
+                    element.getBuilder().setCache(false);
+                    OMSerializerUtil.serializeByPullStream(element, writer,
+                            cache);
+                }
+                OMSerializerUtil.serializeEndpart(writer);
+            } else {
+                // take the XMLStream reader and feed it to the stream
+                // serilizer.
+                // todo is this right ?????
+                OMSerializerUtil.serializeByPullStream(this, writer, cache);
+            }
+
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.axiom.om.OMElement#getXMLStreamReaderWithoutCaching()
+     */
+    public XMLStreamReader getXMLStreamReaderWithoutCaching() {
+        return getXMLStreamReader(false);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.axiom.om.OMElement#getXMLStreamReader()
+     */
+    public XMLStreamReader getXMLStreamReader() {
+        return getXMLStreamReader(true);
+    }
+
+    /**
+     * getXMLStreamReader
+     *
+     * @return Returns reader.
+     */
+    private XMLStreamReader getXMLStreamReader(boolean cache) {
+        if ((builder == null) && !cache) {
+            throw new UnsupportedOperationException(
+                    "This element was not created in a manner to be switched");
+        }
+        if (builder != null && builder.isCompleted() && !cache) {
+            throw new UnsupportedOperationException(
+                    "The parser is already consumed!");
+        }
+        return new DOMStAXWrapper(builder, this, cache);
+    }
+
+    public String toStringWithConsume() throws XMLStreamException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        this.serializeAndConsume(baos);
+        return new String(baos.toByteArray());
+    }
+
+    /**
+     * Overridden toString() for ease of debugging.
+     *
+     * @see Object#toString()
+     */
+    public String toString() {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try {
+//            this.build();
+            this.serialize(baos);
+        } catch (XMLStreamException e) {
+            throw new RuntimeException("Can not serialize OM Element " + this.getLocalName(), e);
+        }
+        return new String(baos.toByteArray());
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.axiom.om.OMElement#getChildElements()
+     */
+    public Iterator getChildElements() {
+        return new OMChildElementIterator(getFirstElement());
+    }
+
+    /**
+     * @see org.apache.axiom.om.OMElement#getAllDeclaredNamespaces()
+     */
+    public Iterator getAllDeclaredNamespaces() throws OMException {
+        if (namespaces == null) {
+            return null;
+        }
+        return namespaces.values().iterator();
+    }
+
+    /**
+     * @see org.apache.axiom.om.OMElement#getAllAttributes()
+     */
+    public Iterator getAllAttributes() {
+        if (attributes == null) {
+            return EMPTY_ITERATOR;
+        }
+        ArrayList list = new ArrayList();
+        for (int i = 0; i < attributes.getLength(); i++) {
+            OMAttribute item = (OMAttribute) attributes.getItem(i);
+            if (item.getNamespace() == null
+                    || !(item.getNamespace() != null && OMConstants.XMLNS_NS_URI
+                    .equals(item.getNamespace().getNamespaceURI()))) {
+                list.add(item);
+            }
+        }
+
+        return list.iterator();
+    }
+
+    /**
+     * Returns the local name of this element node
+     *
+     * @see org.w3c.dom.Node#getLocalName()
+     */
+    public String getLocalName() {
+        return this.localName;
+    }
+
+    /**
+     * Returns the namespace prefix of this element node
+     *
+     * @see org.w3c.dom.Node#getPrefix()
+     */
+    public String getPrefix() {
+        return (this.namespace == null) ? null : this.namespace.getPrefix();
+    }
+
+    /**
+     * @see NodeImpl#setOwnerDocument
+     *      (org.apache.axiom.om.impl.dom.DocumentImpl)
+     */
+    protected void setOwnerDocument(DocumentImpl document) {
+        this.ownerNode = document;
+        this.isOwned(true);
+        if (document.firstChild == null) {
+            document.firstChild = this;
+        }
+    }
+
+    /**
+     * Turn a prefix:local qname string into a proper QName, evaluating it in
+     * the OMElement context unprefixed qnames resolve to the local namespace
+     *
+     * @param qname prefixed qname string to resolve
+     * @return Returns null for any failure to extract a qname.
+     */
+    public QName resolveQName(String qname) {
+        ElementHelper helper = new ElementHelper(this);
+        return helper.resolveQName(qname);
+    }
+
+    /**
+     * Creates a clone which belongs to a new document.
+     *
+     * @see org.apache.axiom.om.OMElement#cloneOMElement()
+     */
+    public OMElement cloneOMElement() {
+        return (ElementImpl)this.cloneNode(true);
+    }
+
+    public void setLineNumber(int lineNumber) {
+        this.lineNumber = lineNumber;
+    }
+
+    public int getLineNumber() {
+        return lineNumber;
+    }
+
+    public Node cloneNode(boolean deep) {
+
+        ElementImpl newnode = (ElementImpl) super.cloneNode(deep);
+        // Replicate NamedNodeMap rather than sharing it.
+        if (attributes != null) {
+            newnode.attributes = (AttributeMap) attributes.cloneMap(newnode);
+        }
+        return newnode;
+
+    }
+
+    /**
+     * Returns the set of attributes of this node and the namespace declarations
+     * available.
+     */
+    public NamedNodeMap getAttributes() {
+        AttributeMap attributeMap = new AttributeMap(this);
+
+        // Add the set of existing attrs
+        for (int i = 0; i < this.attributes.getLength(); i++) {
+            attributeMap.addItem((Attr) this.attributes.getItem(i));
+        }
+
+        // Add the NS declarations
+        if (this.namespaces != null) {
+            Iterator nsDecls = this.namespaces.keySet().iterator();
+            while (nsDecls.hasNext()) {
+                String prefix = (String) nsDecls.next();
+                if (prefix != null && !"".equals(prefix)
+                        && !prefix.equals(OMConstants.XMLNS_NS_PREFIX)) {
+                    OMNamespace ns = (OMNamespace) this.namespaces.get(prefix);
+                    AttrImpl attr = new AttrImpl(this.ownerNode, prefix, ns
+                            .getNamespaceURI(), this.factory);
+                    attr.setOMNamespace(new NamespaceImpl(
+                            OMConstants.XMLNS_NS_URI,
+                            OMConstants.XMLNS_NS_PREFIX));
+                    attributeMap.addItem(attr);
+                }
+            }
+
+            // Set the default NS attr if any
+            if (this.namespace != null
+                    && (this.namespace.getPrefix() == null || ""
+                    .equals(this.namespace.getPrefix()))
+                    && this.namespace.getNamespaceURI() != null) {
+
+                // check if the parent of this element has the same namespace
+                // as the default and if NOT add the attr
+                if (this.parentNode != null && this.parentNode.getNamespaceURI() != this.getNamespaceURI()) {
+                    AttrImpl attr = new AttrImpl(this.ownerNode, "xmlns",
+                            this.namespace.getNamespaceURI(), this.factory);
+                    attr.setOMNamespace(new NamespaceImpl(
+                            OMConstants.XMLNS_NS_URI,
+                            OMConstants.XMLNS_NS_PREFIX));
+                    attributeMap.addItem(attr);
+                }
+            }
+        }
+
+        return attributeMap;
+    }
+
+    /**
+     * Returns the namespace uri, given the prefix. If it is not found at this
+     * element, searches the parent.
+     *
+     * @param prefix
+     * @return Returns namespace.
+     */
+    public String getNamespaceURI(String prefix) {
+        OMNamespace ns = this.findNamespaceURI(prefix);
+        return (ns != null) ? ns.getNamespaceURI() : null;
+    }
+
+    /**
+     * Removes a declared namespace given its prefix.
+     *
+     * @param prefix
+     * @return Returns whether the namespace relevant to the given prefix was
+     *         removed or not
+     */
+    public boolean removeNamespace(String prefix) {
+        Object ns = this.namespaces.get(prefix);
+        if (ns != null) {
+            this.namespaces.remove(prefix);
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    public OMNode getNextOMSibling() throws OMException {
+        while (!done) {
+            int token = builder.next();
+            if (token == XMLStreamConstants.END_DOCUMENT) {
+                throw new OMException();
+            }
+        }
+        return super.getNextOMSibling();
+    }
+
+    public void discard() throws OMException {
+        if (done) {
+            this.detach();
+        } else {
+            builder.discard(this);
+        }
+    }
+
+    /*
+     * DOM-Level 3 methods
+     */
+
+    public void setIdAttribute(String name, boolean isId) throws DOMException {
+        if (this.isReadonly()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NO_MODIFICATION_ALLOWED_ERR", null);
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    msg);
+        }
+        //find the attr
+        AttrImpl tempAttr = (AttrImpl)this.getAttributeNode(name);
+        if(tempAttr == null) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NOT_FOUND_ERR", null);
+            throw new DOMException(DOMException.NOT_FOUND_ERR,
+                    msg);
+        }
+        
+        this.updateIsId(isId, tempAttr);
+    }
+
+    public void setIdAttributeNS(String namespaceURI, String localName, boolean isId)
+            throws DOMException {
+        if (this.isReadonly()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NO_MODIFICATION_ALLOWED_ERR", null);
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    msg);
+        }
+        //find the attr
+        AttrImpl tempAttr = (AttrImpl)this.getAttributeNodeNS(namespaceURI, localName);
+        if(tempAttr == null) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NOT_FOUND_ERR", null);
+            throw new DOMException(DOMException.NOT_FOUND_ERR,
+                    msg);
+        }
+        
+        this.updateIsId(isId, tempAttr);
+    }
+    
+    public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException {
+        if (this.isReadonly()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NO_MODIFICATION_ALLOWED_ERR", null);
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    msg);
+        }
+        //find the attr
+        Iterator attrIter = this.getAllAttributes();
+        AttrImpl tempAttr = null;
+        while (attrIter.hasNext()) {
+            AttrImpl attr = (AttrImpl) attrIter.next();
+            if(attr.equals(idAttr)) {
+                tempAttr = attr;
+                break;
+            }
+        }
+        
+        if(tempAttr == null) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NOT_FOUND_ERR", null);
+            throw new DOMException(DOMException.NOT_FOUND_ERR,
+                    msg);
+        }
+        
+        this.updateIsId(isId, tempAttr);
+    }
+    
+    /**
+     * Updates the id state of the attr and notifies the document 
+     * @param isId
+     * @param tempAttr
+     */
+    private void updateIsId(boolean isId, AttrImpl tempAttr) {
+        tempAttr.isId = isId;
+        if(isId) {
+            this.ownerNode.addIdAttr(tempAttr);
+        } else {
+            this.ownerNode.removeIdAttr(tempAttr);
+        }
+    }
+    
+    public TypeInfo getSchemaTypeInfo() {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+    
+	/* (non-Javadoc)
+	 * @see org.apache.axiom.om.OMNode#buildAll()
+	 */
+	public void buildWithAttachments() {
+		if (!done)
+		{
+			this.build();
+		}
+		Iterator iterator = getChildren();
+		while(iterator.hasNext())
+		{
+			OMNode node = (OMNode)iterator.next();
+			node.buildWithAttachments();
+		}
+	}
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NamedNodeMapImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NamedNodeMapImpl.java
new file mode 100644
index 0000000..8a5dc41
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NamedNodeMapImpl.java
@@ -0,0 +1,466 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import org.w3c.dom.DOMException;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+import java.util.Vector;
+
+/**
+ * 
+ * Most of the implementation is taken from
+ * org.apache.xerces.dom.NamedNodeMapImpl
+ */
+public class NamedNodeMapImpl implements NamedNodeMap {
+
+    Vector nodes;
+
+    ParentNode ownerNode;
+
+    //
+    // Data
+    //
+
+    protected short flags;
+
+    protected final static short READONLY = 0x1 << 0;
+
+    protected final static short CHANGED = 0x1 << 1;
+
+    protected final static short HASDEFAULTS = 0x1 << 2;
+
+    protected NamedNodeMapImpl(ParentNode ownerNode) {
+        this.ownerNode = ownerNode;
+    }
+
+    /**
+     * 
+     */
+    public Node getNamedItem(String name) {
+        int i = findNamePoint(name, 0);
+        return (i < 0) ? null : (Node) (nodes.elementAt(i));
+
+    }
+
+    /**
+     * From org.apache.xerces.dom.NamedNodeMapImpl
+     */
+    public Node item(int index) {
+        return (nodes != null && index < nodes.size()) ? (Node) (nodes
+                .elementAt(index)) : null;
+    }
+
+    /**
+     * From org.apache.xerces.dom.NamedNodeMapImpl
+     */
+    public int getLength() {
+        return (nodes != null) ? nodes.size() : 0;
+    }
+
+    /**
+     * Removes a node specified by name.
+     * 
+     * @param name
+     *            The name of a node to remove.
+     * @return Returns the node removed from the map if a node with such a name
+     *         exists.
+     */
+    /***/
+    public Node removeNamedItem(String name) throws DOMException {
+
+        if (isReadOnly()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NO_MODIFICATION_ALLOWED_ERR", null);
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    msg);
+        }
+        int i = findNamePoint(name, 0);
+        if (i < 0) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR", null);
+            throw new DOMException(DOMException.NOT_FOUND_ERR, msg);
+        }
+
+        NodeImpl n = (NodeImpl) nodes.elementAt(i);
+        nodes.removeElementAt(i);
+
+        return n;
+
+    } // removeNamedItem(String):Node
+
+    /**
+     * Introduced in DOM Level 2. Retrieves a node specified by local name and
+     * namespace URI.
+     * 
+     * @param namespaceURI
+     *            The namespace URI of the node to retrieve. When it is null or
+     *            an empty string, this method behaves like getNamedItem.
+     * @param localName
+     *            The local name of the node to retrieve.
+     * @return Returns s Node (of any type) with the specified name, or null if
+     *         the specified name did not identify any node in the map.
+     */
+    public Node getNamedItemNS(String namespaceURI, String localName) {
+
+        int i = findNamePoint(namespaceURI, localName);
+        return (i < 0) ? null : (Node) (nodes.elementAt(i));
+
+    } // getNamedItemNS(String,String):Node
+
+    /**
+     * Adds a node using its namespaceURI and localName.
+     * 
+     * @see org.w3c.dom.NamedNodeMap#setNamedItem
+     * @return Returns the replaced Node if the new Node replaces an existing
+     *         node else returns null.
+     * @param arg
+     *            A node to store in a named node map. The node will later be
+     *            accessible using the value of the namespaceURI and localName
+     *            attribute of the node. If a node with those namespace URI and
+     *            local name is already present in the map, it is replaced by
+     *            the new one.
+     */
+    public Node setNamedItemNS(Node arg) throws DOMException {
+
+        DocumentImpl ownerDocument = (DocumentImpl) ownerNode
+                .getOwnerDocument();
+        if (isReadOnly()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NO_MODIFICATION_ALLOWED_ERR", null);
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    msg);
+        }
+
+        if (arg.getOwnerDocument() != ownerDocument) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null);
+            throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, msg);
+        }
+
+        int i = findNamePoint(arg.getNamespaceURI(), arg.getLocalName());
+        NodeImpl previous = null;
+        if (i >= 0) {
+            previous = (NodeImpl) nodes.elementAt(i);
+            nodes.setElementAt(arg, i);
+        } else {
+            // If we can't find by namespaceURI, localName, then we find by
+            // nodeName so we know where to insert.
+            i = findNamePoint(arg.getNodeName(), 0);
+            if (i >= 0) {
+                previous = (NodeImpl) nodes.elementAt(i);
+                nodes.insertElementAt(arg, i);
+            } else {
+                i = -1 - i; // Insert point (may be end of list)
+                if (null == nodes) {
+                    nodes = new Vector(5, 10);
+                }
+                nodes.insertElementAt(arg, i);
+            }
+        }
+        return previous;
+
+    } // setNamedItemNS(Node):Node
+
+    /**
+     * Introduced in DOM Level 2. Removes a node specified by local name and
+     * namespace URI.
+     * 
+     * @param namespaceURI
+     *            The namespace URI of the node to remove. When it is null or an
+     *            empty string, this method behaves like removeNamedItem.
+     * @param name
+     *            The local name of the node to remove.
+     * @return Returns the node removed from the map if a node with such a local
+     *         name and namespace URI exists.
+     * @throws NOT_FOUND_ERR:
+     *             Raised if there is no node named name in the map.
+     * 
+     */
+    public Node removeNamedItemNS(String namespaceURI, String name)
+            throws DOMException {
+
+        if (isReadOnly()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NO_MODIFICATION_ALLOWED_ERR", null);
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    msg);
+        }
+        int i = findNamePoint(namespaceURI, name);
+        if (i < 0) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR", null);
+            throw new DOMException(DOMException.NOT_FOUND_ERR, msg);
+        }
+
+        NodeImpl n = (NodeImpl) nodes.elementAt(i);
+        nodes.removeElementAt(i);
+
+        return n;
+
+    } // removeNamedItem(String):Node
+
+    /**
+     * Adds a node using its nodeName attribute. As the nodeName attribute is
+     * used to derive the name which the node must be stored under, multiple
+     * nodes of certain types (those that have a "special" string value) cannot
+     * be stored as the names would clash. This is seen as preferable to
+     * allowing nodes to be aliased.
+     * 
+     * @see org.w3c.dom.NamedNodeMap#setNamedItem
+     * @return Returns the replaced Node if the new Node replaces an existing
+     *         node, otherwise returns null.
+     * @param arg
+     *            A node to store in a named node map. The node will later be
+     *            accessible using the value of the namespaceURI and localName
+     *            attribute of the node. If a node with those namespace URI and
+     *            local name is already present in the map, it is replaced by
+     *            the new one.
+     * @exception org.w3c.dom.DOMException
+     *                The exception description.
+     */
+    public Node setNamedItem(Node arg) throws DOMException {
+
+        DocumentImpl ownerDocument = (DocumentImpl) ownerNode
+                .getOwnerDocument();
+
+        if (isReadOnly()) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN,
+                    "NO_MODIFICATION_ALLOWED_ERR", null);
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    msg);
+        }
+        if (arg.getOwnerDocument() != ownerDocument) {
+            String msg = DOMMessageFormatter.formatMessage(
+                    DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null);
+            throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, msg);
+        }
+
+        int i = findNamePoint(arg.getNodeName(), 0);
+        NodeImpl previous = null;
+        if (i >= 0) {
+            previous = (NodeImpl) nodes.elementAt(i);
+            nodes.setElementAt(arg, i);
+        } else {
+            i = -1 - i; // Insert point (may be end of list)
+            if (null == nodes) {
+                nodes = new Vector(5, 10);
+            }
+            nodes.insertElementAt(arg, i);
+        }
+        return previous;
+
+    } // setNamedItem(Node):Node
+
+    final boolean isReadOnly() {
+        return (flags & READONLY) != 0;
+    }
+
+    final void isReadOnly(boolean value) {
+        flags = (short) (value ? flags | READONLY : flags & ~READONLY);
+    }
+
+    final boolean changed() {
+        return (flags & CHANGED) != 0;
+    }
+
+    final void changed(boolean value) {
+        flags = (short) (value ? flags | CHANGED : flags & ~CHANGED);
+    }
+
+    final boolean hasDefaults() {
+        return (flags & HASDEFAULTS) != 0;
+    }
+
+    final void hasDefaults(boolean value) {
+        flags = (short) (value ? flags | HASDEFAULTS : flags & ~HASDEFAULTS);
+    }
+
+    /**
+     * 
+     * From org.apache.xerces.dom.NamedNodeMapImpl
+     * 
+     * Subroutine: Locates the named item, or the point at which said item
+     * should be added.
+     * 
+     * @param name
+     *            Name of a node to look up.
+     * 
+     * @return If positive or zero, the index of the found item. If negative,
+     *         index of the appropriate point at which to insert the item,
+     *         encoded as -1-index and hence reconvertable by subtracting it
+     *         from -1. (Encoding because I don't want to recompare the strings
+     *         but don't want to burn bytes on a datatype to hold a flagged
+     *         value.)
+     */
+    protected int findNamePoint(String name, int start) {
+
+        // Binary search
+        int i = 0;
+        if (nodes != null) {
+            int first = start;
+            int last = nodes.size() - 1;
+
+            while (first <= last) {
+                i = (first + last) / 2;
+                int test = name.compareTo(((Node) (nodes.elementAt(i)))
+                        .getNodeName());
+                if (test == 0) {
+                    return i; // Name found
+                } else if (test < 0) {
+                    last = i - 1;
+                } else {
+                    first = i + 1;
+                }
+            }
+
+            if (first > i) {
+                i = first;
+            }
+        }
+
+        return -1 - i; // not-found has to be encoded.
+
+    } // findNamePoint(String):int
+
+    /**
+     * This findNamePoint is for DOM Level 2 Namespaces.
+     */
+    protected int findNamePoint(String namespaceURI, String name) {
+
+        if (nodes == null)
+            return -1;
+        if (name == null)
+            return -1;
+
+        // This is a linear search through the same nodes Vector.
+        // The Vector is sorted on the DOM Level 1 nodename.
+        // The DOM Level 2 NS keys are namespaceURI and Localname,
+        // so we must linear search thru it.
+        // In addition, to get this to work with nodes without any namespace
+        // (namespaceURI and localNames are both null) we then use the nodeName
+        // as a seconday key.
+        for (int i = 0; i < nodes.size(); i++) {
+            NodeImpl a = (NodeImpl) nodes.elementAt(i);
+            String aNamespaceURI = a.getNamespaceURI();
+            String aLocalName = a.getLocalName();
+            if (namespaceURI == null) {
+                if (aNamespaceURI == null && (name.equals(aLocalName) || 
+                        (aLocalName == null && name.equals(a.getNodeName()))))
+                    return i;
+            } else {
+                if (namespaceURI.equals(aNamespaceURI)
+                        && name.equals(aLocalName))
+                    return i;
+            }
+        }
+        return -1;
+    }
+
+    // Compare 2 nodes in the map. If a precedes b, return true, otherwise
+    // return false
+    protected boolean precedes(Node a, Node b) {
+
+        if (nodes != null) {
+            for (int i = 0; i < nodes.size(); i++) {
+                Node n = (Node) nodes.elementAt(i);
+                if (n == a)
+                    return true;
+                if (n == b)
+                    return false;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * NON-DOM: Remove attribute at specified index.
+     */
+    protected void removeItem(int index) {
+        if (nodes != null && index < nodes.size()) {
+            nodes.removeElementAt(index);
+        }
+    }
+
+    protected Object getItem(int index) {
+        if (nodes != null) {
+            return nodes.elementAt(index);
+        }
+        return null;
+    }
+
+    protected int addItem(Node arg) {
+        int i = findNamePoint(arg.getNamespaceURI(), arg.getLocalName());
+        if (i >= 0) {
+            nodes.setElementAt(arg, i);
+        } else {
+            // If we can't find by namespaceURI, localName, then we find by
+            // nodeName so we know where to insert.
+            i = findNamePoint(arg.getNodeName(), 0);
+            if (i >= 0) {
+                nodes.insertElementAt(arg, i);
+            } else {
+                i = -1 - i; // Insert point (may be end of list)
+                if (null == nodes) {
+                    nodes = new Vector(5, 10);
+                }
+                nodes.insertElementAt(arg, i);
+            }
+        }
+        return i;
+    }
+
+    /**
+     * NON-DOM: copy content of this map into the specified vector
+     * 
+     * @param list
+     *            Vector to copy information into.
+     * @return Returns a copy of this node named map.
+     */
+    protected Vector cloneMap(Vector list) {
+        if (list == null) {
+            list = new Vector(5, 10);
+        }
+        list.setSize(0);
+        if (nodes != null) {
+            for (int i = 0; i < nodes.size(); i++) {
+                list.insertElementAt(nodes.elementAt(i), i);
+            }
+        }
+
+        return list;
+    }
+
+    protected int getNamedItemIndex(String namespaceURI, String localName) {
+        return findNamePoint(namespaceURI, localName);
+    }
+
+    /**
+     * NON-DOM remove all elements from this map.
+     */
+    public void removeAll() {
+        if (nodes != null) {
+            nodes.removeAllElements();
+        }
+    }
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NamespaceImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NamespaceImpl.java
new file mode 100644
index 0000000..eb2433f
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NamespaceImpl.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.OMNamespace;
+
+public class NamespaceImpl implements OMNamespace {
+
+    private String nsUri;
+
+    private String nsPrefix;
+    
+    public NamespaceImpl(String uri) {
+        this.nsUri = uri;
+    }
+
+    public NamespaceImpl(String uri, String prefix) {
+        this(uri);
+        this.nsPrefix = prefix;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.axiom.om.OMNamespace#equals(java.lang.String,
+     *      java.lang.String)
+     */
+    public boolean equals(String uri, String prefix) {
+        return (this.nsUri == uri && this.nsPrefix == prefix);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.axiom.om.OMNamespace#getPrefix()
+     */
+    public String getPrefix() {
+        return this.nsPrefix;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.axiom.om.OMNamespace#getName()
+     */
+    public String getName() {
+        return this.nsUri;
+    }
+
+    public String getNamespaceURI() {
+        return this.nsUri;
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java
new file mode 100644
index 0000000..affb74a
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java
@@ -0,0 +1,633 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.UserDataHandler;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.util.Hashtable;
+import java.util.Map;
+
+public abstract class NodeImpl implements Node, NodeList, OMNodeEx, Cloneable {
+
+    /**
+     * Holds the user data objects
+     */
+    private Map userData = new Hashtable();
+
+    /**
+     * Field builder
+     */
+    protected OMXMLParserWrapper builder;
+
+    /**
+     * Field done
+     */
+    protected boolean done = false;
+
+    /**
+     * Field nodeType
+     */
+    protected int nodeType;
+
+    protected DocumentImpl ownerNode;
+    
+    /**
+     * Factory that created this node
+     */
+    protected OMFactory factory;
+
+    // data
+
+    protected short flags;
+
+    protected final static short OWNED = 0x1 << 1;
+
+    protected final static short FIRSTCHILD = 0x1 << 2;
+
+    protected final static short READONLY = 0x1 << 3;
+
+    protected final static short SPECIFIED = 0x1 << 4;
+
+    protected final static short NORMALIZED = 0x1 << 5;
+
+    //
+    // Constructors
+    //
+
+    protected NodeImpl(DocumentImpl ownerDocument, OMFactory factory) {
+        this(factory);
+        this.ownerNode = ownerDocument;
+        // this.isOwned(true);
+
+    }
+
+    protected NodeImpl(OMFactory factory) {
+        this.factory = factory;
+    }
+
+    public void normalize() {
+        //Parent node should override this 
+    }
+
+    public boolean hasAttributes() {
+        return false; // overridden in ElementImpl
+    }
+
+    public boolean hasChildNodes() {
+        return false; // Override in ParentNode
+    }
+
+    public String getLocalName() {
+        return null; // Override in AttrImpl and ElementImpl
+    }
+
+    public String getNamespaceURI() {
+        return null; // Override in AttrImpl and ElementImpl
+    }
+
+    public String getNodeValue() throws DOMException {
+        return null;
+    }
+
+    /*
+     * Overidden in ElementImpl and AttrImpl.
+     */
+    public String getPrefix() {
+        return null;
+    }
+
+    public void setNodeValue(String arg0) throws DOMException {
+        // Don't do anything, to be overridden in SOME Child classes
+    }
+
+    public void setPrefix(String prefix) throws DOMException {
+        throw new DOMException(DOMException.NAMESPACE_ERR, DOMMessageFormatter
+                .formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NAMESPACE_ERR",
+                               null));
+    }
+
+    /**
+     * Finds the document that this Node belongs to (the document in whose
+     * context the Node was created). The Node may or may not
+     */
+    public Document getOwnerDocument() {
+        return this.ownerNode;
+    }
+
+    /**
+     * Returns the collection of attributes associated with this node, or null
+     * if none. At this writing, Element is the only type of node which will
+     * ever have attributes.
+     * 
+     * @see ElementImpl
+     */
+    public NamedNodeMap getAttributes() {
+        return null; // overridden in ElementImpl
+    }
+
+    /**
+     * Gets the first child of this Node, or null if none.
+     * <P>
+     * By default we do not have any children, ParentNode overrides this.
+     * 
+     * @see ParentNode
+     */
+    public Node getFirstChild() {
+        return null;
+    }
+
+    /**
+     * Gets the last child of this Node, or null if none.
+     * <P>
+     * By default we do not have any children, ParentNode overrides this.
+     * 
+     * @see ParentNode
+     */
+    public Node getLastChild() {
+        return null;
+    }
+
+    /** Returns the next child of this node's parent, or null if none. */
+    public Node getNextSibling() {
+        return null; // default behavior, overriden in ChildNode
+    }
+
+    public Node getParentNode() {
+        return null; // overriden by ChildNode
+        // Document, DocumentFragment, and Attribute will never have parents.
+    }
+
+    /*
+     * Same as getParentNode but returns internal type NodeImpl.
+     */
+    NodeImpl parentNode() {
+        return null;
+    }
+
+    /** Returns the previous child of this node's parent, or null if none. */
+    public Node getPreviousSibling() {
+        return null; // default behavior, overriden in ChildNode
+    }
+
+    // public Node cloneNode(boolean deep) {
+    // if(this instanceof OMElement) {
+    // return (Node)((OMElement)this).cloneOMElement();
+    // } else if(this instanceof OMText ){
+    // return ((TextImpl)this).cloneText();
+    // } else {
+    // throw new UnsupportedOperationException("Only elements can be cloned
+    // right now");
+    // }
+    // }
+    //    
+    public Node cloneNode(boolean deep) {
+        NodeImpl newnode;
+        try {
+            newnode = (NodeImpl) clone();
+        } catch (CloneNotSupportedException e) {
+            throw new RuntimeException("**Internal Error**" + e);
+        }
+        newnode.ownerNode = this.ownerNode;
+        newnode.isOwned(false);
+
+        newnode.isReadonly(false);
+
+        return newnode;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.w3c.dom.Node#getChildNodes()
+     */
+    public NodeList getChildNodes() {
+        return this;
+    }
+
+    public boolean isSupported(String feature, String version) {
+        throw new UnsupportedOperationException();
+        // TODO
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.w3c.dom.Node#appendChild(org.w3c.dom.Node)
+     */
+    public Node appendChild(Node newChild) throws DOMException {
+        return insertBefore(newChild, null);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.w3c.dom.Node#removeChild(org.w3c.dom.Node)
+     */
+    public Node removeChild(Node oldChild) throws DOMException {
+        throw new DOMException(DOMException.NOT_FOUND_ERR, DOMMessageFormatter
+                .formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR",
+                               null));
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.w3c.dom.Node#insertBefore(org.w3c.dom.Node, org.w3c.dom.Node)
+     */
+    public Node insertBefore(Node newChild, Node refChild) throws DOMException {
+        // Overridden in ParentNode
+        throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
+                               DOMMessageFormatter.formatMessage(
+                                       DOMMessageFormatter.DOM_DOMAIN,
+                                       "HIERARCHY_REQUEST_ERR", null));
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.w3c.dom.Node#replaceChild(org.w3c.dom.Node, org.w3c.dom.Node)
+     */
+    public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
+        throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
+                               DOMMessageFormatter.formatMessage(
+                                       DOMMessageFormatter.DOM_DOMAIN,
+                                       "HIERARCHY_REQUEST_ERR", null));
+    }
+
+    //
+    // NodeList methods
+    //
+
+    /**
+     * NodeList method: Returns the number of immediate children of this node.
+     * <P>
+     * By default we do not have any children, ParentNode overrides this.
+     * 
+     * @see ParentNode
+     * 
+     * @return Returns int.
+     */
+    public int getLength() {
+        return 0;
+    }
+
+    /**
+     * NodeList method: Returns the Nth immediate child of this node, or null if
+     * the index is out of bounds.
+     * <P>
+     * By default we do not have any children, ParentNode overrides this.
+     * 
+     * @see ParentNode
+     * 
+     * @return Returns org.w3c.dom.Node
+     * @param index
+     */
+    public Node item(int index) {
+        return null;
+    }
+
+    /*
+     * Flags setters and getters
+     */
+
+    final boolean isOwned() {
+        return (flags & OWNED) != 0;
+    }
+
+    final void isOwned(boolean value) {
+        flags = (short) (value ? flags | OWNED : flags & ~OWNED);
+    }
+
+    final boolean isFirstChild() {
+        return (flags & FIRSTCHILD) != 0;
+    }
+
+    final void isFirstChild(boolean value) {
+        flags = (short) (value ? flags | FIRSTCHILD : flags & ~FIRSTCHILD);
+    }
+
+    final boolean isReadonly() {
+        return (flags & READONLY) != 0;
+    }
+
+    final void isReadonly(boolean value) {
+        flags = (short) (value ? flags | READONLY : flags & ~READONLY);
+    }
+
+    final boolean isSpecified() {
+        return (flags & SPECIFIED) != 0;
+    }
+
+    final void isSpecified(boolean value) {
+        flags = (short) (value ? flags | SPECIFIED : flags & ~SPECIFIED);
+    }
+
+    final boolean isNormalized() {
+        return (flags & NORMALIZED) != 0;
+    }
+
+    final void isNormalized(boolean value) {
+        // See if flag should propagate to parent.
+        if (!value && isNormalized() && ownerNode != null) {
+            ownerNode.isNormalized(false);
+        }
+        flags = (short) (value ? flags | NORMALIZED : flags & ~NORMALIZED);
+    }
+
+    // /
+    // /OM Methods
+    // /
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.axis2.om.OMNode#getParent()
+     */
+    public OMContainer getParent() throws OMException {
+        return null; // overriden by ChildNode
+        // Document, DocumentFragment, and Attribute will never have parents.
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.axis2.om.OMNode#isComplete()
+     */
+    public boolean isComplete() {
+        return this.done;
+    }
+
+    public void setComplete(boolean state) {
+        this.done = state;
+
+    }
+
+    /**
+     * There no concept of caching in this OM-DOM implementation.
+     */
+    public void internalSerializeWithCache(XMLStreamWriter writer)
+            throws XMLStreamException {
+        this.internalSerialize(writer);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.axis2.om.OMNode#insertSiblingAfter
+     * (org.apache.axis2.om.OMNode)
+     */
+    public void insertSiblingAfter(OMNode sibling) throws OMException {
+        // Overridden in ChildNode
+        throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
+                               DOMMessageFormatter.formatMessage(
+                                       DOMMessageFormatter.DOM_DOMAIN,
+                                       "HIERARCHY_REQUEST_ERR", null));
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.axis2.om.OMNode#insertSiblingBefore
+     * (org.apache.axis2.om.OMNode)
+     */
+    public void insertSiblingBefore(OMNode sibling) throws OMException {
+        // Overridden in ChildNode
+        throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
+                               DOMMessageFormatter.formatMessage(
+                                       DOMMessageFormatter.DOM_DOMAIN,
+                                       "HIERARCHY_REQUEST_ERR", null));
+
+    }
+
+    /**
+     * Default behavior returns null, overriden in ChildNode.
+     */
+    public OMNode getPreviousOMSibling() {
+        return null;
+    }
+
+    /**
+     * Default behavior returns null, overriden in ChildNode.
+     */
+    public OMNode getNextOMSibling() {
+        return null;
+    }
+
+    public void setPreviousOMSibling(OMNode previousSibling) {
+        throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
+                               DOMMessageFormatter.formatMessage(
+                                       DOMMessageFormatter.DOM_DOMAIN,
+                                       "HIERARCHY_REQUEST_ERR", null));
+    }
+
+    public void setNextOMSibling(OMNode previousSibling) {
+        throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
+                               DOMMessageFormatter.formatMessage(
+                                       DOMMessageFormatter.DOM_DOMAIN,
+                                       "HIERARCHY_REQUEST_ERR", null));
+    }
+
+    /**
+     * Builds next element.
+     */
+    public void build() {
+        while (!done)
+            this.builder.next();
+    }
+
+	/**
+	 * Parses this node and builds the object structure in memory. AXIOM
+	 * supports two levels of deffered building. First is deffered building of
+	 * AXIOM using StAX. Second level is the deffered building of attachments.
+	 * AXIOM reads in the attachements from the stream only when user asks by
+	 * calling getDataHandler(). build() method builds the OM without the
+	 * attachments. buildAll() builds the OM together with attachement data.
+	 * This becomes handy when user wants to free the input stream.
+	 */
+	public void buildWithAttachments() {
+		if (!this.done) {
+			this.build();
+		}
+	}
+	
+    /**
+     * Sets the owner document.
+     * 
+     * @param document
+     */
+    protected void setOwnerDocument(DocumentImpl document) {
+        this.ownerNode = document;
+        this.isOwned(true);
+    }
+
+    public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(xmlWriter);
+        internalSerialize(writer);
+        writer.flush();
+    }
+
+    public void serializeAndConsume(XMLStreamWriter xmlWriter)
+            throws XMLStreamException {
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(xmlWriter);
+        internalSerializeAndConsume(writer);
+        writer.flush();
+    }
+
+    public OMNode detach() {
+        throw new OMException(
+                "Elements that doesn't have a parent can not be detached");
+    }
+
+    /*
+     * DOM-Level 3 methods
+     */
+
+    public String getBaseURI() {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public short compareDocumentPosition(Node arg0) throws DOMException {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public String getTextContent() throws DOMException {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public void setTextContent(String arg0) throws DOMException {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public boolean isSameNode(Node arg0) {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public String lookupPrefix(String arg0) {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public boolean isDefaultNamespace(String arg0) {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public String lookupNamespaceURI(String arg0) {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public boolean isEqualNode(Node arg0) {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public Object getFeature(String arg0, String arg1) {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public Object setUserData(String key, Object value, UserDataHandler userDataHandler) {
+       return userData.put(key, value);
+    }
+
+    public Object getUserData(String key) {
+        return userData.get(key);
+    }
+
+    public void serialize(OutputStream output) throws XMLStreamException {
+        serialize(StAXUtils.createXMLStreamWriter(output));
+    }
+
+    public void serialize(Writer writer) throws XMLStreamException {
+        serialize(StAXUtils.createXMLStreamWriter(writer));
+    }
+
+    public void serializeAndConsume(OutputStream output)
+            throws XMLStreamException {
+        serializeAndConsume(StAXUtils
+                .createXMLStreamWriter(output));
+    }
+
+    public void serializeAndConsume(Writer writer) throws XMLStreamException {
+        serializeAndConsume(StAXUtils
+                .createXMLStreamWriter(writer));
+    }
+
+    public void serialize(OutputStream output, OMOutputFormat format)
+            throws XMLStreamException {
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format);
+        internalSerialize(writer);
+        writer.flush();
+    }
+
+    public void serialize(Writer writer2, OMOutputFormat format)
+            throws XMLStreamException {
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(StAXUtils
+                .createXMLStreamWriter(writer2));
+        writer.setOutputFormat(format);
+        internalSerialize(writer);
+        writer.flush();
+    }
+
+    public void serializeAndConsume(OutputStream output, OMOutputFormat format)
+            throws XMLStreamException {
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format);
+        internalSerializeAndConsume(writer);
+        writer.flush();
+    }
+
+    public void serializeAndConsume(Writer writer2, OMOutputFormat format)
+            throws XMLStreamException {
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(StAXUtils
+                .createXMLStreamWriter(writer2));
+        writer.setOutputFormat(format);
+        internalSerializeAndConsume(writer);
+        writer.flush();
+    }
+
+    /**
+     * Returns the <code>OMFactory</code> that created this node
+     */
+    public OMFactory getOMFactory() {
+        return this.factory;
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeListImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeListImpl.java
new file mode 100644
index 0000000..fcc747c
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeListImpl.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.impl.OMContainerEx;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+import java.util.Vector;
+
+/**
+ * Implementation of org.w3c.dom.NodeList
+ */
+public class NodeListImpl implements NodeList {
+
+    protected NodeImpl rootNode;
+
+    protected String tagName;
+
+    protected Vector nodes;
+
+    protected String nsName;
+
+    protected boolean enableNS = false;
+
+    /** Constructor. */
+    public NodeListImpl(NodeImpl rootNode, String tagName) {
+        this.rootNode = rootNode;
+        this.tagName = (tagName != null && !tagName.equals("")) ? tagName
+                : null;
+        nodes = new Vector();
+    }
+
+    /** Constructor for Namespace support. */
+    public NodeListImpl(NodeImpl rootNode, String namespaceURI, 
+                                                    String localName) {
+        this(rootNode, localName);
+        this.nsName = (namespaceURI != null && !namespaceURI.equals("")) 
+                       ? namespaceURI
+                       : null;
+        if (this.nsName != null) {
+            enableNS = true;
+        }
+    }
+
+    /**
+     * Returns the number of nodes.
+     * 
+     * @see org.w3c.dom.NodeList#getLength()
+     */
+    public int getLength() {
+        Iterator children;
+        if (this.tagName == null) {
+            children = ((OMContainerEx) rootNode).getChildren();
+        } else if (!enableNS) {
+            children = ((OMContainerEx) rootNode)
+                    .getChildrenWithName(new QName(this.tagName));
+        } else {
+            if (DOMUtil.getPrefix(this.tagName) != null) {
+                children = ((OMContainerEx) rootNode)
+                        .getChildrenWithName(new QName(this.nsName, DOMUtil
+                                .getLocalName(this.tagName), DOMUtil
+                                .getPrefix(this.tagName)));
+            } else {
+                children = ((OMContainerEx) rootNode)
+                        .getChildrenWithName(new QName(this.nsName, DOMUtil
+                                .getLocalName(this.tagName)));
+            }
+        }
+        int count = 0;
+        while (children.hasNext()) {
+            count++;
+            children.next();
+        }
+        return count;
+    }
+
+    /**
+     * Returns the node at the given index. Returns null if the index is
+     * invalid.
+     * 
+     * @see org.w3c.dom.NodeList#item(int)
+     */
+    public Node item(int index) {
+        Iterator children;
+
+        if (this.tagName == null) {
+            children = ((OMContainerEx) rootNode).getChildren();
+        } else if (!enableNS) {
+            children = ((OMContainerEx) rootNode)
+                    .getChildrenWithName(new QName(this.tagName));
+        } else {
+            if (DOMUtil.getPrefix(this.tagName) != null) {
+                children = ((OMContainerEx) rootNode)
+                        .getChildrenWithName(new QName(this.nsName, DOMUtil
+                                .getLocalName(this.tagName), DOMUtil
+                                .getPrefix(this.tagName)));
+            } else {
+                children = ((OMContainerEx) rootNode)
+                        .getChildrenWithName(new QName(this.nsName, DOMUtil
+                                .getLocalName(this.tagName)));
+            }
+        }
+
+        int count = 0;
+        while (children.hasNext()) {
+            if (count == index) {
+                return (Node) children.next();
+            } else {
+                children.next();
+            }
+            count++;
+        }
+        return null;
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/OMDOMException.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/OMDOMException.java
new file mode 100644
index 0000000..862b3a5
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/OMDOMException.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.OMException;
+/**
+ * OMDOM specific exception
+ */
+public class OMDOMException extends OMException {
+
+	private static final long serialVersionUID = 8763119035210190906L;
+
+	public OMDOMException() {
+		super();
+	}
+
+	public OMDOMException(String arg0) {
+		super(arg0);
+	}
+
+	public OMDOMException(Throwable arg0) {
+		super(arg0);
+	}
+
+	public OMDOMException(String arg0, Throwable arg1) {
+		super(arg0, arg1);
+	}
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
new file mode 100644
index 0000000..5047b94
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
@@ -0,0 +1,461 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.impl.OMContainerEx;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.om.impl.traverse.OMChildrenIterator;
+import org.apache.axiom.om.impl.traverse.OMChildrenQNameIterator;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+public abstract class ParentNode extends ChildNode implements OMContainerEx {
+
+    protected ChildNode firstChild;
+
+    protected ChildNode lastChild;
+
+    /**
+     * @param ownerDocument
+     */
+    protected ParentNode(DocumentImpl ownerDocument, OMFactory factory) {
+        super(ownerDocument, factory);
+    }
+
+    protected ParentNode(OMFactory factory) {
+        super(factory);
+    }
+
+    // /
+    // /OMContainer methods
+    // /
+
+    public void addChild(OMNode omNode) {
+        this.appendChild((Node) omNode);
+    }
+
+    public void buildNext() {
+        if (!this.done)
+            builder.next();
+    }
+
+    public Iterator getChildren() {
+        return new OMChildrenIterator(this.firstChild);
+    }
+
+    /**
+     * Returns an iterator of child nodes having a given qname.
+     * 
+     * @see org.apache.axiom.om.OMContainer#getChildrenWithName
+     * (javax.xml.namespace.QName)
+     */
+    public Iterator getChildrenWithName(QName elementQName) throws OMException {
+        return new OMChildrenQNameIterator(getFirstOMChild(), elementQName);
+    }
+
+    /**
+     * Returns the first OMElement child node.
+     * 
+     * @see org.apache.axiom.om.OMContainer#getFirstChildWithName
+     * (javax.xml.namespace.QName)
+     */
+    public OMElement getFirstChildWithName(QName elementQName)
+            throws OMException {
+        Iterator children = new OMChildrenQNameIterator(getFirstOMChild(),
+                elementQName);
+        while (children.hasNext()) {
+            OMNode node = (OMNode) children.next();
+
+            // Return the first OMElement node that is found
+            if (node instanceof OMElement) {
+                return (OMElement) node;
+            }
+        }
+        return null;
+    }
+
+    public OMNode getFirstOMChild() {
+        while ((firstChild == null) && !done) {
+            buildNext();
+        }
+        return firstChild;
+    }
+
+    public void setFirstChild(OMNode omNode) {
+        if (firstChild != null) {
+            ((OMNodeEx) omNode).setParent(this);
+        }
+        this.firstChild = (ChildNode) omNode;
+    }
+
+    // /
+    // /DOM Node methods
+    // /
+
+    public NodeList getChildNodes() {
+        if (!this.done) {
+            this.build();
+        }
+        return new NodeListImpl(this, null, null);
+    }
+
+    public Node getFirstChild() {
+        return (Node) this.getFirstOMChild();
+    }
+
+    public Node getLastChild() {
+        if (!this.done) {
+            this.build();
+        }
+        return this.lastChild;
+    }
+
+    public boolean hasChildNodes() {
+        while ((firstChild == null) && !done) {
+            buildNext();
+        }
+        return this.firstChild != null;
+    }
+
+    /**
+     * Inserts newChild before the refChild. If the refChild is null then the
+     * newChild is made the last child.
+     */
+    public Node insertBefore(Node newChild, Node refChild) throws DOMException {
+
+        ChildNode newDomChild = (ChildNode) newChild;
+        ChildNode refDomChild = (ChildNode) refChild;
+
+        if (this == newChild || !isAncestor(newChild)) {
+            throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
+                    DOMMessageFormatter.formatMessage(
+                            DOMMessageFormatter.DOM_DOMAIN,
+                            "HIERARCHY_REQUEST_ERR", null));
+        }
+
+        if (!(this instanceof Document)
+                && !(this.ownerNode == newDomChild.getOwnerDocument())) {
+            throw new DOMException(DOMException.WRONG_DOCUMENT_ERR,
+                    DOMMessageFormatter.formatMessage(
+                            DOMMessageFormatter.DOM_DOMAIN,
+                            "WRONG_DOCUMENT_ERR", null));
+        }
+
+        if (this.isReadonly()) {
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    DOMMessageFormatter.formatMessage(
+                            DOMMessageFormatter.DOM_DOMAIN,
+                            "NO_MODIFICATION_ALLOWED_ERR", null));
+        }
+
+        if (this instanceof Document) {
+            if (((DocumentImpl) this).documentElement != null
+                    && !(newDomChild instanceof CommentImpl)) {
+                // Throw exception since there cannot be two document elements
+                throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
+                        DOMMessageFormatter.formatMessage(
+                                DOMMessageFormatter.DOM_DOMAIN,
+                                "HIERARCHY_REQUEST_ERR", null));
+            } else if (newDomChild instanceof ElementImpl) {
+                if (newDomChild.parentNode == null) {
+                    newDomChild.parentNode = this;
+                }
+                // set the document element
+                ((DocumentImpl) this).documentElement = (ElementImpl) newDomChild;
+            }
+        }
+
+        if (refChild == null) { // Append the child to the end of the list
+            // if there are no children
+            if (this.lastChild == null && firstChild == null) {
+                this.lastChild = newDomChild;
+                this.firstChild = newDomChild;
+                this.firstChild.isFirstChild(true);
+                newDomChild.setParent(this);
+            } else {
+                this.lastChild.nextSibling = newDomChild;
+                newDomChild.previousSibling = this.lastChild;
+
+                this.lastChild = newDomChild;
+                this.lastChild.nextSibling = null;
+            }
+            if (newDomChild.parentNode == null) {
+                newDomChild.parentNode = this;
+            }
+            return newChild;
+        } else {
+            Iterator children = this.getChildren();
+            boolean found = false;
+            while (children.hasNext()) {
+                ChildNode tempNode = (ChildNode) children.next();
+
+                if (tempNode.equals(refChild)) {
+                    // RefChild found
+                    if (this.firstChild == tempNode) { // If the refChild is the
+                                                    // first child
+
+                        if (newChild instanceof DocumentFragmentimpl) {
+                            // The new child is a DocumentFragment
+                            DocumentFragmentimpl docFrag = 
+                                                (DocumentFragmentimpl) newChild;
+                            this.firstChild = docFrag.firstChild;
+                            docFrag.lastChild.nextSibling = refDomChild;
+                            refDomChild.previousSibling = 
+                                                docFrag.lastChild.nextSibling;
+
+                        } else {
+
+                            // Make the newNode the first Child
+                            this.firstChild = newDomChild;
+
+                            newDomChild.nextSibling = refDomChild;
+                            refDomChild.previousSibling = newDomChild;
+
+                            this.firstChild.isFirstChild(true);
+                            refDomChild.isFirstChild(false);
+                            newDomChild.previousSibling = null; // Just to be
+                                                                // sure :-)
+
+                        }
+                    } else { // If the refChild is not the fist child
+                        ChildNode previousNode = refDomChild.previousSibling;
+
+                        if (newChild instanceof DocumentFragmentimpl) {
+                            // the newChild is a document fragment
+                            DocumentFragmentimpl docFrag = 
+                                                (DocumentFragmentimpl) newChild;
+
+                            previousNode.nextSibling = docFrag.firstChild;
+                            docFrag.firstChild.previousSibling = previousNode;
+
+                            docFrag.lastChild.nextSibling = refDomChild;
+                            refDomChild.previousSibling = docFrag.lastChild;
+                        } else {
+
+                            previousNode.nextSibling = newDomChild;
+                            newDomChild.previousSibling = previousNode;
+
+                            newDomChild.nextSibling = refDomChild;
+                            refDomChild.previousSibling = newDomChild;
+                        }
+
+                    }
+                    found = true;
+                    break;
+                }
+            }
+
+            if (!found) {
+                throw new DOMException(DOMException.NOT_FOUND_ERR,
+                        DOMMessageFormatter.formatMessage(
+                                DOMMessageFormatter.DOM_DOMAIN,
+                                "NOT_FOUND_ERR", null));
+            }
+
+            if (newDomChild.parentNode == null) {
+                newDomChild.parentNode = this;
+            }
+
+            return newChild;
+        }
+    }
+
+    /**
+     * Replaces the oldChild with the newChild.
+     */
+    public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
+        ChildNode newDomChild = (ChildNode) newChild;
+        ChildNode oldDomChild = (ChildNode) oldChild;
+
+        if (this == newChild || !isAncestor(newChild)) {
+            throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
+                    DOMMessageFormatter.formatMessage(
+                            DOMMessageFormatter.DOM_DOMAIN,
+                            "HIERARCHY_REQUEST_ERR", null));
+        }
+
+        if (!this.ownerNode.equals(newDomChild.ownerNode)) {
+            throw new DOMException(DOMException.WRONG_DOCUMENT_ERR,
+                    DOMMessageFormatter.formatMessage(
+                            DOMMessageFormatter.DOM_DOMAIN,
+                            "WRONG_DOCUMENT_ERR", null));
+        }
+
+        if (this.isReadonly()) {
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    DOMMessageFormatter.formatMessage(
+                            DOMMessageFormatter.DOM_DOMAIN,
+                            "NO_MODIFICATION_ALLOWED_ERR", null));
+        }
+
+        Iterator children = this.getChildren();
+        boolean found = false;
+        while (children.hasNext()) {
+            ChildNode tempNode = (ChildNode) children.next();
+            if (tempNode.equals(oldChild)) {
+                if (newChild instanceof DocumentFragmentimpl) {
+                    DocumentFragmentimpl docFrag = 
+                                            (DocumentFragmentimpl) newDomChild;
+                    ChildNode child = (ChildNode) docFrag.getFirstChild();
+                    child.parentNode = this;
+                    this.replaceChild(child, oldChild);
+                } else {
+                    if (this.firstChild == oldDomChild) {
+                        
+                        newDomChild.parentNode = this;
+                        
+                        if(this.firstChild.nextSibling != null) {
+                            this.firstChild.nextSibling.previousSibling = newDomChild;
+                            newDomChild.nextSibling = this.firstChild.nextSibling;
+                        }
+                        
+                        //Cleanup the current first child
+                        this.firstChild.parentNode = null;
+                        this.firstChild.nextSibling = null;
+                        
+                        //Set the new first child
+                        this.firstChild = newDomChild;
+                        
+                    } else {
+                        newDomChild.nextSibling = oldDomChild.nextSibling;
+                        newDomChild.previousSibling = oldDomChild.previousSibling;
+
+                        oldDomChild.previousSibling.nextSibling = newDomChild;
+
+                        // If the old child is not the last
+                        if (oldDomChild.nextSibling != null) {
+                            oldDomChild.nextSibling.previousSibling = newDomChild;
+                        } else {
+                            this.lastChild = newDomChild;
+                        }
+
+                        if (newDomChild.parentNode == null) {
+                            newDomChild.parentNode = this;
+                        }
+                    }
+                }
+                found = true;
+
+                // remove the old child's references to this tree
+                oldDomChild.nextSibling = null;
+                oldDomChild.previousSibling = null;
+                oldDomChild.parentNode = null;
+            }
+        }
+
+        if (!found)
+            throw new DOMException(DOMException.NOT_FOUND_ERR,
+                    DOMMessageFormatter.formatMessage(
+                            DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR",
+                            null));
+
+        return oldChild;
+    }
+
+    /**
+     * Removes the given child from the DOM Tree.
+     */
+    public Node removeChild(Node oldChild) throws DOMException {
+        // Check if this node is readonly
+        if (this.isReadonly()) {
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    DOMMessageFormatter.formatMessage(
+                            DOMMessageFormatter.DOM_DOMAIN,
+                            "NO_MODIFICATION_ALLOWED_ERR", null));
+        }
+
+        // Check if the Child is there
+        Iterator children = this.getChildren();
+        boolean childFound = false;
+        while (children.hasNext()) {
+            ChildNode tempNode = (ChildNode) children.next();
+            if (tempNode.equals(oldChild)) {
+
+                if (this.firstChild == tempNode) {
+                    // If this is the first child
+                    this.firstChild = null;
+                    this.lastChild = null;
+                    tempNode.parentNode = null;
+                } else if (this.lastChild == tempNode) {
+                    // not the first child, but the last child
+                    ChildNode prevSib = tempNode.previousSibling;
+                    prevSib.nextSibling = null;
+                    tempNode.parentNode = null;
+                    tempNode.previousSibling = null;
+                } else {
+
+                    ChildNode oldDomChild = (ChildNode) oldChild;
+                    ChildNode privChild = oldDomChild.previousSibling;
+
+                    privChild.nextSibling = oldDomChild.nextSibling;
+                    oldDomChild.nextSibling.previousSibling = privChild;
+
+                    // Remove old child's references to this tree
+                    oldDomChild.nextSibling = null;
+                    oldDomChild.previousSibling = null;
+                }
+                // Child found
+                childFound = true;
+            }
+        }
+
+        if (!childFound)
+            throw new DOMException(DOMException.NOT_FOUND_ERR,
+                    DOMMessageFormatter.formatMessage(
+                            DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR",
+                            null));
+
+        return oldChild;
+    }
+
+    private boolean isAncestor(Node newNode) {
+
+        // TODO isAncestor
+        return true;
+    }
+
+    public Node cloneNode(boolean deep) {
+
+        ParentNode newnode = (ParentNode) super.cloneNode(deep);
+
+        // set owner document
+        newnode.ownerNode = ownerNode;
+
+        // Need to break the association w/ original kids
+        newnode.firstChild = null;
+        newnode.lastChild = null;
+
+        // Then, if deep, clone the kids too.
+        if (deep) {
+            for (ChildNode child = firstChild; child != null; 
+                    child = child.nextSibling) {
+                newnode.appendChild(child.cloneNode(true));
+            }
+        }
+
+        return newnode;
+
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java
new file mode 100644
index 0000000..03e3add
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java
@@ -0,0 +1,606 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.attachments.utils.DataHandlerUtils;
+import org.apache.axiom.om.*;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
+import org.apache.axiom.om.impl.OMNamespaceImpl;
+import org.apache.axiom.om.impl.mtom.MTOMStAXSOAPModelBuilder;
+import org.apache.axiom.om.util.Base64;
+import org.apache.axiom.om.util.UUIDGenerator;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class TextImpl extends CharacterImpl implements Text, OMText {
+
+    private String mimeType;
+
+    private boolean optimize;
+
+    private boolean isBinary;
+
+    private String contentID = null;
+    
+    protected OMNamespace textNS = null;
+    
+    protected char[] charArray;
+
+    /**
+     * Field dataHandler contains the DataHandler. Declaring as Object to remove
+     * the dependency on Javax.activation.DataHandler
+     */
+    private Object dataHandlerObject = null;
+
+    /**
+     * Field nameSpace is used when serializing Binary stuff as MTOM optimized.
+     */
+    protected OMNamespace ns = null;
+
+    /**
+     * Field localName is used when serializing Binary stuff as MTOM optimized.
+     */
+    protected String localName = "Include";
+
+    /**
+     * Field attribute is used when serializing Binary stuff as MTOM optimized.
+     */
+    protected OMAttribute attribute;
+
+    /**
+     * Field nameSpace used when serializing Binary stuff as MTOM optimized.
+     */
+    public static final OMNamespace XOP_NS = new OMNamespaceImpl(
+            "http://www.w3.org/2004/08/xop/include", "xop");
+    
+    /**
+     * Creates a text node with the given text required by the OMDOMFactory. The
+     * owner document should be set properly when appending this to a DOM tree.
+     * 
+     * @param text
+     */
+    public TextImpl(String text, OMFactory factory) {
+        super(factory);
+        this.textValue = (text != null) ? new StringBuffer(text)
+                : new StringBuffer("");
+        this.done = true;
+        this.ns = XOP_NS;
+    }
+
+    /**
+     * @param contentID
+     * @param parent
+     * @param builder
+     *            Used when the builder is encountered with a XOP:Include tag
+     *            Stores a reference to the builder and the content-id. Supports
+     *            deffered parsing of MIME messages
+     */
+    public TextImpl(String contentID, OMContainer parent,
+            OMXMLParserWrapper builder, OMFactory factory) {
+        super((DocumentImpl) ((ParentNode) parent).getOwnerDocument(), factory);
+        this.contentID = contentID;
+        this.optimize = true;
+        this.isBinary = true;
+        this.done = true;
+        this.builder = builder;
+        this.ns = XOP_NS;
+    }
+
+    public TextImpl(String text, String mimeType, boolean optimize,
+            OMFactory factory) {
+        this(text, mimeType, optimize, true, factory);
+    }
+
+    public TextImpl(String text, String mimeType, boolean optimize,
+            boolean isBinary, OMFactory factory) {
+        this(text, factory);
+        this.mimeType = mimeType;
+        this.optimize = optimize;
+        this.isBinary = isBinary;
+    }
+
+    /**
+     * @param dataHandler
+     * @param optimize
+     *            To send binary content. Created progrmatically.
+     */
+    public TextImpl(DocumentImpl ownerNode, Object dataHandler, boolean optimize, OMFactory factory) {
+        super(ownerNode, factory);
+        this.dataHandlerObject = dataHandler;
+        this.isBinary = true;
+        this.optimize = optimize;
+        done = true;
+        this.ns = XOP_NS;
+    }
+
+    /**
+     * @param ownerNode
+     */
+    public TextImpl(DocumentImpl ownerNode, OMFactory factory) {
+        super(ownerNode, factory);
+        this.done = true;
+        this.ns = XOP_NS;
+    }
+
+    /**
+     * @param ownerNode
+     * @param value
+     */
+    public TextImpl(DocumentImpl ownerNode, String value, OMFactory factory) {
+        super(ownerNode, value, factory);
+        this.done = true;
+        this.ns = XOP_NS;
+    }
+
+
+    public TextImpl(DocumentImpl ownerNode, char[] value, OMFactory factory) {
+        super(ownerNode, factory);
+        this.charArray = value;
+        this.done = true;
+        this.ns = XOP_NS;
+    }
+    
+    /**
+     * @param ownerNode
+     * @param value
+     */
+    public TextImpl(DocumentImpl ownerNode, String value, String mimeType,
+            boolean optimize, OMFactory factory) {
+        this(ownerNode, value, factory);
+        this.mimeType = mimeType;
+        this.optimize = optimize;
+        this.isBinary = true;
+        done = true;
+    }
+
+    public TextImpl(OMContainer parent, QName text,OMFactory factory) {
+        this(parent, text, OMNode.TEXT_NODE, factory);
+        
+    }
+    
+    public TextImpl(OMContainer parent, QName text, int nodeType,
+            OMFactory factory) {
+        this(((ElementImpl)parent).ownerNode, factory);
+        if(text != null) {
+            this.textNS = ((ElementImpl) parent).findNamespace(text.getNamespaceURI(), text.getPrefix());
+        } else {
+            
+        }
+        this.textValue = new StringBuffer((text == null) ? "" : text.getLocalPart());
+        this.done = true;
+    }
+    /**
+     * Breaks this node into two nodes at the specified offset, keeping both in
+     * the tree as siblings. After being split, this node will contain all the
+     * content up to the offset point. A new node of the same type, which
+     * contains all the content at and after the offset point, is returned. If
+     * the original node had a parent node, the new node is inserted as the next
+     * sibling of the original node. When the offset is equal to the length of
+     * this node, the new node has no data.
+     */
+    public Text splitText(int offset) throws DOMException {
+        if (this.isReadonly()) {
+            throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                    DOMMessageFormatter.formatMessage(
+                            DOMMessageFormatter.DOM_DOMAIN,
+                            "NO_MODIFICATION_ALLOWED_ERR", null));
+        }
+        if (offset < 0 || offset > this.textValue.length()) {
+            throw new DOMException(DOMException.INDEX_SIZE_ERR,
+                    DOMMessageFormatter.formatMessage(
+                            DOMMessageFormatter.DOM_DOMAIN, "INDEX_SIZE_ERR",
+                            null));
+        }
+        String newValue = this.textValue.substring(offset);
+        this.deleteData(offset, this.textValue.length());
+
+        TextImpl newText = (TextImpl) this.getOwnerDocument().createTextNode(
+                newValue);
+
+        if (this.parentNode != null) {
+            newText.setParent(this.parentNode);
+        }
+
+        this.insertSiblingAfter(newText);
+
+        return newText;
+    }
+
+    // /
+    // /org.w3c.dom.Node methods
+    // /
+    public String getNodeName() {
+        return "#text";
+    }
+
+    public short getNodeType() {
+        return Node.TEXT_NODE;
+    }
+
+    // /
+    // /OMNode methods
+    // /
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.axiom.om.OMNode#getType()
+     */
+    public int getType() throws OMException {
+        return OMNode.TEXT_NODE;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.axiom.om.OMNode#setType(int)
+     */
+    public void setType(int nodeType) throws OMException {
+        // do not do anything here
+        // Its not clear why we should let someone change the type of a node
+    }
+
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
+        internalSerializeLocal(writer);
+    }
+
+    public void internalSerializeAndConsume(XMLStreamWriter writer)
+            throws XMLStreamException {
+        internalSerializeLocal(writer);
+    }
+
+    public boolean isOptimized() {
+        return this.optimize;
+    }
+
+    public void setOptimize(boolean value) {
+        this.optimize = value;
+        if (value) {
+            isBinary = true;
+        }
+    }
+
+    public void discard() throws OMException {
+        if (done) {
+            this.detach();
+        } else {
+            builder.discard((OMElement) this.parentNode);
+        }
+    }
+
+    /**
+     * Writes the relevant output.
+     * 
+     * @param writer
+     * @throws XMLStreamException
+     */
+    private void writeOutput(XMLStreamWriter writer) throws XMLStreamException {
+        int type = getType();
+        if (type == OMNode.TEXT_NODE || type == SPACE_NODE) {
+            writer.writeCharacters(this.getText());
+        } else if (type == OMNode.CDATA_SECTION_NODE) {
+            writer.writeCData(this.getText());
+        } else if (type == OMNode.ENTITY_REFERENCE_NODE) {
+            writer.writeEntityRef(this.getText());
+        }
+    }
+
+    public String getText() {
+        if (this.textNS != null) {
+            return getTextString();
+        } else if (this.charArray != null || this.textValue != null) {
+            return getTextFromProperPlace();
+        } else {
+            try {
+                InputStream inStream;
+                inStream = this.getInputStream();
+                // int x = inStream.available();
+                byte[] data;
+                StringBuffer text = new StringBuffer();
+                do {
+                    data = new byte[1024];
+                    int len;
+                    while ((len = inStream.read(data)) > 0) {
+                        byte[] temp = new byte[len];
+                        System.arraycopy(data, 0, temp, 0, len);
+                        text.append(Base64.encode(temp));
+                    }
+
+                } while (inStream.available() > 0);
+                return text.toString();
+            } catch (Exception e) {
+                throw new OMException(e);
+            }
+        }
+    }
+
+    public char[] getTextCharacters() {
+        return charArray != null ? charArray : this.textValue.toString()
+                .toCharArray();
+    }
+
+    public boolean isCharacters() {
+        return charArray != null;
+    }
+    
+    private String getTextFromProperPlace() {
+        return charArray != null ? new String(charArray) : textValue.toString();
+    }
+
+    private String getTextString() {
+        if (textNS != null) {
+            String prefix = textNS.getPrefix();
+            if (prefix == null || "".equals(prefix)) {
+                return getTextFromProperPlace();
+            } else {
+                return prefix + ":" + getTextFromProperPlace();
+            }
+        }
+
+        return null;
+    }
+
+    public QName getTextAsQName() {
+        if (textNS != null) {
+            String prefix = textNS.getPrefix();
+            String name = textNS.getNamespaceURI();
+            if (prefix == null || "".equals(prefix)) {
+                return new QName(name, getTextFromProperPlace());
+            } else {
+                return new QName(textNS.getNamespaceURI(), getTextFromProperPlace(), prefix);
+            }
+        } else if (this.textValue != null || charArray != null) {
+            return new QName(getTextFromProperPlace());
+        } else {
+            try {
+                InputStream inStream;
+                inStream = this.getInputStream();
+                byte[] data;
+                StringBuffer text = new StringBuffer();
+                do {
+                    data = new byte[1024];
+                    int len;
+                    while ((len = inStream.read(data)) > 0) {
+                        byte[] temp = new byte[len];
+                        System.arraycopy(data, 0, temp, 0, len);
+                        text.append(Base64.encode(temp));
+                    }
+
+                } while (inStream.available() > 0);
+
+                return new QName(text.toString());
+            } catch (Exception e) {
+                throw new OMException(e);
+            }
+        }
+    }
+
+    public String getNodeValue() throws DOMException {
+        return this.getText();
+    }
+
+    public String getContentID() {
+        if (contentID == null) {
+            contentID = UUIDGenerator.getUUID() + "@apache.org";
+        }
+        return this.contentID;
+    }
+
+    public Object getDataHandler() {
+        /*
+         * this should return a DataHandler containing the binary data
+         * reperesented by the Base64 strings stored in OMText
+         */
+        if ((textValue != null|| charArray != null || textNS != null) & isBinary) {
+            String text = textNS == null ? getTextFromProperPlace() : getTextString();
+            return DataHandlerUtils
+                    .getDataHandlerFromText(text, mimeType);
+        } else {
+
+            if (dataHandlerObject == null) {
+                if (contentID == null) {
+                    throw new RuntimeException("ContentID is null");
+                }
+                dataHandlerObject = ((MTOMStAXSOAPModelBuilder) builder)
+                        .getDataHandler(contentID);
+            }
+            return dataHandlerObject;
+        }
+    }
+
+    public java.io.InputStream getInputStream() throws OMException {
+        if (isBinary) {
+            if (dataHandlerObject == null) {
+                getDataHandler();
+            }
+            InputStream inStream;
+            javax.activation.DataHandler dataHandler = (javax.activation.DataHandler) dataHandlerObject;
+            try {
+                inStream = dataHandler.getDataSource().getInputStream();
+            } catch (IOException e) {
+                throw new OMException(
+                        "Cannot get InputStream from DataHandler." + e);
+            }
+            return inStream;
+        } else {
+            throw new OMException("Unsupported Operation");
+        }
+    }
+
+    private void internalSerializeLocal(XMLStreamWriter writer2)
+            throws XMLStreamException {
+        MTOMXMLStreamWriter writer = (MTOMXMLStreamWriter) writer2;
+        if (!this.isBinary) {
+            writeOutput(writer);
+        } else {
+            if (writer.isOptimized()) {
+                if (contentID == null) {
+                    contentID = writer.getNextContentId();
+                }
+                // send binary as MTOM optimised
+                this.attribute = new AttrImpl(this.ownerNode, "href",
+                        new NamespaceImpl("", ""), 
+                        "cid:" + getContentID(),
+                        this.factory);
+                this.serializeStartpart(writer);
+                writer.writeOptimized(this);
+                writer.writeEndElement();
+            } else {
+                writer.writeCharacters(this.getText());
+            }
+        }
+    }
+
+    /*
+     * Methods to copy from OMSerialize utils.
+     */
+    private void serializeStartpart(XMLStreamWriter writer)
+            throws XMLStreamException {
+        String nameSpaceName = XOP_NS.getNamespaceURI();
+        String writer_prefix = writer.getPrefix(nameSpaceName);
+        String prefix = XOP_NS.getPrefix();
+        if (writer_prefix != null) {
+            writer.writeStartElement(nameSpaceName, this
+                    .getLocalName());
+        } else {
+            writer.writeStartElement(prefix, this.getLocalName(),
+                    nameSpaceName);
+            writer.setPrefix(prefix, nameSpaceName);
+        }
+        // add the elements attribute "href"
+        serializeAttribute(this.attribute, writer);
+        // add the namespace
+        serializeNamespace(XOP_NS, writer);
+    }
+
+    /**
+     * Method serializeAttribute.
+     * 
+     * @param attr
+     * @param writer
+     * @throws XMLStreamException
+     */
+    static void serializeAttribute(OMAttribute attr, XMLStreamWriter writer)
+            throws XMLStreamException {
+        // first check whether the attribute is associated with a namespace
+        OMNamespace ns = attr.getNamespace();
+        String prefix;
+        String namespaceName;
+        if (ns != null) {
+            // add the prefix if it's availble
+            prefix = ns.getPrefix();
+            namespaceName = ns.getNamespaceURI();
+            if (prefix != null) {
+                writer.writeAttribute(prefix, namespaceName, attr
+                        .getLocalName(), attr.getAttributeValue());
+            } else {
+                writer.writeAttribute(namespaceName, attr.getLocalName(), attr
+                        .getAttributeValue());
+            }
+        } else {
+            writer
+                    .writeAttribute(attr.getLocalName(), attr
+                            .getAttributeValue());
+        }
+    }
+
+    /**
+     * Method serializeNamespace.
+     * 
+     * @param namespace
+     * @param writer
+     * @throws XMLStreamException
+     */
+    static void serializeNamespace(OMNamespace namespace, XMLStreamWriter writer)
+            throws XMLStreamException {
+        if (namespace != null) {
+            String uri = namespace.getNamespaceURI();
+            String ns_prefix = namespace.getPrefix();
+            writer.writeNamespace(ns_prefix, namespace.getNamespaceURI());
+            writer.setPrefix(ns_prefix, uri);
+        }
+    }
+
+    public Node cloneNode(boolean deep) {
+        TextImpl textImpl = new TextImpl(this.textValue.toString(), this.factory);
+        textImpl.setOwnerDocument(this.ownerNode);
+        return textImpl;
+    }
+
+    public String getLocalName() {
+        return this.localName;
+    }
+    
+    
+    /*
+     * DOM-Level 3 methods
+     */
+    
+    
+    public String getWholeText() {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public boolean isElementContentWhitespace() {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public Text replaceWholeText(String arg0) throws DOMException {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public String toString() {
+        return (this.textValue != null) ? textValue.toString() : "";
+    }
+    
+	/* (non-Javadoc)
+	 * @see org.apache.axiom.om.OMNode#buildAll()
+	 */
+	public void buildWithAttachments() {
+		this.build();
+		if (isOptimized())
+		{
+			this.getDataHandler();
+		}
+	}
+	public boolean isBinary() {
+		return isBinary;
+	}
+
+    /**
+     * Receiving binary can happen as either MTOM attachments or as Base64 Text
+     * In the case of Base64 user has to explicitly specify that the content is 
+     * binary, before calling getDataHandler(), getInputStream()....
+     */
+	public void setBinary(boolean value) {
+		this.isBinary = value;
+		
+	}
+
+	public OMNamespace getNamespace() {
+		return textNS;
+	}
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/XMLChar.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/XMLChar.java
new file mode 100644
index 0000000..f846496
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/XMLChar.java
@@ -0,0 +1,644 @@
+/*

+ * Copyright 1999-2002,2004 The Apache Software Foundation.

+ * 

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.dom;

+

+/**

+ * This class defines the basic XML character properties. The data

+ * in this class can be used to verify that a character is a valid

+ * XML character or if the character is a space, name start, or name

+ * character.

+ * <p>

+ * A series of convenience methods are supplied to ease the burden

+ * of the developer. Because inlining the checks can improve per

+ * character performance, the tables of character properties are

+ * public. Using the character as an index into the <code>CHARS</code>

+ * array and applying the appropriate mask flag (e.g.

+ * <code>MASK_VALID</code>), yields the same results as calling the

+ * convenience methods. There is one exception: check the comments

+ * for the <code>isValid</code> method for details.

+ *

+ */

+public class XMLChar {

+

+    //

+    // Constants

+    //

+

+    /** Character flags. */

+    private static final byte[] CHARS = new byte[1 << 16];

+

+    /** Valid character mask. */

+    public static final int MASK_VALID = 0x01;

+

+    /** Space character mask. */

+    public static final int MASK_SPACE = 0x02;

+

+    /** Name start character mask. */

+    public static final int MASK_NAME_START = 0x04;

+

+    /** Name character mask. */

+    public static final int MASK_NAME = 0x08;

+

+    /** Pubid character mask. */

+    public static final int MASK_PUBID = 0x10;

+

+    /**

+     * Content character mask. Special characters are those that can

+     * be considered the start of markup, such as '&lt;' and '&amp;'.

+     * The various newline characters are considered special as well.

+     * All other valid XML characters can be considered content.

+     * <p>

+     * This is an optimization for the inner loop of character scanning.

+     */

+    public static final int MASK_CONTENT = 0x20;

+

+    /** NCName start character mask. */

+    public static final int MASK_NCNAME_START = 0x40;

+

+    /** NCName character mask. */

+    public static final int MASK_NCNAME = 0x80;

+

+    //

+    // Static initialization

+    //

+

+    static {

+

+        //

+        // [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] |

+        //              [#xE000-#xFFFD] | [#x10000-#x10FFFF]

+        //

+

+        int charRange[] = {

+            0x0009, 0x000A, 0x000D, 0x000D, 0x0020, 0xD7FF, 0xE000, 0xFFFD,

+        };

+

+        //

+        // [3] S ::= (#x20 | #x9 | #xD | #xA)+

+        //

+

+        int spaceChar[] = {

+            0x0020, 0x0009, 0x000D, 0x000A,

+        };

+

+        //

+        // [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' |

+        //                  CombiningChar | Extender

+        //

+

+        int nameChar[] = {

+            0x002D, 0x002E, // '-' and '.'

+        };

+

+        //

+        // [5] Name ::= (Letter | '_' | ':') (NameChar)*

+        //

+

+        int nameStartChar[] = {

+            0x003A, 0x005F, // ':' and '_'

+        };

+

+        //

+        // [13] PubidChar ::= #x20 | 0xD | 0xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]

+        //

+

+        int pubidChar[] = {

+            0x000A, 0x000D, 0x0020, 0x0021, 0x0023, 0x0024, 0x0025, 0x003D,

+            0x005F

+        };

+

+        int pubidRange[] = {

+            0x0027, 0x003B, 0x003F, 0x005A, 0x0061, 0x007A

+        };

+

+        //

+        // [84] Letter ::= BaseChar | Ideographic

+        //

+

+        int letterRange[] = {

+            // BaseChar

+            0x0041, 0x005A, 0x0061, 0x007A, 0x00C0, 0x00D6, 0x00D8, 0x00F6,

+            0x00F8, 0x0131, 0x0134, 0x013E, 0x0141, 0x0148, 0x014A, 0x017E,

+            0x0180, 0x01C3, 0x01CD, 0x01F0, 0x01F4, 0x01F5, 0x01FA, 0x0217,

+            0x0250, 0x02A8, 0x02BB, 0x02C1, 0x0388, 0x038A, 0x038E, 0x03A1,

+            0x03A3, 0x03CE, 0x03D0, 0x03D6, 0x03E2, 0x03F3, 0x0401, 0x040C,

+            0x040E, 0x044F, 0x0451, 0x045C, 0x045E, 0x0481, 0x0490, 0x04C4,

+            0x04C7, 0x04C8, 0x04CB, 0x04CC, 0x04D0, 0x04EB, 0x04EE, 0x04F5,

+            0x04F8, 0x04F9, 0x0531, 0x0556, 0x0561, 0x0586, 0x05D0, 0x05EA,

+            0x05F0, 0x05F2, 0x0621, 0x063A, 0x0641, 0x064A, 0x0671, 0x06B7,

+            0x06BA, 0x06BE, 0x06C0, 0x06CE, 0x06D0, 0x06D3, 0x06E5, 0x06E6,

+            0x0905, 0x0939, 0x0958, 0x0961, 0x0985, 0x098C, 0x098F, 0x0990,

+            0x0993, 0x09A8, 0x09AA, 0x09B0, 0x09B6, 0x09B9, 0x09DC, 0x09DD,

+            0x09DF, 0x09E1, 0x09F0, 0x09F1, 0x0A05, 0x0A0A, 0x0A0F, 0x0A10,

+            0x0A13, 0x0A28, 0x0A2A, 0x0A30, 0x0A32, 0x0A33, 0x0A35, 0x0A36,

+            0x0A38, 0x0A39, 0x0A59, 0x0A5C, 0x0A72, 0x0A74, 0x0A85, 0x0A8B,

+            0x0A8F, 0x0A91, 0x0A93, 0x0AA8, 0x0AAA, 0x0AB0, 0x0AB2, 0x0AB3,

+            0x0AB5, 0x0AB9, 0x0B05, 0x0B0C, 0x0B0F, 0x0B10, 0x0B13, 0x0B28,

+            0x0B2A, 0x0B30, 0x0B32, 0x0B33, 0x0B36, 0x0B39, 0x0B5C, 0x0B5D,

+            0x0B5F, 0x0B61, 0x0B85, 0x0B8A, 0x0B8E, 0x0B90, 0x0B92, 0x0B95,

+            0x0B99, 0x0B9A, 0x0B9E, 0x0B9F, 0x0BA3, 0x0BA4, 0x0BA8, 0x0BAA,

+            0x0BAE, 0x0BB5, 0x0BB7, 0x0BB9, 0x0C05, 0x0C0C, 0x0C0E, 0x0C10,

+            0x0C12, 0x0C28, 0x0C2A, 0x0C33, 0x0C35, 0x0C39, 0x0C60, 0x0C61,

+            0x0C85, 0x0C8C, 0x0C8E, 0x0C90, 0x0C92, 0x0CA8, 0x0CAA, 0x0CB3,

+            0x0CB5, 0x0CB9, 0x0CE0, 0x0CE1, 0x0D05, 0x0D0C, 0x0D0E, 0x0D10,

+            0x0D12, 0x0D28, 0x0D2A, 0x0D39, 0x0D60, 0x0D61, 0x0E01, 0x0E2E,

+            0x0E32, 0x0E33, 0x0E40, 0x0E45, 0x0E81, 0x0E82, 0x0E87, 0x0E88,

+            0x0E94, 0x0E97, 0x0E99, 0x0E9F, 0x0EA1, 0x0EA3, 0x0EAA, 0x0EAB,

+            0x0EAD, 0x0EAE, 0x0EB2, 0x0EB3, 0x0EC0, 0x0EC4, 0x0F40, 0x0F47,

+            0x0F49, 0x0F69, 0x10A0, 0x10C5, 0x10D0, 0x10F6, 0x1102, 0x1103,

+            0x1105, 0x1107, 0x110B, 0x110C, 0x110E, 0x1112, 0x1154, 0x1155,

+            0x115F, 0x1161, 0x116D, 0x116E, 0x1172, 0x1173, 0x11AE, 0x11AF,

+            0x11B7, 0x11B8, 0x11BC, 0x11C2, 0x1E00, 0x1E9B, 0x1EA0, 0x1EF9,

+            0x1F00, 0x1F15, 0x1F18, 0x1F1D, 0x1F20, 0x1F45, 0x1F48, 0x1F4D,

+            0x1F50, 0x1F57, 0x1F5F, 0x1F7D, 0x1F80, 0x1FB4, 0x1FB6, 0x1FBC,

+            0x1FC2, 0x1FC4, 0x1FC6, 0x1FCC, 0x1FD0, 0x1FD3, 0x1FD6, 0x1FDB,

+            0x1FE0, 0x1FEC, 0x1FF2, 0x1FF4, 0x1FF6, 0x1FFC, 0x212A, 0x212B,

+            0x2180, 0x2182, 0x3041, 0x3094, 0x30A1, 0x30FA, 0x3105, 0x312C,

+            0xAC00, 0xD7A3,

+            // Ideographic

+            0x3021, 0x3029, 0x4E00, 0x9FA5,

+        };

+        int letterChar[] = {

+            // BaseChar

+            0x0386, 0x038C, 0x03DA, 0x03DC, 0x03DE, 0x03E0, 0x0559, 0x06D5,

+            0x093D, 0x09B2, 0x0A5E, 0x0A8D, 0x0ABD, 0x0AE0, 0x0B3D, 0x0B9C,

+            0x0CDE, 0x0E30, 0x0E84, 0x0E8A, 0x0E8D, 0x0EA5, 0x0EA7, 0x0EB0,

+            0x0EBD, 0x1100, 0x1109, 0x113C, 0x113E, 0x1140, 0x114C, 0x114E,

+            0x1150, 0x1159, 0x1163, 0x1165, 0x1167, 0x1169, 0x1175, 0x119E,

+            0x11A8, 0x11AB, 0x11BA, 0x11EB, 0x11F0, 0x11F9, 0x1F59, 0x1F5B,

+            0x1F5D, 0x1FBE, 0x2126, 0x212E,

+            // Ideographic

+            0x3007,

+        };

+

+        //

+        // [87] CombiningChar ::= ...

+        //

+

+        int combiningCharRange[] = {

+            0x0300, 0x0345, 0x0360, 0x0361, 0x0483, 0x0486, 0x0591, 0x05A1,

+            0x05A3, 0x05B9, 0x05BB, 0x05BD, 0x05C1, 0x05C2, 0x064B, 0x0652,

+            0x06D6, 0x06DC, 0x06DD, 0x06DF, 0x06E0, 0x06E4, 0x06E7, 0x06E8,

+            0x06EA, 0x06ED, 0x0901, 0x0903, 0x093E, 0x094C, 0x0951, 0x0954,

+            0x0962, 0x0963, 0x0981, 0x0983, 0x09C0, 0x09C4, 0x09C7, 0x09C8,

+            0x09CB, 0x09CD, 0x09E2, 0x09E3, 0x0A40, 0x0A42, 0x0A47, 0x0A48,

+            0x0A4B, 0x0A4D, 0x0A70, 0x0A71, 0x0A81, 0x0A83, 0x0ABE, 0x0AC5,

+            0x0AC7, 0x0AC9, 0x0ACB, 0x0ACD, 0x0B01, 0x0B03, 0x0B3E, 0x0B43,

+            0x0B47, 0x0B48, 0x0B4B, 0x0B4D, 0x0B56, 0x0B57, 0x0B82, 0x0B83,

+            0x0BBE, 0x0BC2, 0x0BC6, 0x0BC8, 0x0BCA, 0x0BCD, 0x0C01, 0x0C03,

+            0x0C3E, 0x0C44, 0x0C46, 0x0C48, 0x0C4A, 0x0C4D, 0x0C55, 0x0C56,

+            0x0C82, 0x0C83, 0x0CBE, 0x0CC4, 0x0CC6, 0x0CC8, 0x0CCA, 0x0CCD,

+            0x0CD5, 0x0CD6, 0x0D02, 0x0D03, 0x0D3E, 0x0D43, 0x0D46, 0x0D48,

+            0x0D4A, 0x0D4D, 0x0E34, 0x0E3A, 0x0E47, 0x0E4E, 0x0EB4, 0x0EB9,

+            0x0EBB, 0x0EBC, 0x0EC8, 0x0ECD, 0x0F18, 0x0F19, 0x0F71, 0x0F84,

+            0x0F86, 0x0F8B, 0x0F90, 0x0F95, 0x0F99, 0x0FAD, 0x0FB1, 0x0FB7,

+            0x20D0, 0x20DC, 0x302A, 0x302F,

+        };

+

+        int combiningCharChar[] = {

+            0x05BF, 0x05C4, 0x0670, 0x093C, 0x094D, 0x09BC, 0x09BE, 0x09BF,

+            0x09D7, 0x0A02, 0x0A3C, 0x0A3E, 0x0A3F, 0x0ABC, 0x0B3C, 0x0BD7,

+            0x0D57, 0x0E31, 0x0EB1, 0x0F35, 0x0F37, 0x0F39, 0x0F3E, 0x0F3F,

+            0x0F97, 0x0FB9, 0x20E1, 0x3099, 0x309A,

+        };

+

+        //

+        // [88] Digit ::= ...

+        //

+

+        int digitRange[] = {

+            0x0030, 0x0039, 0x0660, 0x0669, 0x06F0, 0x06F9, 0x0966, 0x096F,

+            0x09E6, 0x09EF, 0x0A66, 0x0A6F, 0x0AE6, 0x0AEF, 0x0B66, 0x0B6F,

+            0x0BE7, 0x0BEF, 0x0C66, 0x0C6F, 0x0CE6, 0x0CEF, 0x0D66, 0x0D6F,

+            0x0E50, 0x0E59, 0x0ED0, 0x0ED9, 0x0F20, 0x0F29,

+        };

+

+        //

+        // [89] Extender ::= ...

+        //

+

+        int extenderRange[] = {

+            0x3031, 0x3035, 0x309D, 0x309E, 0x30FC, 0x30FE,

+        };

+

+        int extenderChar[] = {

+            0x00B7, 0x02D0, 0x02D1, 0x0387, 0x0640, 0x0E46, 0x0EC6, 0x3005,

+        };

+

+        //

+        // SpecialChar ::= '<', '&', '\n', '\r', ']'

+        //

+

+        int specialChar[] = {

+            '<', '&', '\n', '\r', ']',

+        };

+

+        //

+        // Initialize

+        //

+

+        // set valid characters

+        for (int i = 0; i < charRange.length; i += 2) {

+            for (int j = charRange[i]; j <= charRange[i + 1]; j++) {

+                CHARS[j] |= MASK_VALID | MASK_CONTENT;

+            }

+        }

+

+        // remove special characters

+        for (int i = 0; i < specialChar.length; i++) {

+            CHARS[specialChar[i]] = (byte)(CHARS[specialChar[i]] & ~MASK_CONTENT);

+        }

+

+        // set space characters

+        for (int i = 0; i < spaceChar.length; i++) {

+            CHARS[spaceChar[i]] |= MASK_SPACE;

+        }

+

+        // set name start characters

+        for (int i = 0; i < nameStartChar.length; i++) {

+            CHARS[nameStartChar[i]] |= MASK_NAME_START | MASK_NAME |

+                                       MASK_NCNAME_START | MASK_NCNAME;

+        }

+        for (int i = 0; i < letterRange.length; i += 2) {

+            for (int j = letterRange[i]; j <= letterRange[i + 1]; j++) {

+                CHARS[j] |= MASK_NAME_START | MASK_NAME |

+                            MASK_NCNAME_START | MASK_NCNAME;

+            }

+        }

+        for (int i = 0; i < letterChar.length; i++) {

+            CHARS[letterChar[i]] |= MASK_NAME_START | MASK_NAME |

+                                    MASK_NCNAME_START | MASK_NCNAME;

+        }

+

+        // set name characters

+        for (int i = 0; i < nameChar.length; i++) {

+            CHARS[nameChar[i]] |= MASK_NAME | MASK_NCNAME;

+        }

+        for (int i = 0; i < digitRange.length; i += 2) {

+            for (int j = digitRange[i]; j <= digitRange[i + 1]; j++) {

+                CHARS[j] |= MASK_NAME | MASK_NCNAME;

+            }

+        }

+        for (int i = 0; i < combiningCharRange.length; i += 2) {

+            for (int j = combiningCharRange[i]; j <= combiningCharRange[i + 1]; j++) {

+                CHARS[j] |= MASK_NAME | MASK_NCNAME;

+            }

+        }

+        for (int i = 0; i < combiningCharChar.length; i++) {

+            CHARS[combiningCharChar[i]] |= MASK_NAME | MASK_NCNAME;

+        }

+        for (int i = 0; i < extenderRange.length; i += 2) {

+            for (int j = extenderRange[i]; j <= extenderRange[i + 1]; j++) {

+                CHARS[j] |= MASK_NAME | MASK_NCNAME;

+            }

+        }

+        for (int i = 0; i < extenderChar.length; i++) {

+            CHARS[extenderChar[i]] |= MASK_NAME | MASK_NCNAME;

+        }

+

+        // remove ':' from allowable MASK_NCNAME_START and MASK_NCNAME chars

+        CHARS[':'] &= ~(MASK_NCNAME_START | MASK_NCNAME);

+

+        // set Pubid characters

+        for (int i = 0; i < pubidChar.length; i++) {

+            CHARS[pubidChar[i]] |= MASK_PUBID;

+        }

+        for (int i = 0; i < pubidRange.length; i += 2) {

+            for (int j = pubidRange[i]; j <= pubidRange[i + 1]; j++) {

+                CHARS[j] |= MASK_PUBID;

+            }

+        }

+

+    } // <clinit>()

+

+    //

+    // Public static methods

+    //

+

+    /**

+     * Returns true if the specified character is a supplemental character.

+     *

+     * @param c The character to check.

+     */

+    public static boolean isSupplemental(int c) {

+        return (c >= 0x10000 && c <= 0x10FFFF);

+    }

+

+    /**

+     * Returns true the supplemental character corresponding to the given

+     * surrogates.

+     *

+     * @param h The high surrogate.

+     * @param l The low surrogate.

+     */

+    public static int supplemental(char h, char l) {

+        return (h - 0xD800) * 0x400 + (l - 0xDC00) + 0x10000;

+    }

+

+    /**

+     * Returns the high surrogate of a supplemental character

+     *

+     * @param c The supplemental character to "split".

+     */

+    public static char highSurrogate(int c) {

+        return (char) (((c - 0x00010000) >> 10) + 0xD800);

+    }

+

+    /**

+     * Returns the low surrogate of a supplemental character

+     *

+     * @param c The supplemental character to "split".

+     */

+    public static char lowSurrogate(int c) {

+        return (char) (((c - 0x00010000) & 0x3FF) + 0xDC00);

+    }

+

+    /**

+     * Returns whether the given character is a high surrogate

+     *

+     * @param c The character to check.

+     */

+    public static boolean isHighSurrogate(int c) {

+        return (0xD800 <= c && c <= 0xDBFF);

+    }

+

+    /**

+     * Returns whether the given character is a low surrogate

+     *

+     * @param c The character to check.

+     */

+    public static boolean isLowSurrogate(int c) {

+        return (0xDC00 <= c && c <= 0xDFFF);

+    }

+

+

+    /**

+     * Returns true if the specified character is valid. This method

+     * also checks the surrogate character range from 0x10000 to 0x10FFFF.

+     * <p>

+     * If the program chooses to apply the mask directly to the

+     * <code>CHARS</code> array, then they are responsible for checking

+     * the surrogate character range.

+     *

+     * @param c The character to check.

+     */

+    public static boolean isValid(int c) {

+        return (c < 0x10000 && (CHARS[c] & MASK_VALID) != 0) ||

+               (0x10000 <= c && c <= 0x10FFFF);

+    } // isValid(int):boolean

+

+    /**

+     * Returns true if the specified character is invalid.

+     *

+     * @param c The character to check.

+     */

+    public static boolean isInvalid(int c) {

+        return !isValid(c);

+    } // isInvalid(int):boolean

+

+    /**

+     * Returns true if the specified character can be considered content.

+     *

+     * @param c The character to check.

+     */

+    public static boolean isContent(int c) {

+        return (c < 0x10000 && (CHARS[c] & MASK_CONTENT) != 0) ||

+               (0x10000 <= c && c <= 0x10FFFF);

+    } // isContent(int):boolean

+

+    /**

+     * Returns true if the specified character can be considered markup.

+     * Markup characters include '&lt;', '&amp;', and '%'.

+     *

+     * @param c The character to check.

+     */

+    public static boolean isMarkup(int c) {

+        return c == '<' || c == '&' || c == '%';

+    } // isMarkup(int):boolean

+

+    /**

+     * Returns true if the specified character is a space character

+     * as defined by production [3] in the XML 1.0 specification.

+     *

+     * @param c The character to check.

+     */

+    public static boolean isSpace(int c) {

+        return c < 0x10000 && (CHARS[c] & MASK_SPACE) != 0;

+    } // isSpace(int):boolean

+

+    /**

+     * Returns true if the specified character is a space character

+     * as amdended in the XML 1.1 specification.

+     *

+     * @param c The character to check.

+     */

+    public static boolean isXML11Space(int c) {

+        return (c < 0x10000 && (CHARS[c] & MASK_SPACE) != 0) ||

+            c == 0x85 || c == 0x2028;

+    } // isXML11Space(int):boolean

+

+    /**

+     * Returns true if the specified character is a valid name start

+     * character as defined by production [5] in the XML 1.0

+     * specification.

+     *

+     * @param c The character to check.

+     */

+    public static boolean isNameStart(int c) {

+        return c < 0x10000 && (CHARS[c] & MASK_NAME_START) != 0;

+    } // isNameStart(int):boolean

+

+    /**

+     * Returns true if the specified character is a valid name

+     * character as defined by production [4] in the XML 1.0

+     * specification.

+     *

+     * @param c The character to check.

+     */

+    public static boolean isName(int c) {

+        return c < 0x10000 && (CHARS[c] & MASK_NAME) != 0;

+    } // isName(int):boolean

+

+    /**

+     * Returns true if the specified character is a valid NCName start

+     * character as defined by production [4] in Namespaces in XML

+     * recommendation.

+     *

+     * @param c The character to check.

+     */

+    public static boolean isNCNameStart(int c) {

+        return c < 0x10000 && (CHARS[c] & MASK_NCNAME_START) != 0;

+    } // isNCNameStart(int):boolean

+

+    /**

+     * Returns true if the specified character is a valid NCName

+     * character as defined by production [5] in Namespaces in XML

+     * recommendation.

+     *

+     * @param c The character to check.

+     */

+    public static boolean isNCName(int c) {

+        return c < 0x10000 && (CHARS[c] & MASK_NCNAME) != 0;

+    } // isNCName(int):boolean

+

+    /**

+     * Returns true if the specified character is a valid Pubid

+     * character as defined by production [13] in the XML 1.0

+     * specification.

+     *

+     * @param c The character to check.

+     */

+    public static boolean isPubid(int c) {

+        return c < 0x10000 && (CHARS[c] & MASK_PUBID) != 0;

+    } // isPubid(int):boolean

+

+    /*

+     * [5] Name ::= (Letter | '_' | ':') (NameChar)*

+     */

+    /**

+     * Check to see if a string is a valid Name according to [5]

+     * in the XML 1.0 Recommendation

+     *

+     * @param name string to check

+     * @return true if name is a valid Name

+     */

+    public static boolean isValidName(String name) {

+        if (name.length() == 0)

+            return false;

+        char ch = name.charAt(0);

+        if(!isNameStart(ch))

+           return false;

+        for (int i = 1; i < name.length(); i++ ) {

+           ch = name.charAt(i);

+           if(!isName(ch) ){

+              return false;

+           }

+        }

+        return true;

+    } // isValidName(String):boolean

+

+

+    /*

+     * from the namespace rec

+     * [4] NCName ::= (Letter | '_') (NCNameChar)*

+     */

+    /**

+     * Check to see if a string is a valid NCName according to [4]

+     * from the XML Namespaces 1.0 Recommendation

+     *

+     * @param ncName string to check

+     * @return true if name is a valid NCName

+     */

+    public static boolean isValidNCName(String ncName) {

+        if (ncName.length() == 0)

+            return false;

+        char ch = ncName.charAt(0);

+        if(!isNCNameStart(ch))

+           return false;

+        for (int i = 1; i < ncName.length(); i++ ) {

+           ch = ncName.charAt(i);

+           if(!isNCName(ch) ){

+              return false;

+           }

+        }

+        return true;

+    } // isValidNCName(String):boolean

+

+    /*

+     * [7] Nmtoken ::= (NameChar)+

+     */

+    /**

+     * Check to see if a string is a valid Nmtoken according to [7]

+     * in the XML 1.0 Recommendation

+     *

+     * @param nmtoken string to check

+     * @return true if nmtoken is a valid Nmtoken

+     */

+    public static boolean isValidNmtoken(String nmtoken) {

+        if (nmtoken.length() == 0)

+            return false;

+        for (int i = 0; i < nmtoken.length(); i++ ) {

+           char ch = nmtoken.charAt(i);

+           if(  ! isName( ch ) ){

+              return false;

+           }

+        }

+        return true;

+    } // isValidName(String):boolean

+

+

+

+

+

+    // encodings

+

+    /**

+     * Returns true if the encoding name is a valid IANA encoding.

+     * This method does not verify that there is a decoder available

+     * for this encoding, only that the characters are valid for an

+     * IANA encoding name.

+     *

+     * @param ianaEncoding The IANA encoding name.

+     */

+    public static boolean isValidIANAEncoding(String ianaEncoding) {

+        if (ianaEncoding != null) {

+            int length = ianaEncoding.length();

+            if (length > 0) {

+                char c = ianaEncoding.charAt(0);

+                if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {

+                    for (int i = 1; i < length; i++) {

+                        c = ianaEncoding.charAt(i);

+                        if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') &&

+                            (c < '0' || c > '9') && c != '.' && c != '_' &&

+                            c != '-') {

+                            return false;

+                        }

+                    }

+                    return true;

+                }

+            }

+        }

+        return false;

+    } // isValidIANAEncoding(String):boolean

+

+    /**

+     * Returns true if the encoding name is a valid Java encoding.

+     * This method does not verify that there is a decoder available

+     * for this encoding, only that the characters are valid for an

+     * Java encoding name.

+     *

+     * @param javaEncoding The Java encoding name.

+     */

+    public static boolean isValidJavaEncoding(String javaEncoding) {

+        if (javaEncoding != null) {

+            int length = javaEncoding.length();

+            if (length > 0) {

+                for (int i = 1; i < length; i++) {

+                    char c = javaEncoding.charAt(i);

+                    if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') &&

+                        (c < '0' || c > '9') && c != '.' && c != '_' &&

+                        c != '-') {

+                        return false;

+                    }

+                }

+                return true;

+            }

+        }

+        return false;

+    } // isValidIANAEncoding(String):boolean

+

+} // class XMLChar

diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java
new file mode 100644
index 0000000..ff8d4aa
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java
@@ -0,0 +1,332 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom.factory;
+
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMComment;
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMDataSource;
+import org.apache.axiom.om.OMDocType;
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMProcessingInstruction;
+import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.om.impl.dom.AttrImpl;
+import org.apache.axiom.om.impl.dom.CommentImpl;
+import org.apache.axiom.om.impl.dom.DocumentFragmentimpl;
+import org.apache.axiom.om.impl.dom.DocumentImpl;
+import org.apache.axiom.om.impl.dom.ElementImpl;
+import org.apache.axiom.om.impl.dom.NamespaceImpl;
+import org.apache.axiom.om.impl.dom.OMDOMException;
+import org.apache.axiom.om.impl.dom.ParentNode;
+import org.apache.axiom.om.impl.dom.TextImpl;
+import org.w3c.dom.Node;
+
+import javax.xml.namespace.QName;
+
+public class OMDOMFactory implements OMFactory {
+
+    protected DocumentImpl document;
+
+    public OMDOMFactory() {
+    }
+
+    public OMDOMFactory(DocumentImpl doc) {
+        this.document = doc;
+    }
+
+    public OMDocument createOMDocument() {
+        if (this.document == null)
+            this.document = new DocumentImpl(this);
+
+        return this.document;
+    }
+
+    /**
+     * Configure this factory to use the given document. Use with care.
+     *
+     * @param document
+     */
+    public void setDocument(DocumentImpl document) {
+        this.document = document;
+    }
+
+    public OMElement createOMElement(String localName, OMNamespace ns) {
+        return new ElementImpl((DocumentImpl) this.createOMDocument(),
+                localName, (NamespaceImpl) ns, this);
+    }
+
+    public OMElement createOMElement(String localName, OMNamespace ns,
+            OMContainer parent) throws OMDOMException {
+        switch (((ParentNode) parent).getNodeType()) {
+        case Node.ELEMENT_NODE: // We are adding a new child to an elem
+            ElementImpl parentElem = (ElementImpl) parent;
+            ElementImpl elem = new ElementImpl((DocumentImpl) parentElem
+                    .getOwnerDocument(), localName, (NamespaceImpl) ns, this);
+            parentElem.appendChild(elem);
+            return elem;
+
+        case Node.DOCUMENT_NODE:
+            DocumentImpl docImpl = (DocumentImpl) parent;
+            return new ElementImpl(docImpl, localName,
+                    (NamespaceImpl) ns, this);
+
+        case Node.DOCUMENT_FRAGMENT_NODE:
+            DocumentFragmentimpl docFragImpl = (DocumentFragmentimpl) parent;
+            return new ElementImpl((DocumentImpl) docFragImpl
+                    .getOwnerDocument(), localName, (NamespaceImpl) ns, this);
+        default:
+            throw new OMDOMException(
+                    "The parent container can only be an ELEMENT, DOCUMENT " +
+                    "or a DOCUMENT FRAGMENT");
+        }
+    }
+
+    /**
+     * Creates an OMElement with the builder.
+     */
+    public OMElement createOMElement(String localName, OMNamespace ns,
+            OMContainer parent, OMXMLParserWrapper builder) {
+        switch (((ParentNode) parent).getNodeType()) {
+        case Node.ELEMENT_NODE: // We are adding a new child to an elem
+            ElementImpl parentElem = (ElementImpl) parent;
+            ElementImpl elem = new ElementImpl((DocumentImpl) parentElem
+                    .getOwnerDocument(), localName, (NamespaceImpl) ns,
+                    builder, this);
+            parentElem.appendChild(elem);
+            return elem;
+        case Node.DOCUMENT_NODE:
+            DocumentImpl docImpl = (DocumentImpl) parent;
+            ElementImpl elem2 = new ElementImpl(docImpl, localName,
+                    (NamespaceImpl) ns, builder, this);
+            docImpl.appendChild(elem2);
+            return elem2;
+
+        case Node.DOCUMENT_FRAGMENT_NODE:
+            DocumentFragmentimpl docFragImpl = (DocumentFragmentimpl) parent;
+            return new ElementImpl((DocumentImpl) docFragImpl
+                    .getOwnerDocument(), localName, (NamespaceImpl) ns,
+                    builder, this);
+        default:
+            throw new OMDOMException(
+                    "The parent container can only be an ELEMENT, DOCUMENT " +
+                    "or a DOCUMENT FRAGMENT");
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.axiom.om.OMFactory#createOMElement(org.apache.axiom.om.OMDataSource, java.lang.String, org.apache.axiom.om.OMNamespace, org.apache.axiom.om.OMContainer)
+     */
+    public OMElement createOMElement(OMDataSource source, String localName, OMNamespace ns, OMContainer parent) {
+        throw new UnsupportedOperationException("Not supported for DOM");
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.axiom.om.OMFactory#createOMElement(org.apache.axiom.om.OMDataSource, java.lang.String, org.apache.axiom.om.OMNamespace)
+     */
+    public OMElement createOMElement(OMDataSource source, String localName, OMNamespace ns) {
+        throw new UnsupportedOperationException("Not supported for DOM");
+    }
+
+    /**
+     * Creates an OMElement.
+     * 
+     * @see org.apache.axiom.om.OMFactory#createOMElement(java.lang.String,
+     *      java.lang.String, java.lang.String)
+     */
+    public OMElement createOMElement(String localName, String namespaceURI,
+            String namespacePrefix) {
+        NamespaceImpl ns = new NamespaceImpl(namespaceURI, namespacePrefix);
+        return this.createOMElement(localName, ns);
+    }
+
+    /**
+     * Creates a new OMDOM Element node and adds it to the given parent.
+     * 
+     * @see #createOMElement(String, OMNamespace, OMContainer)
+     * @see org.apache.axiom.om.OMFactory#createOMElement(
+     * javax.xml.namespace.QName, org.apache.axiom.om.OMContainer)
+     */
+    public OMElement createOMElement(QName qname, OMContainer parent)
+            throws OMException {
+        NamespaceImpl ns;
+        if (qname.getPrefix() != null) {
+            ns = new NamespaceImpl(qname.getNamespaceURI(), qname.getPrefix());
+        } else {
+            ns = new NamespaceImpl(qname.getNamespaceURI());
+        }
+        return createOMElement(qname.getLocalPart(), ns, parent);
+    }
+
+    /**
+     * Creates a new OMNamespace.
+     * 
+     * @see org.apache.axiom.om.OMFactory#createOMNamespace(java.lang.String,
+     *      java.lang.String)
+     */
+    public OMNamespace createOMNamespace(String uri, String prefix) {
+        return new NamespaceImpl(uri, prefix);
+    }
+
+    /**
+     * Creates a new OMDOM Text node with the given value and appends it to the
+     * given parent element.
+     * 
+     * @see org.apache.axiom.om.OMFactory#createOMText(
+     *      org.apache.axiom.om.OMElement,java.lang.String)
+     */
+    public OMText createOMText(OMContainer parent, String text) {
+        ElementImpl parentElem = (ElementImpl) parent;
+        TextImpl txt = new TextImpl((DocumentImpl) parentElem
+                .getOwnerDocument(), text, this);
+        parentElem.addChild(txt);
+        return txt;
+    }
+
+    public OMText createOMText(OMContainer parent, QName text) {
+        return new TextImpl(parent, text, this);
+    }
+    
+    public OMText createOMText(OMContainer parent, QName text, int type) {
+        return new TextImpl(parent, text, type, this);
+    }
+    
+    public OMText createOMText(OMContainer parent, String text, int type) {
+        OMText textNode = createOMText(parent, text);
+        ((OMNodeEx) textNode).setType(type);
+        return textNode;
+    }
+
+    public OMText createOMText(OMContainer parent, char[] charArary, int type) {
+        ElementImpl parentElem = (ElementImpl) parent;
+        TextImpl txt = new TextImpl((DocumentImpl) parentElem
+                .getOwnerDocument(), charArary, this);
+        parentElem.addChild(txt);
+        return txt;
+    }
+
+    /**
+     * Creates a OMDOM Text node carrying the given value.
+     * 
+     * @see org.apache.axiom.om.OMFactory#createOMText(java.lang.String)
+     */
+    public OMText createOMText(String s) {
+        return new TextImpl(this.document,s, this);
+    }
+
+    /**
+     * Creates a Character node of the given type.
+     * 
+     * @see org.apache.axiom.om.OMFactory#createOMText(java.lang.String, int)
+     */
+    public OMText createOMText(String text, int type) {
+        switch (type) {
+        case OMNode.TEXT_NODE:
+            return new TextImpl(this.document, text, this);
+        default:
+            throw new OMDOMException("Only Text nodes are supported right now");
+        }
+    }
+
+    /**
+     * Creates a new OMDOM Text node with the value of the given text value
+     * along with the MTOM optimization parameters and returns it.
+     * 
+     * @see org.apache.axiom.om.OMFactory#createOMText(java.lang.String,
+     *      java.lang.String, boolean)
+     */
+    public OMText createOMText(String text, String mimeType, boolean optimize) {
+        return new TextImpl(this.document, text, mimeType, optimize, this);
+    }
+
+    /**
+     * Creates a new OMDOM Text node with the given datahandler and the given
+     * MTOM optimization configuration and returns it.
+     * 
+     * @see org.apache.axiom.om.OMFactory#createOMText(java.lang.Object, boolean)
+     */
+    public OMText createOMText(Object dataHandler, boolean optimize) {
+        return new TextImpl(this.document, dataHandler, optimize, this);
+    }
+
+    /**
+     * Creates an OMDOM Text node, adds it to the give parent element and
+     * returns it.
+     * 
+     * @see org.apache.axiom.om.OMFactory#createOMText(OMContainer,
+     *      java.lang.String, java.lang.String, boolean)
+     */
+    public OMText createOMText(OMContainer parent, String s, String mimeType,
+                               boolean optimize) {
+        TextImpl text = new TextImpl((DocumentImpl) ((ElementImpl) parent)
+                .getOwnerDocument(), s, mimeType, optimize, this);
+        parent.addChild(text);
+        return text;
+    }
+
+    public OMText createOMText(String contentID, OMContainer parent,
+                               OMXMLParserWrapper builder) {
+        TextImpl text = new TextImpl(contentID, parent, builder, this);
+        parent.addChild(text);
+        return text;
+    }
+
+    public OMAttribute createOMAttribute(String localName, OMNamespace ns,
+            String value) {
+        return new AttrImpl(this.getDocument(), localName, ns, value, this);
+    }
+
+    public OMDocType createOMDocType(OMContainer parent, String content) {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public OMProcessingInstruction createOMProcessingInstruction(
+            OMContainer parent, String piTarget, String piData) {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public OMComment createOMComment(OMContainer parent, String content) {
+        DocumentImpl doc = null;
+        if (parent instanceof DocumentImpl) {
+            doc = (DocumentImpl) parent;
+        } else {
+            doc = (DocumentImpl) ((ParentNode) parent).getOwnerDocument();
+        }
+
+        CommentImpl comment = new CommentImpl(doc, content, this);
+        parent.addChild(comment);
+        return comment;
+    }
+
+    public DocumentImpl getDocument() {
+        return (DocumentImpl) this.createOMDocument();
+    }
+
+    public OMDocument createOMDocument(OMXMLParserWrapper builder) {
+        this.document = new DocumentImpl(builder, this);
+        return this.document;
+    }
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderFactoryImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderFactoryImpl.java
new file mode 100644
index 0000000..90797e0
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderFactoryImpl.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom.jaxp;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.validation.Schema;
+
+public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory {
+
+    /**
+     * Temporary solution until DOOM's DocumentBuilder module is done.
+     * Use ThreadLocal to determine whether or not DOOM implementation is required.
+     * By default (isDOOMRequired() == false), we will use the one from JDK (Crimson)
+     */
+    private static DocumentBuilderFactory originalDocumentBuilderFactory = null;
+    private static String originalDocumentBuilderFactoryClassName = null;
+    private static ThreadLocal documentBuilderFactoryTracker = new ThreadLocal();
+    
+    protected Schema schema;
+    
+    public static boolean isDOOMRequired() {
+        Object value = documentBuilderFactoryTracker.get();
+        return (value != null);
+    }
+    
+    public static void setDOOMRequired(boolean isDOOMRequired) {
+        String systemKey = DocumentBuilderFactory.class.getName();
+        if (isDOOMRequired) {
+            if (!isDOOMRequired()) {
+                originalDocumentBuilderFactory = DocumentBuilderFactory.newInstance();
+                originalDocumentBuilderFactoryClassName = originalDocumentBuilderFactory.getClass().getName();
+                documentBuilderFactoryTracker.set(Boolean.TRUE);
+                System.setProperty(systemKey, DocumentBuilderFactoryImpl.class.getName());
+            }
+        } else {
+            String currentFactoryClassName = DocumentBuilderFactory.newInstance().getClass().getName();
+            if (currentFactoryClassName != null && currentFactoryClassName.equals(DocumentBuilderFactoryImpl.class.getName())) {
+                System.getProperties().remove(systemKey);
+                if (originalDocumentBuilderFactoryClassName != null) {
+                    System.setProperty(DocumentBuilderFactory.class.getName(), originalDocumentBuilderFactoryClassName);
+                }
+            }
+            documentBuilderFactoryTracker.set(null);
+            originalDocumentBuilderFactory = null;
+        }
+    }
+    
+
+    public DocumentBuilderFactoryImpl() {
+        super();
+    }
+
+    public DocumentBuilder newDocumentBuilder()
+            throws ParserConfigurationException {
+        /**
+         * Determine which DocumentBuilder implementation should be returned
+         */
+        return isDOOMRequired()
+                ? new DocumentBuilderImpl(this)
+                : originalDocumentBuilderFactory.newDocumentBuilder();
+    }
+
+    public Object getAttribute(String arg0) throws IllegalArgumentException {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public void setAttribute(String arg0, Object arg1)
+            throws IllegalArgumentException {
+        // // TODO
+        // throw new UnsupportedOperationException("TODO");
+    }
+
+    public static DocumentBuilderFactory newInstance() {
+        return new DocumentBuilderFactoryImpl();
+    }
+
+    public void setFeature(String name, boolean value)
+            throws ParserConfigurationException {
+        // TODO TODO OS
+    }
+
+    public boolean getFeature(String arg0) throws ParserConfigurationException {
+        // TODO TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    /* (non-Javadoc)
+     * @see javax.xml.parsers.DocumentBuilderFactory#setSchema(javax.xml.validation.Schema)
+     */
+    public void setSchema(Schema schema) {
+        //HACK: Overriding to get opensaml working !!
+        this.schema = schema;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.xml.parsers.DocumentBuilderFactory#getSchema()
+     */
+    public Schema getSchema() {
+        //HACK: Overriding to get opensaml working !!
+        return this.schema;
+    }
+    
+    
+    
+    
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderImpl.java
new file mode 100644
index 0000000..3ef82bf
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderImpl.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom.jaxp;
+
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.impl.dom.DOMImplementationImpl;
+import org.apache.axiom.om.impl.dom.DocumentImpl;
+import org.apache.axiom.om.impl.dom.ElementImpl;
+import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
+import org.apache.axiom.om.util.StAXUtils;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.validation.Schema;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class DocumentBuilderImpl extends DocumentBuilder {
+
+    /**
+     * The DocumentBuilderFactory used to create this document builder
+     */
+    private DocumentBuilderFactoryImpl factory;
+    
+    protected DocumentBuilderImpl(DocumentBuilderFactoryImpl fac) {
+        super();
+        this.factory = fac;
+    }
+
+    /**
+     * Returns whether the parser is configured to understand namespaces or not.
+     * The StAX parser used by this DOM impl is namespace aware therefore this
+     * will always return true.
+     * 
+     * @see javax.xml.parsers.DocumentBuilder#isNamespaceAware()
+     */
+    public boolean isNamespaceAware() {
+        return true;
+    }
+
+    /**
+     * The StAX builder used is the org.apache.axiom.om.impl.llom.StAXOMBuilder
+     * is a validating builder.
+     * 
+     * @see javax.xml.parsers.DocumentBuilder#isValidating()
+     */
+    public boolean isValidating() {
+        return true;
+    }
+
+    public DOMImplementation getDOMImplementation() {
+        return new DOMImplementationImpl();
+    }
+
+    /**
+     * Returns a new document impl.
+     * 
+     * @see javax.xml.parsers.DocumentBuilder#newDocument()
+     */
+    public Document newDocument() {
+        OMDOMFactory factory = new OMDOMFactory();
+        DocumentImpl documentImpl = new DocumentImpl(factory);
+        documentImpl.setComplete(true);
+        return documentImpl;
+    }
+
+    public void setEntityResolver(EntityResolver arg0) {
+        // TODO
+    }
+
+    public void setErrorHandler(ErrorHandler arg0) {
+        // TODO 
+    }
+
+    public Document parse(InputSource inputSource) throws SAXException,
+            IOException {
+        try {
+            OMDOMFactory factory = new OMDOMFactory();
+            // Not really sure whether this will work :-?
+            XMLStreamReader reader = StAXUtils
+                    .createXMLStreamReader(inputSource.getCharacterStream());
+            StAXOMBuilder builder = new StAXOMBuilder(factory, reader);
+            DocumentImpl doc = (DocumentImpl) builder.getDocument();
+            ((ElementImpl) doc.getDocumentElement()).build();
+            return (DocumentImpl) builder.getDocument();
+        } catch (XMLStreamException e) {
+            throw new SAXException(e);
+        }
+    }
+
+    /**
+     * @see javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream)
+     */
+    public Document parse(InputStream is) throws SAXException, IOException {
+        try {
+            OMDOMFactory factory = new OMDOMFactory();
+            XMLStreamReader reader = StAXUtils
+                    .createXMLStreamReader(is);
+            StAXOMBuilder builder = new StAXOMBuilder(factory, reader);
+            return (DocumentImpl) builder.getDocument();
+        } catch (XMLStreamException e) {
+            throw new SAXException(e);
+        }
+    }
+
+    /**
+     * @see javax.xml.parsers.DocumentBuilder#parse(java.io.File)
+     */
+    public Document parse(File file) throws SAXException, IOException {
+        try {
+            OMDOMFactory factory = new OMDOMFactory();
+            XMLStreamReader reader = StAXUtils
+                    .createXMLStreamReader(new FileInputStream(file));
+            StAXOMBuilder builder = new StAXOMBuilder(factory, reader);
+            return (DocumentImpl) builder.getDocument();
+        } catch (XMLStreamException e) {
+            throw new SAXException(e);
+        }
+    }
+
+    /**
+     * @see javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream,
+     *      java.lang.String)
+     */
+    public Document parse(InputStream is, String systemId) throws SAXException,
+            IOException {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    /**
+     * @see javax.xml.parsers.DocumentBuilder#parse(java.lang.String)
+     */
+    public Document parse(String uri) throws SAXException, IOException {
+        // TODO
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    /* (non-Javadoc)
+     * @see javax.xml.parsers.DocumentBuilder#getSchema()
+     */
+    public Schema getSchema() {
+        //HACK : To get opensaml working 
+        return this.factory.schema;
+    }
+
+    
+    
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/msg/DOMMessages.properties b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/msg/DOMMessages.properties
new file mode 100644
index 0000000..05e2529
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/msg/DOMMessages.properties
@@ -0,0 +1,66 @@
+# This file stores localized messages for the Xerces
+# DOM implementation.
+#
+# The messages are arranged in key and value tuples in a ListResourceBundle.
+#
+# @version $Id: DOMMessages.properties,v 1.10 2004/07/05 22:36:53 mrglavas Exp $
+
+        BadMessageKey = The error message corresponding to the message key can not be found.
+        FormatFailed = An internal error occurred while formatting the following message:\n  
+
+# DOM Core
+
+# exception codes
+DOMSTRING_SIZE_ERR = The specified range of text does not fit into a DOMString. 
+HIERARCHY_REQUEST_ERR  = An attempt was made to insert a node where it is not permitted. 
+INDEX_SIZE_ERR = The index or size is negative, or greater than the allowed value.
+INUSE_ATTRIBUTE_ERR = An attempt is made to add an attribute that is already in use elsewhere.
+INVALID_ACCESS_ERR  = A parameter or an operation is not supported by the underlying object. 
+INVALID_CHARACTER_ERR = An invalid or illegal XML character is specified. 
+INVALID_MODIFICATION_ERR =  An attempt is made to modify the type of the underlying object. 
+INVALID_STATE_ERR = An attempt is made to use an object that is not, or is no longer, usable. 
+NAMESPACE_ERR = An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
+NOT_FOUND_ERR = An attempt is made to reference a node in a context where it does not exist.
+NOT_SUPPORTED_ERR = The implementation does not support the requested type of object or operation. 
+NO_DATA_ALLOWED_ERR = Data is specified for a node which does not support data.
+NO_MODIFICATION_ALLOWED_ERR = An attempt is made to modify an object where modifications are not allowed.
+SYNTAX_ERR = An invalid or illegal string is specified. 
+VALIDATION_ERR = A call to a method such as insertBefore or removeChild would make the Node invalid with respect to document grammar.
+WRONG_DOCUMENT_ERR = A node is used in a different document than the one that created it.
+TYPE_MISMATCH_ERR = The value type for this parameter name is incompatible with the expected value type. 
+ 
+#error messages or exceptions
+FEATURE_NOT_SUPPORTED = The parameter {0} is recognized but the requested value cannot be set.
+FEATURE_NOT_FOUND = The parameter {0} is not recognized.
+STRING_TOO_LONG   = The resulting string is too long to fit in a DOMString: ''{0}''.
+
+#DOM Level 3 DOMError codes
+wf-invalid-character =  The text {0} of the {1} node contains invalid XML characters.
+wf-invalid-character-in-node-name = The {0} node named {1} contains invalid XML characters.
+cdata-sections-splitted =  CDATA sections containing the CDATA section termination marker '']]>''
+doctype-not-allowed = DOCTYPE declaration is not allowed.
+unsupported-encoding = The encoding {0} is not supported.
+
+#Error codes used in DOM Normalizer
+InvalidXMLCharInDOM = An invalid XML character (Unicode: 0x{0}) was found in the DOM during normalization.
+UndeclaredEntRefInAttrValue = The attribute \"{0}\" value \"{1}\" referenced an entity that was not declared.
+NullLocalElementName = A null local name was encountered during namespace normalization of element {0}.
+NullLocalAttrName = A null local name was encountered during namespace normalization of attribute {0}.
+
+#Error codes used in DOMParser
+InvalidDocumentClassName = The class name of the document factory \"{0}\" used to construct the DOM tree is not of type org.w3c.dom.Document.
+MissingDocumentClassName = The class name of the document factory \"{0}\" used to construct the DOM tree could not be found.
+CannotCreateDocumentClass = The class named \"{0}\" could not be constructed as a org.w3c.dom.Document.
+
+# Error codes used by JAXP DocumentBuilder
+jaxp-order-not-supported = Property ''{0}'' must be set before setting property ''{1}''.
+jaxp-null-input-source = The source specified cannot be null.
+
+#Ranges
+BAD_BOUNDARYPOINTS_ERR = The boundary-points of a Range do not meet specific requirements.
+INVALID_NODE_TYPE_ERR = The container of a boundary-point of a Range is being set to either a node of an invalid type or a node with an ancestor of an invalid type.
+
+
+#Events
+UNSPECIFIED_EVENT_TYPE_ERR = The Event's type was not specified by initializing the event before the method was called. 
+
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/msg/XMLMessages.properties b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/msg/XMLMessages.properties
new file mode 100644
index 0000000..b8b91d5
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/msg/XMLMessages.properties
@@ -0,0 +1,292 @@
+# This file contains error and warning messages related to XML
+# The messages are arranged in key and value tuples in a ListResourceBundle.
+#
+# @version
+
+        BadMessageKey = The error message corresponding to the message key can not be found.
+        FormatFailed = An internal error occurred while formatting the following message:\n  
+        
+# Document messages
+        PrematureEOF=Premature end of file.
+# 2.1 Well-Formed XML Documents
+        RootElementRequired = The root element is required in a well-formed document.
+# 2.2 Characters
+        InvalidCharInCDSect = An invalid XML character (Unicode: 0x{0}) was found in the CDATA section.
+        InvalidCharInContent = An invalid XML character (Unicode: 0x{0}) was found in the element content of the document.
+        TwoColonsInQName = An invalid second ':' was found in the element type or attribute name.
+        ColonNotLegalWithNS = A colon is not allowed in the name ''{0}'' when namespaces are enabled.
+        InvalidCharInMisc = An invalid XML character (Unicode: 0x{0}) was found in markup after the end of the element content.
+        InvalidCharInProlog = An invalid XML character (Unicode: 0x{0}) was found in the prolog of the document.
+        InvalidCharInXMLDecl = An invalid XML character (Unicode: 0x{0}) was found in the XML declaration.
+# 2.4 Character Data and Markup
+        CDEndInContent = The character sequence \"]]>\" must not appear in content unless used to mark the end of a CDATA section.
+# 2.7 CDATA Sections
+        CDSectUnterminated = The CDATA section must end with \"]]>\".
+# 2.8 Prolog and Document Type Declaration
+        XMLDeclMustBeFirst = The XML declaration may only appear at the very beginning of the document.
+        EqRequiredInXMLDecl = The '' = '' character must follow \"{0}\" in the XML declaration.
+        QuoteRequiredInXMLDecl = The value following \"{0}\" in the XML declaration must be a quoted string.
+        XMLDeclUnterminated = The XML declaration must end with \"?>\".
+        VersionInfoRequired = The version is required in the XML declaration.
+        SpaceRequiredBeforeVersionInXMLDecl = White space is required before the version pseudo attribute in the XML declaration.
+        SpaceRequiredBeforeEncodingInXMLDecl = White space is required before the encoding pseudo attribute in the XML declaration.
+        SpaceRequiredBeforeStandalone = White space is required before the encoding pseudo attribute in the XML declaration.
+        MarkupNotRecognizedInProlog = The markup in the document preceding the root element must be well-formed.
+        MarkupNotRecognizedInMisc = The markup in the document following the root element must be well-formed.
+        AlreadySeenDoctype = Already seen doctype.
+        DoctypeNotAllowed = DOCTYPE is disallowed when the feature "http://apache.org/xml/features/disallow-doctype-decl" set to true.
+        ContentIllegalInProlog = Content is not allowed in prolog.
+        ReferenceIllegalInProlog = Reference is not allowed in prolog.
+# Trailing Misc
+        ContentIllegalInTrailingMisc=Content is not allowed in trailing section.
+        ReferenceIllegalInTrailingMisc=Reference is not allowed in trailing section.
+        
+# 2.9 Standalone Document Declaration
+        SDDeclInvalid = The standalone document declaration value must be \"yes\" or \"no\", not \"{0}\".
+# 2.12 Language Identification
+        XMLLangInvalid = The xml:lang attribute value \"{0}\" is an invalid language identifier.
+# 3. Logical Structures
+        ETagRequired = The element type \"{0}\" must be terminated by the matching end-tag \"</{0}>\".
+# 3.1 Start-Tags, End-Tags, and Empty-Element Tags
+        ElementUnterminated = Element type \"{0}\" must be followed by either attribute specifications, \">\" or \"/>\".
+        EqRequiredInAttribute = Attribute name \"{1}\" associated with an element type \"{0}\" must be followed by the '' = '' character.
+        OpenQuoteExpected = Open quote is expected for attribute \"{1}\" associated with an  element type  \"{0}\".
+        CloseQuoteExpected = Close quote is expected for attribute \"{1}\" associated with an element type \"{0}\".
+        AttributeNotUnique = Attribute \"{1}\" was already specified for element \"{0}\".
+        AttributeNSNotUnique = Attribute \"{1}\" bound to namespace \"{2}\" was already specified for element \"{0}\".
+        ETagUnterminated = The end-tag for element type \"{0}\" must end with a ''>'' delimiter.
+        MarkupNotRecognizedInContent = The content of elements must consist of well-formed character data or markup.
+        DoctypeIllegalInContent = A DOCTYPE is not allowed in content.
+# 4.1 Character and Entity References
+        ReferenceUnterminated = The reference must be terminated by a ';' delimiter.
+# 4.3.2 Well-Formed Parsed Entities
+        ReferenceNotInOneEntity = The reference must be entirely contained within the same parsed entity.
+        ElementEntityMismatch = The element \"{0}\" must start and end within the same entity.
+        MarkupEntityMismatch=XML document structures must start and end within the same entity.
+        
+# Messages common to Document and DTD
+# 2.2 Characters
+        InvalidCharInAttValue = An invalid XML character (Unicode: 0x{2}) was found in the value of attribute \"{1}\" and element is \"{0}\".
+        InvalidCharInComment = An invalid XML character (Unicode: 0x{0}) was found in the comment.
+        InvalidCharInPI = An invalid XML character (Unicode: 0x{0}) was found in the processing instruction.
+        InvalidCharInInternalSubset = An invalid XML character (Unicode: 0x{0}) was found in the internal subset of the DTD.
+        InvalidCharInTextDecl = An invalid XML character (Unicode: 0x{0}) was found in the text declaration.
+# 2.3 Common Syntactic Constructs
+        QuoteRequiredInAttValue = The value of attribute \"{1}\" must begin with either a single or double quote character.
+        LessthanInAttValue = The value of attribute \"{1}\" associated with an element type \"{0}\" must not contain the ''<'' character.
+        AttributeValueUnterminated = The value for attribute \"{1}\" must end with the matching quote character.
+# 2.5 Comments
+        InvalidCommentStart = Comment must start with \"<!--\".
+        DashDashInComment = The string \"--\" is not permitted within comments.
+        CommentUnterminated = The comment must end with \"-->\".
+        COMMENT_NOT_IN_ONE_ENTITY = The comment is not enclosed xin the same entity.
+# 2.6 Processing Instructions
+        PITargetRequired = The processing instruction must begin with the name of the target.
+        SpaceRequiredInPI = White space is required between the processing instruction target and data.
+        PIUnterminated = The processing instruction must end with \"?>\".
+        ReservedPITarget = The processing instruction target matching \"[xX][mM][lL]\" is not allowed.
+        PI_NOT_IN_ONE_ENTITY = The processing instruction is not enclosed in the same entity.
+# 2.8 Prolog and Document Type Declaration
+        VersionInfoInvalid = Invalid version \"{0}\".
+        VersionNotSupported = XML version \"{0}\" is not supported, only XML 1.0 is supported.
+        VersionNotSupported11 = XML version \"{0}\" is not supported, only XML 1.0 and XML 1.1 are supported.
+# 4.1 Character and Entity References
+        DigitRequiredInCharRef = A decimal representation must immediately follow the \"&#\" in a character reference.
+        HexdigitRequiredInCharRef = A hexadecimal representation must immediately follow the \"&#x\" in a character reference.
+        SemicolonRequiredInCharRef = The character reference must end with the ';' delimiter.
+        InvalidCharRef = Character reference \"&#{0}\" is an invalid XML character.
+        NameRequiredInReference = The entity name must immediately follow the '&' in the entity reference.
+        SemicolonRequiredInReference = The reference to entity \"{0}\" must end with the '';'' delimiter.
+# 4.3.1 The Text Declaration
+        TextDeclMustBeFirst = The text declaration may only appear at the very beginning of the external parsed entity.
+        EqRequiredInTextDecl = The '' = '' character must follow \"{0}\" in the text declaration.
+        QuoteRequiredInTextDecl = The value following \"{0}\" in the text declaration must be a quoted string.
+        CloseQuoteMissingInTextDecl = closing quote in the value following \"{0}\" in the text declaration is missing.
+        SpaceRequiredBeforeVersionInTextDecl = White space is required before the version pseudo attribute in the text declaration.
+        SpaceRequiredBeforeEncodingInTextDecl = White space is required before the encoding pseudo attribute in the text declaration.
+        TextDeclUnterminated = The text declaration must end with \"?>\".
+        EncodingDeclRequired = The encoding declaration is required in the text declaration.
+        NoMorePseudoAttributes = No more pseudo attributes are allowed.
+        MorePseudoAttributes = More pseudo attributes are expected.
+        PseudoAttrNameExpected = A pseudo attribute name is expected. 
+# 4.3.2 Well-Formed Parsed Entities
+        CommentNotInOneEntity = The comment must be entirely contained within the same parsed entity.
+        PINotInOneEntity = The processing instruction must be entirely contained within the same parsed entity.
+# 4.3.3 Character Encoding in Entities
+        EncodingDeclInvalid = Invalid encoding name \"{0}\".
+        EncodingByteOrderUnsupported = Given byte order for encoding \"{0}\" is not supported.
+        InvalidByte = Invalid byte {0} of {1}-byte UTF-8 sequence.
+        ExpectedByte = Expected byte {0} of {1}-byte UTF-8 sequence.  
+        InvalidHighSurrogate = High surrogate bits in UTF-8 sequence must not exceed 0x10 but found 0x{0}.
+        OperationNotSupported = Operation \"{0}\" not supported by {1} reader.
+        InvalidASCII = Byte \"{0}\" is not a member of the (7-bit) ASCII character set.
+        CharConversionFailure = An entity determined to be in a certain encoding must not contain sequences illegal in that encoding.
+        
+# DTD Messages
+# 2.2 Characters
+        InvalidCharInEntityValue = An invalid XML character (Unicode: 0x{0}) was found in the literal entity value.
+        InvalidCharInExternalSubset = An invalid XML character (Unicode: 0x{0}) was found in the external subset of the DTD.
+        InvalidCharInIgnoreSect = An invalid XML character (Unicode: 0x{0}) was found in the excluded conditional section.
+        InvalidCharInPublicID = An invalid XML character (Unicode: 0x{0}) was found in the public identifier.
+        InvalidCharInSystemID = An invalid XML character (Unicode: 0x{0}) was found in the system identifier.
+# 2.3 Common Syntactic Constructs
+        SpaceRequiredAfterSYSTEM = White space is required after keyword SYSTEM in DOCTYPE decl.
+        QuoteRequiredInSystemID = The system identifier must begin with either a single or double quote character.
+        SystemIDUnterminated = The system identifier must end with the matching quote character.
+        SpaceRequiredAfterPUBLIC = White spaces are required after keyword PUBLIC in DOCTYPE decl.
+        QuoteRequiredInPublicID = The public identifier must begin with either a single or double quote character.
+        PublicIDUnterminated = The public identifier must end with the matching quote character.
+        PubidCharIllegal = The character (Unicode: 0x{0}) is not permitted in the public identifier.
+        SpaceRequiredBetweenPublicAndSystem = White spaces are required between publicId and systemId.
+# 2.8 Prolog and Document Type Declaration
+        MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = White space is required after \"<!DOCTYPE\" in the document type declaration.
+        MSG_ROOT_ELEMENT_TYPE_REQUIRED = The root element type must appear after \"<!DOCTYPE\" in the document type declaration.
+        DoctypedeclUnterminated = The document type declaration for root element type \"{0}\" must end with ''>''.
+        PEReferenceWithinMarkup = The parameter entity reference \"%{0};\" cannot occur within markup in the internal subset of the DTD.
+        MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = The markup declarations contained or pointed to by the document type declaration must be well-formed.
+# 2.10 White Space Handling
+        MSG_XML_SPACE_DECLARATION_ILLEGAL = The attribute declaration for \"xml:space\" must be given as an enumerated type whose only possible values are \"default\" and \"preserve\".
+# 3.2 Element Type Declarations
+        MSG_SPACE_REQUIRED_BEFORE_ELEMENT_TYPE_IN_ELEMENTDECL = White space is required after \"<!ELEMENT\" in the element type declaration.
+        MSG_ELEMENT_TYPE_REQUIRED_IN_ELEMENTDECL = The element type is required in the element type declaration.
+        MSG_SPACE_REQUIRED_BEFORE_CONTENTSPEC_IN_ELEMENTDECL = White space is required after the element type \"{0}\" in the element type declaration.
+        MSG_CONTENTSPEC_REQUIRED_IN_ELEMENTDECL = The constraint is required after the element type \"{0}\" in the element type declaration.
+        ElementDeclUnterminated = The declaration for element type \"{0}\" must end with ''>''.
+# 3.2.1 Element Content
+        MSG_OPEN_PAREN_OR_ELEMENT_TYPE_REQUIRED_IN_CHILDREN = A ''('' character or an element type is required in the declaration of element type \"{0}\".
+        MSG_CLOSE_PAREN_REQUIRED_IN_CHILDREN = A '')'' is required in the declaration of element type \"{0}\".
+# 3.2.2 Mixed Content
+        MSG_ELEMENT_TYPE_REQUIRED_IN_MIXED_CONTENT = An element type is required in the declaration of element type \"{0}\".
+        MSG_CLOSE_PAREN_REQUIRED_IN_MIXED = A '')'' is required in the declaration of element type \"{0}\".
+        MixedContentUnterminated = The mixed content model \"{0}\" must end with \")*\" when the types of child elements are constrained.
+# 3.3 Attribute-List Declarations
+        MSG_SPACE_REQUIRED_BEFORE_ELEMENT_TYPE_IN_ATTLISTDECL = White space is required after \"<!ATTLIST\" in the attribute-list declaration.
+        MSG_ELEMENT_TYPE_REQUIRED_IN_ATTLISTDECL = The element type is required in the attribute-list declaration.
+        MSG_SPACE_REQUIRED_BEFORE_ATTRIBUTE_NAME_IN_ATTDEF = White space is required before the attribute name in the attribute-list declaration for element \"{0}\".
+        AttNameRequiredInAttDef = The attribute name must be specified in the attribute-list declaration for element \"{0}\".
+        MSG_SPACE_REQUIRED_BEFORE_ATTTYPE_IN_ATTDEF = White space is required before the attribute type in the declaration of attribute \"{1}\" for element \"{0}\".
+        AttTypeRequiredInAttDef = The attribute type is required in the declaration of attribute \"{1}\" for element \"{0}\".
+        MSG_SPACE_REQUIRED_BEFORE_DEFAULTDECL_IN_ATTDEF = White space is required before the attribute default in the declaration of attribute \"{1}\" for element \"{0}\".
+        MSG_DUPLICATE_ATTRIBUTE_DEFINITION = More than one attribute definition is provided for the same attribute \"{1}\" of a given element \"{0}\".
+# 3.3.1 Attribute Types
+        MSG_SPACE_REQUIRED_AFTER_NOTATION_IN_NOTATIONTYPE = White space must appear after \"NOTATION\" in the \"{1}\" attribute declaration.
+        MSG_OPEN_PAREN_REQUIRED_IN_NOTATIONTYPE = The ''('' character must follow \"NOTATION\" in the \"{1}\" attribute declaration.
+        MSG_NAME_REQUIRED_IN_NOTATIONTYPE = The notation name is required in the notation type list for the \"{1}\" attribute declaration.
+        NotationTypeUnterminated = The notation type list must end with '')'' in the \"{1}\" attribute declaration.
+        MSG_NMTOKEN_REQUIRED_IN_ENUMERATION = The name token is required in the enumerated type list for the \"{1}\" attribute declaration.
+        EnumerationUnterminated = The enumerated type list must end with '')'' in the \"{1}\" attribute declaration.
+        MSG_DISTINCT_TOKENS_IN_ENUMERATION = The enumeration value \"{1}\" was specified more than once in the declaration of attribute \"{2}\" for element \"{0}\". The NMTOKENS in a single Enumeration attribute declaration must all be distinct.
+        MSG_DISTINCT_NOTATION_IN_ENUMERATION = The enumeration value \"{1}\" was specified more than once in the declaration of attribute \"{2}\" for element \"{0}\". The NOTATION names in a single NotationType attribute declaration must all be distinct.
+# 3.3.2 Attribute Defaults
+        MSG_SPACE_REQUIRED_AFTER_FIXED_IN_DEFAULTDECL = White space must appear after \"FIXED\" in the \"{1}\" attribute declaration.
+# 3.4 Conditional Sections
+        IncludeSectUnterminated = The included conditional section must end with \"]]>\".
+        IgnoreSectUnterminated = The excluded conditional section must end with \"]]>\".
+# 4.1 Character and Entity References
+        NameRequiredInPEReference = The entity name must immediately follow the '%' in the parameter entity reference.
+        SemicolonRequiredInPEReference = The parameter entity reference \"%{0};\" must end with the '';'' delimiter.
+# 4.2 Entity Declarations
+        MSG_SPACE_REQUIRED_BEFORE_ENTITY_NAME_IN_ENTITYDECL = White space is required after \"<!ENTITY\" in the entity declaration.
+        MSG_SPACE_REQUIRED_BEFORE_PERCENT_IN_PEDECL = White space is required between \"<!ENTITY\" and the '%' character in the parameter entity declaration.
+        MSG_SPACE_REQUIRED_BEFORE_ENTITY_NAME_IN_PEDECL = White space is required between the '%' and the entity name in the parameter entity declaration.
+        MSG_ENTITY_NAME_REQUIRED_IN_ENTITYDECL = The name of the entity is required in the entity declaration.
+        MSG_SPACE_REQUIRED_AFTER_ENTITY_NAME_IN_ENTITYDECL = White space is required between the entity name \"{0}\" and the definition in the entity declaration.
+        MSG_SPACE_REQUIRED_BEFORE_NOTATION_NAME_IN_UNPARSED_ENTITYDECL = White space is required between \"NDATA\" and the notation name in the declaration for the entity \"{0}\".
+        MSG_SPACE_REQUIRED_BEFORE_NDATA_IN_UNPARSED_ENTITYDECL = White space is required before \"NDATA\" in the declaration for the entity \"{0}\".
+        MSG_NOTATION_NAME_REQUIRED_FOR_UNPARSED_ENTITYDECL = The notation name is required after \"NDATA\" in the declaration for the entity \"{0}\".
+        EntityDeclUnterminated = The declaration for the entity \"{0}\" must end with ''>''.
+	MSG_DUPLICATE_ENTITY_DEFINITION = Entity \"{0}\" is declared more than once.        
+# 4.2.2 External Entities
+        ExternalIDRequired = The external entity declaration must begin with either \"SYSTEM\" or \"PUBLIC\".
+        MSG_SPACE_REQUIRED_BEFORE_PUBIDLITERAL_IN_EXTERNALID = White space is required between \"PUBLIC\" and the public identifier.
+        MSG_SPACE_REQUIRED_AFTER_PUBIDLITERAL_IN_EXTERNALID = White space is required between the public identifier and the system identifier.
+        MSG_SPACE_REQUIRED_BEFORE_SYSTEMLITERAL_IN_EXTERNALID = White space is required between \"SYSTEM\" and the system identifier.
+        MSG_URI_FRAGMENT_IN_SYSTEMID = The fragment identifier should not be specified as part of the system identifier \"{0}\".
+# 4.7 Notation Declarations
+        MSG_SPACE_REQUIRED_BEFORE_NOTATION_NAME_IN_NOTATIONDECL = White space is required after \"<!NOTATION\" in the notation declaration.
+        MSG_NOTATION_NAME_REQUIRED_IN_NOTATIONDECL = The name of the notation is required in the notation declaration.
+        MSG_SPACE_REQUIRED_AFTER_NOTATION_NAME_IN_NOTATIONDECL = White space is required after the notation name \"{0}\" in the notation declaration.
+        ExternalIDorPublicIDRequired = The declaration for the notation \"{0}\" must include a system or public identifier.
+        NotationDeclUnterminated = The declaration for the notation \"{0}\" must end with ''>''.
+        
+# Validation messages
+        DuplicateTypeInMixedContent = The element type \"{1}\" was already specified in the content model of the element decl \"{0}\".
+        ENTITIESInvalid = Attribute value \"{1}\" of type ENTITIES must be the names of one or more unparsed entities.
+        ENTITYInvalid = Attribute value \"{1}\" of type ENTITY must be the name of an unparsed entity.
+        IDDefaultTypeInvalid = The ID attribute \"{0}\" must have a declared default of \"#IMPLIED\" or \"#REQUIRED\".
+        IDInvalid = Attribute value \"{0}\" of type ID must be a name.
+        IDInvalidWithNamespaces = Attribute value \"{0}\" of type ID must be an NCName when namespaces are enabled.
+        IDNotUnique = Attribute value \"{0}\" of type ID must be unique within the document.
+        IDREFInvalid = Attribute value \"{0}\" of type IDREF must be a name.
+        IDREFInvalidWithNamespaces = Attribute value \"{0}\" of type IDREF must be an NCName when namespaces are enabled.
+        IDREFSInvalid = Attribute value \"{0}\" of type IDREFS must be one or more names.
+        ILL_FORMED_PARAMETER_ENTITY_WHEN_USED_IN_DECL = The replacement text of parameter entity \"{0}\" must include properly nested declarations when the entity reference is used as a complete declaration.
+        ImproperDeclarationNesting = The replacement text of parameter entity \"{0}\" must include properly nested declarations.
+        ImproperGroupNesting = The replacement text of parameter entity \"{0}\" must include properly nested pairs of parentheses.
+        INVALID_PE_IN_CONDITIONAL = The replacement text of parameter entity \"{0}\" must include the entire conditional section or just INCLUDE or IGNORE.
+        MSG_ATTRIBUTE_NOT_DECLARED = Attribute \"{1}\" must be declared for element type \"{0}\".
+        MSG_ATTRIBUTE_VALUE_NOT_IN_LIST = Attribute \"{0}\" with value \"{1}\" must have a value from the list \"{2}\".
+        MSG_ATTVALUE_CHANGED_DURING_NORMALIZATION_WHEN_STANDALONE = The value \"{1}\" of attribute \"{0}\" must not be changed by normalization (to \"{2}\") in a standalone document.
+        MSG_CONTENT_INCOMPLETE = The content of element type \"{0}\" is incomplete, it must match \"{1}\".
+        MSG_CONTENT_INVALID = The content of element type \"{0}\" must match \"{1}\".
+        MSG_CONTENT_INVALID_SPECIFIED = The content of element type \"{0}\" must match \"{1}\".  Children of type \"{2}\" are not allowed.
+        MSG_DEFAULTED_ATTRIBUTE_NOT_SPECIFIED = Attribute \"{1}\" for element type \"{0}\" has a default value and must be specified in a standalone document.
+        MSG_DUPLICATE_ATTDEF = Attribute \"{1}\" is already declared for element type \"{0}\".
+        MSG_ELEMENT_ALREADY_DECLARED = Element type \"{0}\" must not be declared more than once.
+        MSG_ELEMENT_NOT_DECLARED = Element type \"{0}\" must be declared.
+        MSG_GRAMMAR_NOT_FOUND = Document is invalid: no grammar found.
+        MSG_ELEMENT_WITH_ID_REQUIRED = An element with the identifier \"{0}\" must appear in the document.
+        MSG_EXTERNAL_ENTITY_NOT_PERMITTED = The reference to external entity \"{0}\" is not permitted in a standalone document.
+        MSG_FIXED_ATTVALUE_INVALID = Attribute \"{1}\" with value \"{2}\" must have a value of \"{3}\".
+        MSG_MORE_THAN_ONE_ID_ATTRIBUTE = Element type \"{0}\" already has attribute \"{1}\" of type ID, a second attribute \"{2}\" of type ID is not permitted.
+        MSG_MORE_THAN_ONE_NOTATION_ATTRIBUTE = Element type \"{0}\" already has attribute \"{1}\" of type NOTATION, a second attribute \"{2}\" of type NOTATION is not permitted.
+        MSG_NOTATION_NOT_DECLARED_FOR_NOTATIONTYPE_ATTRIBUTE = The notation \"{1}\" must be declared when referenced in the notation type list for attribute \"{0}\".
+        MSG_NOTATION_NOT_DECLARED_FOR_UNPARSED_ENTITYDECL = The notation \"{1}\" must be declared when referenced in the unparsed entity declaration for \"{0}\".
+        MSG_REFERENCE_TO_EXTERNALLY_DECLARED_ENTITY_WHEN_STANDALONE = The reference to entity \"{0}\" declared in an external parsed entity is not permitted in a standalone document.
+        MSG_REQUIRED_ATTRIBUTE_NOT_SPECIFIED = Attribute \"{1}\" is required and must be specified for element type \"{0}\".
+        MSG_WHITE_SPACE_IN_ELEMENT_CONTENT_WHEN_STANDALONE = White space must not occur between elements declared in an external parsed entity with element content in a standalone document.
+        NMTOKENInvalid = Attribute value \"{0}\" of type NMTOKEN must be a name token.
+        NMTOKENSInvalid = Attribute value \"{0}\" of type NMTOKENS must be one or more name tokens.
+        NoNotationOnEmptyElement = Element type \"{0}\" which was declared EMPTY cannot declare attribute \"{1}\" of type NOTATION.
+        RootElementTypeMustMatchDoctypedecl = Document root element \"{1}\", must match DOCTYPE root \"{0}\".
+        UndeclaredElementInContentSpec = The content model of element \"{0}\" refers to the undeclared element \"{1}\".
+        UniqueNotationName = The declaration for the notation \"{0}\" is not unique. A given Name must not be declared in more than one notation declaration.
+        ENTITYFailedInitializeGrammar =  ENTITYDatatype Validator: Failed Need to call initialize method with a valid Grammar reference. 	
+        ENTITYNotUnparsed = ENTITY \"{0}\" is not unparsed.
+        ENTITYNotValid = ENTITY \"{0}\" is not valid.
+        EmptyList = Value of type ENTITIES, IDREFS, and NMTOKENS cannot be empty list.
+
+# Entity related messages
+# 3.1 Start-Tags, End-Tags, and Empty-Element Tags
+        ReferenceToExternalEntity = The external entity reference \"&{0};\" is not permitted in an attribute value.
+# 4.1 Character and Entity References
+        EntityNotDeclared = The entity \"{0}\" was referenced, but not declared.
+        ReferenceToUnparsedEntity = The unparsed entity reference \"&{0};\" is not permitted.
+        RecursiveReference = Recursive entity reference \"{0}\". (Reference path: {1}),
+        RecursiveGeneralReference = Recursive general entity reference \"&{0};\". (Reference path: {1}),
+        RecursivePEReference = Recursive parameter entity reference \"%{0};\". (Reference path: {1}),
+# 4.3.3 Character Encoding in Entities
+        EncodingNotSupported = The encoding \"{0}\" is not supported.
+        EncodingRequired = A parsed entity not encoded in either UTF-8 or UTF-16 must contain an encoding declaration.
+        
+# Namespaces support
+# 4. Using Qualified Names
+        IllegalQName = Element or attribute do not match QName production: QName::=(NCName':')?NCName. 
+        ElementXMLNSPrefix = Element \"{0}\" cannot have \"xmlns\" as its prefix.
+        ElementPrefixUnbound = The prefix \"{0}\" for element \"{1}\" is not bound.
+        AttributePrefixUnbound = The prefix \"{2}\" for attribute \"{1}\" associated with an element type \"{0}\" is not bound.
+        EmptyPrefixedAttName = The value of the attribute \"{0}\" is invalid. Prefixed namespace bindings may not be empty.
+        PrefixDeclared = The namespace prefix \"{0}\" was not declared.
+        CantBindXMLNS = The prefix "xmlns" cannot be bound to any namespace explicitly; neither can the namespace for "xmlns" be bound to any prefix explicitly.
+        CantBindXML = The prefix "xml" cannot be bound to any namespace other than its usual namespace; neither can the namespace for "xml" be bound to any prefix other than "xml".
+        MSG_ATT_DEFAULT_INVALID = The defaultValue \"{1}\" of attribute \"{0}\" is not legal as for the lexical constraints of this attribute type.
+
+# REVISIT: These need messages
+        MSG_SPACE_REQUIRED_AFTER_SYSTEMLITERAL_IN_EXTERNALID=MSG_SPACE_REQUIRED_AFTER_SYSTEMLITERAL_IN_EXTERNALID
+        OpenQuoteMissingInDecl=OpenQuoteMissingInDecl
+        InvalidCharInLiteral=InvalidCharInLiteral
+
+
+#Application can set the limit of number of entities that should be expanded by the parser.
+EntityExpansionLimitExceeded=The parser has encountered more than \"{0}\" entity expansions in this document; this is the limit imposed by the application.
+
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/msg/XMLSerializerMessages.properties b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/msg/XMLSerializerMessages.properties
new file mode 100644
index 0000000..369a7e3
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/msg/XMLSerializerMessages.properties
@@ -0,0 +1,33 @@
+# This file stores error messages for the Xerces XML
+# serializer.  Many DOM Load/Save error messages also 
+# live here, since the serializer largely implements that package.
+#
+# As usual with properties files, the messages are arranged in
+# key/value tuples.
+# 
+# @version $Id: XMLSerializerMessages.properties,v 1.4 2005/06/18 03:36:55 mrglavas Exp $
+
+    BadMessageKey = The error message corresponding to the message key can not be found.
+    FormatFailed = An internal error occurred while formatting the following message:\n
+
+    ArgumentIsNull = Argument ''{0}'' is null.
+    NoWriterSupplied = No writer supplied for serializer.
+    MethodNotSupported = The method ''{0}'' is not supported by this factory.
+    ResetInMiddle = The serializer may not be reset in the middle of serialization.
+    Internal = Internal error: element state is zero.
+    NoName = There is no rawName and localName is null.
+    ElementQName = The element name ''{0}'' is not a QName.
+    ElementPrefix = Element ''{0}'' does not belong to any namespace: prefix could be undeclared or bound to some namespace.
+    AttributeQName = The attribute name ''{0}'' is not a QName.
+    AttributePrefix = Attribute ''{0}'' does not belong to any namespace: prefix could be undeclared or bound to some namespace.
+    InvalidNSDecl = Namespace declaration syntax is incorrect: {0}.
+    EndingCDATA = The character sequence \"]]>\" must not appear in content unless used to mark the end of a CDATA section.
+    SplittingCDATA = Splitting a CDATA section containing the CDATA section termination marker \"]]>\".
+    ResourceNotFound = The resource ''{0}'' could not be found.
+    ResourceNotLoaded = The resource ''{0}'' could not be loaded. {1}
+    SerializationStopped =  Serialization stopped at user request.
+
+    # DOM Level 3 load and save messages
+    no-output-specified = no-output-specified: The output destination for data to be written to was null.
+    unsupported-encoding = unsupported-encoding: An unsupported encoding is encountered.
+    unable-to-serialize-node = unable-to-serialize-node: The node could not be serialized.
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPBodyImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPBodyImpl.java
new file mode 100644
index 0000000..4e47c5b
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPBodyImpl.java
@@ -0,0 +1,152 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom;
+
+import org.apache.axiom.om.OMConstants;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPConstants;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+public abstract class SOAPBodyImpl extends SOAPElement implements SOAPBody,
+		OMConstants {
+
+	/**
+	 * Field hasSOAPFault
+	 */
+	protected boolean hasSOAPFault = false;
+
+	/**
+	 * @param envelope
+	 */
+	public SOAPBodyImpl(SOAPEnvelope envelope, SOAPFactory factory)
+            throws SOAPProcessingException {
+		super(envelope, SOAPConstants.BODY_LOCAL_NAME, true, factory);
+
+	}
+
+	/**
+	 * Constructor SOAPBodyImpl
+	 *
+	 * @param envelope
+	 * @param builder
+	 */
+	public SOAPBodyImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+		super(envelope, SOAPConstants.BODY_LOCAL_NAME, builder, factory);
+	}
+
+	/**
+	 * Creates a new <code>SOAPFault</code> object and adds it to
+	 * this <code>SOAPBody</code> object.
+	 *
+	 * @param e
+	 * @return the new <code>SOAPFault</code> object
+	 * @throws org.apache.axiom.om.OMException
+	 *                     if there is a SOAP error
+	 * @throws OMException
+	 */
+	public abstract SOAPFault addFault(Exception e) throws OMException;
+
+	/**
+	 * Indicates whether a <code>SOAPFault</code> object exists in
+	 * this <code>SOAPBody</code> object.
+	 *
+	 * @return <code>true</code> if a <code>SOAPFault</code> object exists in
+	 *         this <code>SOAPBody</code> object; <code>false</code>
+	 *         otherwise
+	 */
+	public boolean hasFault() {
+		if (hasSOAPFault) {
+			return true;
+		} else {
+			OMElement element = getFirstElement();
+			if (element != null
+					&& SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(element
+							.getLocalName())
+					&& (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI
+							.equals(element.getNamespace().getNamespaceURI()) || SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI
+							.equals(element.getNamespace().getNamespaceURI()))) { //added this line
+				hasSOAPFault = true;
+				return true;
+			} else {
+				return false;
+			}
+		}
+	}
+
+	/**
+	 * Returns the <code>SOAPFault</code> object in this <code>SOAPBody</code>
+	 * object.
+	 *
+	 * @return the <code>SOAPFault</code> object in this <code>SOAPBody</code>
+	 *         object
+	 */
+	public SOAPFault getFault() {
+		OMElement element = getFirstElement();
+		if (hasSOAPFault) {
+			return (SOAPFault) element;
+		} else if (element != null
+				&& SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(element
+						.getLocalName())
+				&& (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(element
+						.getNamespace().getNamespaceURI()) || SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI
+						.equals(element.getNamespace().getNamespaceURI()))) { //added this line
+			hasSOAPFault = true;
+			return (SOAPFault) element;
+		} else {
+			return null;
+		}
+
+	}
+
+	/**
+	 * @param soapFault
+	 * @throws org.apache.axiom.om.OMException
+	 *
+	 * @throws OMException
+	 */
+	public void addFault(SOAPFault soapFault) throws OMException {
+		if (hasSOAPFault) {
+			throw new OMException(
+					"SOAP Body already has a SOAP Fault and there can not be " +
+                    "more than one SOAP fault");
+		}
+		addChild(soapFault);
+		hasSOAPFault = true;
+	}
+
+	protected void checkParent(OMElement parent) throws SOAPProcessingException {
+		if (!(parent instanceof SOAPEnvelopeImpl)) {
+			throw new SOAPProcessingException(
+					"Expecting an implementation of SOAP Envelope as the " +
+                    "parent. But received some other implementation");
+		}
+	}
+
+	/*public OMNode detach() throws OMException {
+		throw new SOAPProcessingException(
+				"Can not detach SOAP Body, SOAP Envelope must have a Body !!");
+	}*/
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPElement.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPElement.java
new file mode 100644
index 0000000..8ec61b2
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPElement.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.dom.DocumentImpl;
+import org.apache.axiom.om.impl.dom.ElementImpl;
+import org.apache.axiom.om.impl.dom.NamespaceImpl;
+import org.apache.axiom.om.impl.dom.ParentNode;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+public abstract class SOAPElement extends ElementImpl {
+
+    public SOAPElement(SOAPFactory factory) {
+        super(factory);
+    }
+
+    /**
+     * @param parent
+     */
+    protected SOAPElement(OMElement parent,
+                          String localName,
+                          boolean extractNamespaceFromParent,
+                          SOAPFactory factory) throws SOAPProcessingException {
+        super((ParentNode)parent, localName, null, factory);
+        if (parent == null) {
+            throw new SOAPProcessingException(
+                    " Can not create " + localName +
+                    " element without a parent !!");
+        }
+        checkParent(parent);
+
+        if (extractNamespaceFromParent) {
+            this.namespace = parent.getNamespace();
+        }
+        this.localName = localName;
+    }
+
+
+    protected SOAPElement(OMElement parent,
+                          String localName,
+                          OMXMLParserWrapper builder,
+                          SOAPFactory factory) {
+        super((ParentNode)parent, localName, null, builder, factory);
+    }
+
+    protected SOAPElement(DocumentImpl doc, String localName, OMNamespace ns,
+            SOAPFactory factory) {
+		super(doc, localName, (NamespaceImpl)ns, factory);
+	}
+    
+    protected SOAPElement(DocumentImpl ownerDocument, String tagName,
+            NamespaceImpl ns, OMXMLParserWrapper builder, SOAPFactory factory) {
+    	super(ownerDocument, tagName, ns, builder, factory);
+    }
+    
+    /**
+     * This has to be implemented by all the derived classes to check 
+     * for the correct parent.
+     */
+    protected abstract void checkParent(OMElement parent)
+            throws SOAPProcessingException;
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
new file mode 100644
index 0000000..dcb3eef
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom;
+
+import org.apache.axiom.om.*;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
+import org.apache.axiom.om.impl.dom.DocumentImpl;
+import org.apache.axiom.soap.*;
+import org.apache.axiom.soap.impl.dom.factory.DOMSOAPFactory;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class SOAPEnvelopeImpl extends SOAPElement implements SOAPEnvelope,
+        OMConstants {
+
+
+    /**
+     * @param builder
+     */
+    public SOAPEnvelopeImpl(OMXMLParserWrapper builder, SOAPFactory factory) {
+        super(null, SOAPConstants.SOAPENVELOPE_LOCAL_NAME, builder, factory);
+    }
+
+    public SOAPEnvelopeImpl(DocumentImpl doc, OMXMLParserWrapper builder, SOAPFactory factory) {
+        super(
+                doc,
+                SOAPConstants.SOAPENVELOPE_LOCAL_NAME,
+                null,
+                builder, factory);
+    }
+    /**
+     * @param ns
+     */
+    public SOAPEnvelopeImpl(OMNamespace ns, SOAPFactory factory) {
+        super(((DOMSOAPFactory) factory).getDocument(),
+                SOAPConstants.SOAPENVELOPE_LOCAL_NAME, ns, factory);
+        this.getOwnerDocument().appendChild(this);
+    }
+
+    /**
+     * Returns the <CODE>SOAPHeader</CODE> object for this <CODE> SOAPEnvelope</CODE>
+     * object.
+     * <P>
+     * This SOAPHeader will just be a container for all the headers in the
+     * <CODE>OMMessage</CODE>
+     * </P>
+     *
+     * @return the <CODE>SOAPHeader</CODE> object or <CODE> null</CODE> if
+     *         there is none
+     * @throws org.apache.axiom.om.OMException
+     *             if there is a problem obtaining the <CODE>SOAPHeader</CODE>
+     *             object
+     * @throws OMException
+     */
+    public SOAPHeader getHeader() throws OMException {
+        return (SOAPHeader) getFirstChildWithName(new QName(SOAPConstants.HEADER_LOCAL_NAME));
+    }
+
+    public void addChild(OMNode child) {
+        if ((child instanceof OMElement)
+                && !(child instanceof SOAPHeader || child instanceof SOAPBody)) {
+            throw new SOAPProcessingException(
+                    "SOAP Envelope can not have children other than SOAP Header and Body",
+                    SOAP12Constants.FAULT_CODE_SENDER);
+        } else {
+            super.addChild(child);
+        }
+    }
+
+    /**
+     * Returns the <CODE>SOAPBody</CODE> object associated with this <CODE>SOAPEnvelope</CODE>
+     * object.
+     * <P>
+     * This SOAPBody will just be a container for all the BodyElements in the
+     * <CODE>OMMessage</CODE>
+     * </P>
+     *
+     * @return the <CODE>SOAPBody</CODE> object for this <CODE> SOAPEnvelope</CODE>
+     *         object or <CODE>null</CODE> if there is none
+     * @throws org.apache.axiom.om.OMException
+     *             if there is a problem obtaining the <CODE>SOAPBody</CODE>
+     *             object
+     * @throws OMException
+     */
+    public SOAPBody getBody() throws OMException {
+        // check for the first element
+        OMElement element = getFirstElement();
+        if (element != null) {
+            if (SOAPConstants.BODY_LOCAL_NAME.equals(element.getLocalName())) {
+                return (SOAPBody) element;
+            } else { // if not second element SHOULD be the body
+                OMNode node = element.getNextOMSibling();
+                while (node != null && node.getType() != OMNode.ELEMENT_NODE) {
+                    node = node.getNextOMSibling();
+                }
+                element = (OMElement) node;
+
+                if (node != null
+                        && SOAPConstants.BODY_LOCAL_NAME.equals(element
+                                .getLocalName())) {
+                    return (SOAPBody) element;
+                }
+              /*  else {
+					throw new OMException(
+							"SOAPEnvelope must contain a body element which is either first or second child element of the SOAPEnvelope.");
+				}*/
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Method detach
+     *
+     * @throws OMException
+     */
+    public OMNode detach() throws OMException {
+        throw new OMException("Root Element can not be detached");
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        // here do nothing as SOAPEnvelope doesn't have a parent !!!
+    }
+
+    protected void internalSerialize(XMLStreamWriter writer2, boolean cache)
+            throws XMLStreamException {
+
+        MTOMXMLStreamWriter writer = (MTOMXMLStreamWriter) writer2;
+        if (!writer.isIgnoreXMLDeclaration()) {
+            String charSetEncoding = writer.getCharSetEncoding();
+            String xmlVersion = writer.getXmlVersion();
+            writer
+                    .getXmlStreamWriter()
+                    .writeStartDocument(
+                            charSetEncoding == null ? OMConstants.DEFAULT_CHAR_SET_ENCODING
+                                    : charSetEncoding,
+                            xmlVersion == null ? OMConstants.DEFAULT_XML_VERSION
+                                    : xmlVersion);
+        }
+        super.internalSerialize(writer, cache);
+    }
+
+    public OMNode getNextOMSibling() throws OMException {
+        if(this.ownerNode != null && !this.ownerNode.isComplete()) {
+            this.ownerNode.setComplete(true);
+        }
+        return null;
+    }
+    
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java
new file mode 100644
index 0000000..9bfd4c0
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom;
+
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axiom.om.util.ElementHelper;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAPFaultSubCode;
+import org.apache.axiom.soap.SOAPFaultValue;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public abstract class SOAPFaultCodeImpl  extends SOAPElement implements SOAPFaultCode{
+
+    /**
+     * Constructor OMElementImpl
+     *
+     * @param parent
+     * @param builder
+     */
+    public SOAPFaultCodeImpl(SOAPFault parent, OMXMLParserWrapper builder,
+                             SOAPFactory factory) {
+        super(parent, SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME, builder,
+                factory);
+    }
+
+    /**
+     * @param parent
+     */
+    public SOAPFaultCodeImpl(SOAPFault parent,
+                             boolean extractNamespaceFromParent,
+                             SOAPFactory factory) throws SOAPProcessingException {
+        super(parent, SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME,
+                extractNamespaceFromParent, factory);
+    }
+
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+    public void setValue(SOAPFaultValue value) throws SOAPProcessingException {
+        ElementHelper.setNewElement(this, value, value);
+    }
+
+    public SOAPFaultValue getValue() {
+        return (SOAPFaultValue) ElementHelper.getChildWithName(this,
+                SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME);
+    }
+
+    public void setSubCode(SOAPFaultSubCode value) throws SOAPProcessingException {
+        ElementHelper.setNewElement(this, getSubCode(), value);
+    }
+
+    public SOAPFaultSubCode getSubCode() {
+        return (SOAPFaultSubCode) ElementHelper.getChildWithName(this,
+                SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME);
+    }
+
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException {
+        // select the builder
+        short builderType = PULL_TYPE_BUILDER;    // default is pull type
+        if (builder != null) {
+            builderType = this.builder.getBuilderType();
+        }
+        if ((builderType == PUSH_TYPE_BUILDER)
+                && (builder.getRegisteredContentHandler() == null)) {
+            builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(writer));
+        }
+
+        if (!cache) {
+            //No caching
+            if (this.firstChild != null) {
+                OMSerializerUtil.serializeStartpart(this, writer);
+                firstChild.internalSerializeAndConsume(writer);
+                OMSerializerUtil.serializeEndpart(writer);
+            } else if (!this.done) {
+                if (builderType == PULL_TYPE_BUILDER) {
+                    OMSerializerUtil.serializeByPullStream(this, writer);
+                } else {
+                    OMSerializerUtil.serializeStartpart(this, writer);
+                    builder.setCache(cache);
+                    builder.next();
+                    OMSerializerUtil.serializeEndpart(writer);
+                }
+            } else {
+                OMSerializerUtil.serializeNormal(this, writer, cache);
+            }
+            // do not serialise the siblings
+
+
+        } else {
+            //Cached
+            OMSerializerUtil.serializeNormal(this, writer, cache);
+
+            // do not serialise the siblings
+        }
+
+
+    }
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultDetailImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultDetailImpl.java
new file mode 100644
index 0000000..24f2366
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultDetailImpl.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultDetail;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.util.Iterator;
+
+public abstract class SOAPFaultDetailImpl extends SOAPElement implements SOAPFaultDetail {
+
+    
+    protected SOAPFaultDetailImpl(SOAPFault parent,
+            boolean extractNamespaceFromParent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent,
+                SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME,
+                extractNamespaceFromParent, factory);
+    }
+
+    protected SOAPFaultDetailImpl(SOAPFactory factory) {
+        super(factory);
+    }
+    
+    protected SOAPFaultDetailImpl(SOAPFault parent,
+                                  OMXMLParserWrapper builder,
+                                  SOAPFactory factory) {
+        super(parent, SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME, builder,
+                factory);
+    }
+
+    public void addDetailEntry(OMElement detailElement) {
+        this.addChild(detailElement);
+    }
+
+    public Iterator getAllDetailEntries() {
+        return this.getChildren();
+    }
+
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException {
+        // select the builder
+        short builderType = PULL_TYPE_BUILDER;    // default is pull type
+        if (builder != null) {
+            builderType = this.builder.getBuilderType();
+        }
+        if ((builderType == PUSH_TYPE_BUILDER)
+                && (builder.getRegisteredContentHandler() == null)) {
+            builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(writer));
+        }
+
+        if (!cache) {
+            //No caching
+            if (this.firstChild != null) {
+                OMSerializerUtil.serializeStartpart(this, writer);
+                firstChild.internalSerializeAndConsume(writer);
+                OMSerializerUtil.serializeEndpart(writer);
+            } else if (!this.done) {
+                if (builderType == PULL_TYPE_BUILDER) {
+                    OMSerializerUtil.serializeByPullStream(this, writer);
+                } else {
+                    OMSerializerUtil.serializeStartpart(this, writer);
+                    builder.setCache(cache);
+                    builder.next();
+                    OMSerializerUtil.serializeEndpart(writer);
+                }
+            } else {
+                OMSerializerUtil.serializeNormal(this, writer, cache);
+            }
+            // do not serialise the siblings
+
+
+        } else {
+            //Cached
+            OMSerializerUtil.serializeNormal(this, writer, cache);
+
+            // do not serialise the siblings
+        }
+
+
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java
new file mode 100644
index 0000000..91d2b3a
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java
@@ -0,0 +1,243 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom;
+
+import org.apache.axiom.om.OMConstants;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.om.impl.dom.ElementImpl;
+import org.apache.axiom.om.impl.dom.ParentNode;
+import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPConstants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAPFaultDetail;
+import org.apache.axiom.soap.SOAPFaultNode;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPFaultRole;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Iterator;
+
+public abstract class SOAPFaultImpl extends SOAPElement implements SOAPFault,
+		OMConstants {
+
+	protected Exception e;
+	/**
+	 * Constructor SOAPFaultImpl
+	 * 
+	 * @param parent
+	 * @param e
+	 */
+	public SOAPFaultImpl(SOAPBody parent, Exception e, SOAPFactory factory)
+			throws SOAPProcessingException {
+		super(parent, SOAPConstants.SOAPFAULT_LOCAL_NAME, true, factory);
+		setException(e);
+	}
+
+	public void setException(Exception e) {
+		this.e = e;
+		putExceptionToSOAPFault(e);
+	}
+
+	public SOAPFaultImpl(SOAPBody parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+		super(parent, SOAPConstants.SOAPFAULT_LOCAL_NAME, true, factory);
+	}
+
+	/**
+	 * Constructor SOAPFaultImpl
+	 * 
+	 * @param parent
+	 * @param builder
+	 */
+	public SOAPFaultImpl(SOAPBody parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+		super(parent, SOAPConstants.SOAPFAULT_LOCAL_NAME, builder, factory);
+	}
+
+	protected abstract SOAPFaultDetail getNewSOAPFaultDetail(SOAPFault fault)
+			throws SOAPProcessingException;
+
+	// --------------- Getters and Settors --------------------------- //
+
+	public void setCode(SOAPFaultCode soapFaultCode)
+			throws SOAPProcessingException {
+		setNewElement(getCode(), soapFaultCode);
+	}
+
+	public SOAPFaultCode getCode() {
+		return (SOAPFaultCode) this
+				.getChildWithName(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME);
+	}
+
+	public void setReason(SOAPFaultReason reason)
+			throws SOAPProcessingException {
+		setNewElement(getReason(), reason);
+	}
+
+	public SOAPFaultReason getReason() {
+		return (SOAPFaultReason) this
+				.getChildWithName(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME);
+	}
+
+	public void setNode(SOAPFaultNode node) throws SOAPProcessingException {
+		setNewElement(getNode(), node);
+	}
+
+	public SOAPFaultNode getNode() {
+		return (SOAPFaultNode) this
+				.getChildWithName(SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME);
+	}
+
+	public void setRole(SOAPFaultRole role) throws SOAPProcessingException {
+		setNewElement(getRole(), role);
+	}
+
+	public SOAPFaultRole getRole() {
+		return (SOAPFaultRoleImpl) this
+				.getChildWithName(SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME);
+	}
+
+	public void setDetail(SOAPFaultDetail detail)
+			throws SOAPProcessingException {
+		setNewElement(getDetail(), detail);
+	}
+
+	public SOAPFaultDetail getDetail() {
+		return (SOAPFaultDetail) this
+				.getChildWithName(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME);
+	}
+
+	/**
+	 * If exception detailElement is not there we will return null
+	 */
+	public Exception getException() throws OMException {
+		SOAPFaultDetail detail = getDetail();
+		if (detail == null) {
+			return null;
+		}
+
+		OMElement exceptionElement = getDetail().getFirstChildWithName(
+				new QName(SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY));
+		if (exceptionElement != null && exceptionElement.getText() != null) {
+			return new Exception(exceptionElement.getText());
+		}
+		return null;
+	}
+
+	protected void putExceptionToSOAPFault(Exception e)
+			throws SOAPProcessingException {
+		StringWriter sw = new StringWriter();
+		e.printStackTrace(new PrintWriter(sw));
+		sw.flush();
+		getDetail();
+		if (getDetail() == null) {
+			setDetail(getNewSOAPFaultDetail(this));
+
+		}
+		OMElement faultDetailEnty = new ElementImpl(this,
+				SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY,
+				null, this.factory);
+		faultDetailEnty.setText(sw.getBuffer().toString());
+	}
+
+	protected void setNewElement(OMElement myElement, OMElement newElement) {
+		if (myElement != null) {
+			myElement.discard();
+		}
+		if (newElement != null && newElement.getParent() != null) {
+			newElement.discard();
+		}
+		this.addChild(newElement);
+		myElement = newElement;
+	}
+
+	protected OMElement getChildWithName(String childName) {
+		Iterator childrenIter = getChildren();
+		while (childrenIter.hasNext()) {
+			OMNode node = (OMNode) childrenIter.next();
+			if (node.getType() == OMNode.ELEMENT_NODE
+					&& childName.equals(((OMElement) node).getLocalName())) {
+				return (OMElement) node;
+			}
+		}
+		return null;
+	}
+
+	protected void internalSerialize(XMLStreamWriter writer,
+                                     boolean cache) throws XMLStreamException {
+		// select the builder
+		short builderType = PULL_TYPE_BUILDER; // default is pull type
+		if (builder != null) {
+			builderType = this.builder.getBuilderType();
+		}
+		if ((builderType == PUSH_TYPE_BUILDER)
+				&& (builder.getRegisteredContentHandler() == null)) {
+			builder
+					.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(
+							writer));
+		}
+
+		// this is a special case. This fault element may contain its children
+		// in any order. But spec mandates a specific order
+		// the overriding of the method will facilitate that. Not sure this is
+		// the best method to do this :(
+		build();
+
+        OMSerializerUtil.serializeStartpart(this, writer);
+		SOAPFaultCode faultCode = getCode();
+		if (faultCode != null) {
+			(faultCode).serialize(writer);
+		}
+		SOAPFaultReason faultReason = getReason();
+		if (faultReason != null) {
+			(faultReason).serialize(writer);
+		}
+
+		serializeFaultNode(writer);
+
+		SOAPFaultRole faultRole = getRole();
+		if (faultRole != null) {
+			(faultRole).serialize(writer);
+		}
+
+		SOAPFaultDetail faultDetail = getDetail();
+		if (faultDetail != null) {
+			(faultDetail).serialize(writer);
+		}
+
+		OMSerializerUtil.serializeEndpart(writer);
+	}
+
+	protected abstract void serializeFaultNode(
+			XMLStreamWriter writer)
+			throws XMLStreamException;
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultNodeImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultNodeImpl.java
new file mode 100644
index 0000000..4a57ddc
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultNodeImpl.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom;
+
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultNode;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public abstract class SOAPFaultNodeImpl extends SOAPElement implements SOAPFaultNode {
+
+    public SOAPFaultNodeImpl(SOAPFault parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME, true, factory);
+    }
+
+    public SOAPFaultNodeImpl(SOAPFault parent, OMXMLParserWrapper builder,
+                             SOAPFactory factory) {
+        super(parent, SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME, builder,
+                factory);
+    }
+
+    public void setNodeValue(String uri) {
+        this.setText(uri);
+    }
+
+    public String getNodeValue() {
+        return this.getText();
+    }
+
+    protected void internalSerialize(
+            XMLStreamWriter writer, boolean cache)
+            throws XMLStreamException {
+            // select the builder
+            short builderType = PULL_TYPE_BUILDER;    // default is pull type
+            if (builder != null) {
+                builderType = this.builder.getBuilderType();
+            }
+            if ((builderType == PUSH_TYPE_BUILDER)
+                    && (builder.getRegisteredContentHandler() == null)) {
+                builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(
+                            writer));
+            }
+
+            if (!cache) {
+                //No caching
+                if (this.firstChild != null) {
+                    OMSerializerUtil.serializeStartpart(this, writer);
+                    firstChild.internalSerializeAndConsume(writer);
+                    OMSerializerUtil.serializeEndpart(writer);
+                } else if (!this.done) {
+                    if (builderType == PULL_TYPE_BUILDER) {
+                        OMSerializerUtil.serializeByPullStream(this, writer);
+                    } else {
+                        OMSerializerUtil.serializeStartpart(this, writer);
+                        builder.setCache(cache);
+                        builder.next();
+                        OMSerializerUtil.serializeEndpart(writer);
+                    }
+                } else {
+                    OMSerializerUtil.serializeNormal(this, writer, cache);
+                }
+                // do not serialise the siblings
+
+
+            } else {
+                //Cached
+                OMSerializerUtil.serializeNormal(this, writer, cache);
+
+                // do not serialise the siblings
+            }
+
+
+        }
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultReasonImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultReasonImpl.java
new file mode 100644
index 0000000..8778281
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultReasonImpl.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axiom.om.util.ElementHelper;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPFaultText;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.util.List;
+
+public abstract class SOAPFaultReasonImpl extends SOAPElement implements
+        SOAPFaultReason {
+    protected SOAPFaultText text;
+
+    /**
+     * Constructor OMElementImpl
+     *
+     * @param parent
+     * @param builder
+     */
+    public SOAPFaultReasonImpl(SOAPFault parent, OMXMLParserWrapper builder,
+                               SOAPFactory factory) {
+        super(parent, SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME, builder,
+                factory);
+    }
+
+    /**
+     * @param parent
+     */
+    public SOAPFaultReasonImpl(OMElement parent,
+                               boolean extractNamespaceFromParent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent,SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME,
+                extractNamespaceFromParent,factory);
+    }
+
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+    public void addSOAPText(SOAPFaultText soapFaultText) throws SOAPProcessingException {
+        ElementHelper.setNewElement(this, text, soapFaultText);
+    }
+
+    public SOAPFaultText getFirstSOAPText() {
+        return (SOAPFaultText) ElementHelper.getChildWithName(this,
+                SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME);
+    }
+
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException {
+        // select the builder
+        short builderType = PULL_TYPE_BUILDER;    // default is pull type
+        if (builder != null) {
+            builderType = this.builder.getBuilderType();
+        }
+        if ((builderType == PUSH_TYPE_BUILDER)
+                && (builder.getRegisteredContentHandler() == null)) {
+            builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(writer));
+        }
+
+        if (!cache) {
+            //No caching
+            if (this.firstChild != null) {
+                OMSerializerUtil.serializeStartpart(this, writer);
+                firstChild.internalSerializeAndConsume(writer);
+                OMSerializerUtil.serializeEndpart(writer);
+            } else if (!this.done) {
+                if (builderType == PULL_TYPE_BUILDER) {
+                    OMSerializerUtil.serializeByPullStream(this, writer);
+                } else {
+                    OMSerializerUtil.serializeStartpart(this, writer);
+                    builder.setCache(cache);
+                    builder.next();
+                    OMSerializerUtil.serializeEndpart(writer);
+                }
+            } else {
+                OMSerializerUtil.serializeNormal(this, writer, cache);
+            }
+            // do not serialise the siblings
+
+
+        } else {
+            //Cached
+            OMSerializerUtil.serializeNormal(this, writer, cache);
+
+            // do not serialise the siblings
+        }
+    }
+
+    public List getAllSoapTexts() {
+        //TODO Ruchith
+        throw new UnsupportedOperationException();
+    }
+
+    public SOAPFaultText getSOAPFaultText(String language) {
+        //TODO Ruchith
+        throw new UnsupportedOperationException();
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultRoleImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultRoleImpl.java
new file mode 100644
index 0000000..a910138
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultRoleImpl.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom;
+
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultRole;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+
+public abstract class SOAPFaultRoleImpl extends SOAPElement implements
+        SOAPFaultRole {
+
+    public SOAPFaultRoleImpl(SOAPFault parent,
+                             String localName,
+                             boolean extractNamespaceFromParent,
+                             SOAPFactory factory) throws SOAPProcessingException {
+        super(parent, localName, extractNamespaceFromParent, factory);
+    }
+
+    public SOAPFaultRoleImpl(SOAPFault parent, OMXMLParserWrapper builder,
+                             SOAPFactory factory) {
+        super(parent, SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME, builder,
+                factory);
+    }
+
+    public void setRoleValue(String uri) {
+        if (firstChild != null) {
+            firstChild.detach();
+        }
+        this.setText(uri);
+    }
+
+    public String getRoleValue() {
+        return this.getText();
+    }
+
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache)
+            throws XMLStreamException {
+        // select the builder
+        short builderType = PULL_TYPE_BUILDER;    // default is pull type
+        if (builder != null) {
+            builderType = this.builder.getBuilderType();
+        }
+        if ((builderType == PUSH_TYPE_BUILDER)
+            && (builder.getRegisteredContentHandler() == null)) {
+            builder.registerExternalContentHandler(
+                    new StreamWriterToContentHandlerConverter(writer));
+        }
+
+        if (!cache) {
+            //No caching
+            if (this.firstChild != null) {
+                OMSerializerUtil.serializeStartpart(this, writer);
+                firstChild.internalSerializeAndConsume(writer);
+                OMSerializerUtil.serializeEndpart(writer);
+            } else if (!this.done) {
+                if (builderType == PULL_TYPE_BUILDER) {
+                    OMSerializerUtil.serializeByPullStream(this, writer);
+                } else {
+                    OMSerializerUtil.serializeStartpart(this, writer);
+                    builder.setCache(cache);
+                    builder.next();
+                    OMSerializerUtil.serializeEndpart(writer);
+                }
+            } else {
+                OMSerializerUtil.serializeNormal(this, writer, cache);
+            }
+            // do not serialise the siblings
+
+
+        } else {
+            //Cached
+            OMSerializerUtil.serializeNormal(this, writer, cache);
+
+            // do not serialise the siblings
+        }
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultSubCodeImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultSubCodeImpl.java
new file mode 100644
index 0000000..9f44e16
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultSubCodeImpl.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.util.ElementHelper;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFaultSubCode;
+import org.apache.axiom.soap.SOAPFaultValue;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+public abstract class SOAPFaultSubCodeImpl extends SOAPElement implements SOAPFaultSubCode {
+
+    protected SOAPFaultValue value;
+    protected SOAPFaultSubCode subCode;
+
+
+    protected SOAPFaultSubCodeImpl(OMElement parent, String localName, SOAPFactory factory) throws SOAPProcessingException {
+        super(parent, localName, true, factory);
+    }
+
+    protected SOAPFaultSubCodeImpl(OMElement parent,
+                                   String localName,
+                                   OMXMLParserWrapper builder, 
+                                   SOAPFactory factory) {
+        super(parent, localName, builder, factory);
+    }
+
+    public void setValue(SOAPFaultValue soapFaultSubCodeValue) throws SOAPProcessingException {
+        ElementHelper.setNewElement(this, value, soapFaultSubCodeValue);
+    }
+
+    public SOAPFaultValue getValue() {
+        if (value == null) {
+            value =
+                    (SOAPFaultValue) ElementHelper.getChildWithName(this,
+                            SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME);
+        }
+        return value;
+    }
+
+    public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException {
+        ElementHelper.setNewElement(this, this.subCode, subCode);
+
+    }
+
+    public SOAPFaultSubCode getSubCode() {
+        if (subCode == null) {
+            subCode =
+                    (SOAPFaultSubCode) ElementHelper.getChildWithName(this,
+                            SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME);
+        }
+        return subCode;
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultTextImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultTextImpl.java
new file mode 100644
index 0000000..ee614bc
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultTextImpl.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.dom.AttrImpl;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPFaultText;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+import javax.xml.namespace.QName;
+
+public abstract class SOAPFaultTextImpl extends SOAPElement implements SOAPFaultText {
+    
+    protected OMAttribute langAttr;
+    
+    protected OMNamespace langNamespace = null;
+
+    protected SOAPFaultTextImpl(SOAPFaultReason parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, true, factory);
+        this.langNamespace = factory.createOMNamespace(
+                SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI,
+                SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX);
+    }
+
+    protected SOAPFaultTextImpl(SOAPFaultReason parent,
+                                OMXMLParserWrapper builder, SOAPFactory factory) {
+        super(parent, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, builder,
+                factory);
+    }
+
+
+    public void setLang(String lang) {
+        langAttr =
+                new AttrImpl(this.ownerNode, 
+                        SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME,
+                        langNamespace,
+                        lang, this.factory);
+        this.addAttribute(langAttr);
+    }
+
+    public String getLang() {
+        if (langAttr == null) {
+            langAttr =
+                    this.getAttribute(
+                            new QName(langNamespace.getNamespaceURI(),
+                                    SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME,
+                                    SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX));
+        }
+
+        return langAttr == null ? null : langAttr.getAttributeValue();
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultValueImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultValueImpl.java
new file mode 100644
index 0000000..d0765a4
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultValueImpl.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFaultValue;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+public abstract class SOAPFaultValueImpl extends SOAPElement implements SOAPFaultValue {
+
+    protected SOAPFaultValueImpl(OMElement parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME, true,
+                factory);
+    }
+
+    protected SOAPFaultValueImpl(OMElement parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME, builder,
+                factory);
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderBlockImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderBlockImpl.java
new file mode 100644
index 0000000..fd0eb58
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderBlockImpl.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.dom.AttrImpl;
+import org.apache.axiom.om.impl.dom.ElementImpl;
+import org.apache.axiom.om.impl.dom.NamespaceImpl;
+import org.apache.axiom.om.impl.dom.ParentNode;
+import org.apache.axiom.soap.SOAPConstants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+import javax.xml.namespace.QName;
+
+public abstract class SOAPHeaderBlockImpl  extends ElementImpl implements SOAPHeaderBlock {
+
+    private boolean processed = false;
+
+    /**
+     * @param localName
+     * @param ns
+     * @param parent     
+     */
+    public SOAPHeaderBlockImpl(String localName, OMNamespace ns,
+            SOAPHeader parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super((ParentNode)parent, localName,(NamespaceImpl) ns, factory);
+        this.setNamespace(ns);
+    }
+
+    /**
+     * Constructor SOAPHeaderBlockImpl.
+     *
+     * @param localName
+     * @param ns
+     * @param parent
+     * @param builder
+     */
+    public SOAPHeaderBlockImpl(String localName, OMNamespace ns,
+            OMElement parent, OMXMLParserWrapper builder, SOAPFactory factory) {
+        super((ParentNode)parent, localName, (NamespaceImpl)ns, builder, factory);
+        this.setNamespace(ns);
+    }
+
+    /**
+     * @param attributeName
+     * @param attrValue
+     * @param soapEnvelopeNamespaceURI
+     */
+    protected void setAttribute(String attributeName,
+                                String attrValue,
+                                String soapEnvelopeNamespaceURI) {
+        OMAttribute omAttribute = this.getAttribute(
+                new QName(soapEnvelopeNamespaceURI, attributeName));
+        if (omAttribute != null) {
+            omAttribute.setAttributeValue(attrValue);
+        } else {
+            OMAttribute attribute = new AttrImpl(this.ownerNode, attributeName,
+                    new NamespaceImpl(soapEnvelopeNamespaceURI,
+                            SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX),
+                            attrValue, this.factory);
+            this.addAttribute(attribute);
+        }
+    }
+
+    /**
+     * Method getAttribute.
+     *
+     * @param attrName
+     * @return Returns String.
+     */
+    protected String getAttribute(String attrName,
+                                  String soapEnvelopeNamespaceURI) {
+        OMAttribute omAttribute = this.getAttribute(
+                new QName(soapEnvelopeNamespaceURI, attrName));
+        return (omAttribute != null)
+                ? omAttribute.getAttributeValue()
+                : null;
+    }
+
+    public boolean isProcessed() {
+        return processed;
+    }
+
+    public void setProcessed() {
+        processed = true;
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java
new file mode 100644
index 0000000..abf717c
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java
@@ -0,0 +1,249 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.dom.ElementImpl;
+import org.apache.axiom.soap.SOAPConstants;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+public abstract class SOAPHeaderImpl extends SOAPElement implements SOAPHeader {
+
+    
+    /**
+     * @param envelope
+     */
+    public SOAPHeaderImpl(SOAPEnvelope envelope, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(envelope, SOAPConstants.HEADER_LOCAL_NAME, true, factory);
+
+    }
+
+    /**
+     * Constructor SOAPHeaderImpl
+     *
+     * @param envelope
+     * @param builder
+     */
+    public SOAPHeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(envelope, SOAPConstants.HEADER_LOCAL_NAME, builder, factory);
+    }
+
+    /**
+     * Creates a new <CODE>SOAPHeaderBlock</CODE> object initialized with the
+     * specified name and adds it to this <CODE>SOAPHeader</CODE> object.
+     *
+     * @param localName
+     * @param ns
+     * @return the new <CODE>SOAPHeaderBlock</CODE> object that was inserted
+     *         into this <CODE>SOAPHeader</CODE> object
+     * @throws org.apache.axiom.om.OMException
+     *                     if a SOAP error occurs
+     * @throws OMException
+     */
+    public abstract SOAPHeaderBlock addHeaderBlock(String localName,
+                                                   OMNamespace ns)
+            throws OMException;
+
+    /**
+     * Returns a list of all the <CODE>SOAPHeaderBlock</CODE> objects in this
+     * <CODE>SOAPHeader</CODE> object that have the the specified actor. An
+     * actor is a global attribute that indicates the intermediate parties to
+     * whom the message should be sent. An actor receives the message and then
+     * sends it to the next actor. The default actor is the ultimate intended
+     * recipient for the message, so if no actor attribute is included in a
+     * <CODE>SOAPHeader</CODE> object, the message is sent to its ultimate
+     * destination.
+     *
+     * @param paramRole a <CODE>String</CODE> giving the URI of the actor for
+     *                  which to search
+     * @return an <CODE>Iterator</CODE> object over all the <CODE>
+     *         SOAPHeaderBlock</CODE> objects that contain the specified actor
+     * @see #extractHeaderBlocks(String) extractHeaderBlocks(java.lang.String)
+     */
+    public Iterator examineHeaderBlocks(String paramRole) {
+        /* Iterator headerBlocksIter = this.getChildren();
+       ArrayList headersWithGivenActor = new ArrayList();
+
+       if (paramRole == null || "".equals(paramRole)) {
+           return returnAllSOAPHeaders(this.getChildren());
+       }
+
+       while (headerBlocksIter.hasNext()) {
+           Object o = headerBlocksIter.next();
+           if (o instanceof SOAPHeaderBlock) {
+               SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) o;
+               String role = soapHeaderBlock.getRole();
+               if ((role != null) && role.equalsIgnoreCase(paramRole)) {
+                   headersWithGivenActor.add(soapHeaderBlock);
+               }
+           }
+       }
+       return headersWithGivenActor.iterator();*/
+
+        if (paramRole == null || paramRole.trim().length() == 0) {
+            return examineAllHeaderBlocks();
+        }
+        Collection elements = new ArrayList();
+        for (Iterator iter = examineAllHeaderBlocks(); iter.hasNext();) {
+            SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) iter.next();
+            if (headerBlock.getRole() == null ||
+                headerBlock.getRole().trim().length() == 0 ||
+                headerBlock.getRole().equals(paramRole)) {
+                elements.add(headerBlock);
+            }
+        }
+        return elements.iterator();
+    }
+
+//    private Iterator returnAllSOAPHeaders(Iterator children) {
+//        ArrayList headers = new ArrayList();
+//        while (children.hasNext()) {
+//            Object o = children.next();
+//            if (o instanceof SOAPHeaderBlock) {
+//                headers.add(o);
+//            }
+//        }
+//
+//        return headers.iterator();
+//
+//    }
+
+    /**
+     * Returns a list of all the <CODE>SOAPHeaderBlock</CODE> objects in this
+     * <CODE>SOAPHeader</CODE> object that have the the specified role and
+     * detaches them from this <CODE> SOAPHeader</CODE> object. <P>This method
+     * allows an role to process only the parts of the <CODE>SOAPHeader</CODE>
+     * object that apply to it and to remove them before passing the message on
+     * to the next role.
+     *
+     * @param role a <CODE>String</CODE> giving the URI of the role for which to
+     *             search
+     * @return an <CODE>Iterator</CODE> object over all the <CODE>
+     *         SOAPHeaderBlock</CODE> objects that contain the specified role
+     * @see #examineHeaderBlocks(String) examineHeaderBlocks(java.lang.String)
+     */
+    public abstract Iterator extractHeaderBlocks(String role);
+
+    /**
+     * Returns an <code>Iterator</code> over all the <code>SOAPHeaderBlock</code>
+     * objects in this <code>SOAPHeader</code> object that have the specified
+     * actor and that have a MustUnderstand attribute whose value is equivalent
+     * to <code>true</code>.
+     *
+     * @param actor a <code>String</code> giving the URI of the actor for which
+     *              to search
+     * @return an <code>Iterator</code> object over all the
+     *         <code>SOAPHeaderBlock</code> objects that contain the specified
+     *         actor and are marked as MustUnderstand
+     */
+    public Iterator examineMustUnderstandHeaderBlocks(String actor) {
+        Iterator headerBlocksIter = this.getChildren();
+        ArrayList mustUnderstandHeadersWithGivenActor = new ArrayList();
+        while (headerBlocksIter.hasNext()) {
+            Object o = headerBlocksIter.next();
+            if (o instanceof SOAPHeaderBlock) {
+                SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) o;
+                String role = soapHeaderBlock.getRole();
+                boolean mustUnderstand = soapHeaderBlock.getMustUnderstand();
+                if ((role != null) && role.equalsIgnoreCase(actor) &&
+                    mustUnderstand) {
+                    mustUnderstandHeadersWithGivenActor.add(soapHeaderBlock);
+                }
+            }
+        }
+        return mustUnderstandHeadersWithGivenActor.iterator();
+    }
+
+    /**
+     * Returns an <code>Iterator</code> over all the <code>SOAPHeaderBlock</code>
+     * objects in this <code>SOAPHeader</code> object. Not that this will return
+     * elements containing the QName (http://schemas.xmlsoap.org/soap/envelope/,
+     * Header)
+     *
+     * @return an <code>Iterator</code> object over all the
+     *         <code>SOAPHeaderBlock</code> objects contained by this
+     *         <code>SOAPHeader</code>
+     */
+    public Iterator examineAllHeaderBlocks() {
+        return this.getChildrenWithName(null);
+    }
+
+    /**
+     * Returns an <code>Iterator</code> over all the <code>SOAPHeaderBlock</code>
+     * objects in this <code>SOAPHeader </code> object and detaches them from
+     * this <code>SOAPHeader</code> object.
+     *
+     * @return an <code>Iterator</code> object over all the
+     *         <code>SOAPHeaderBlock</code> objects contained by this
+     *         <code>SOAPHeader</code>
+     */
+    public Iterator extractAllHeaderBlocks() {
+        Collection result = new ArrayList();
+        for (Iterator iter = getChildrenWithName(null); iter.hasNext();) {
+            result.add(((ElementImpl) iter.next()).detach());
+        }
+        return result.iterator();
+    }
+
+    public ArrayList getHeaderBlocksWithNSURI(String nsURI) {
+        ArrayList headers = null;
+        OMNode node = null;
+        OMElement header = this.getFirstElement();
+
+        if (header != null) {
+            headers = new ArrayList();
+        }
+
+        node = header;
+
+        while (node != null) {
+            if (node.getType() == OMNode.ELEMENT_NODE) {
+                header = (OMElement) node;
+                if (nsURI.equals(header.getNamespace().getNamespaceURI())) {
+                    headers.add(header);
+                }
+            }
+            node = node.getNextOMSibling();
+
+        }
+        return headers;
+
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAPEnvelopeImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting an implementation of SOAP Envelope as the " +
+                    "parent. But received some other implementation");
+        }
+    }
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPMessageImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPMessageImpl.java
new file mode 100644
index 0000000..e4a0636
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPMessageImpl.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom;
+
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.om.impl.dom.DocumentImpl;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPMessage;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class SOAPMessageImpl extends DocumentImpl implements SOAPMessage {
+
+    public SOAPMessageImpl(SOAPFactory factory) {
+        super(factory);
+    }
+
+    public SOAPMessageImpl(SOAPEnvelope envelope,
+                           OMXMLParserWrapper parserWrapper, SOAPFactory factory) {
+        this(parserWrapper, factory);
+        this.setSOAPEnvelope(envelope);
+    }
+
+    public SOAPMessageImpl(OMXMLParserWrapper parserWrapper, SOAPFactory factory) {
+        super(factory);
+        this.builder = parserWrapper;
+    }
+
+
+    public SOAPEnvelope getSOAPEnvelope() throws SOAPProcessingException {
+        return (SOAPEnvelope) getOMDocumentElement();
+    }
+
+    public void setSOAPEnvelope(SOAPEnvelope envelope)
+            throws SOAPProcessingException {
+        this.addChild(envelope);
+    }
+
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache,
+                                     boolean includeXMLDeclaration) throws XMLStreamException {
+        if (cache) {
+            ((OMNodeEx)this.ownerNode.getDocumentElement()).internalSerialize(writer);
+        } else {
+            ((OMNodeEx)this.ownerNode.getDocumentElement()).internalSerializeAndConsume(writer);
+        }
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPTextImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPTextImpl.java
new file mode 100644
index 0000000..110361f
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPTextImpl.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+public class SOAPTextImpl extends SOAPElement{
+
+    protected SOAPTextImpl(OMElement parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, true, factory);
+    }
+
+    protected SOAPTextImpl(OMElement parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, builder, factory);
+    }
+
+    public void setLang(String lang) {
+        // TODO : Chinthaka fix me
+    }
+
+    public String getLang() {
+        // TODO Chinthaka fix me
+        return null;
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        // do nothing
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/factory/DOMSOAPFactory.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/factory/DOMSOAPFactory.java
new file mode 100644
index 0000000..a873f72
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/factory/DOMSOAPFactory.java
@@ -0,0 +1,267 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.soap.impl.dom.factory;
+
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.dom.DocumentImpl;
+import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAPFaultDetail;
+import org.apache.axiom.soap.SOAPFaultNode;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPFaultRole;
+import org.apache.axiom.soap.SOAPFaultSubCode;
+import org.apache.axiom.soap.SOAPFaultText;
+import org.apache.axiom.soap.SOAPFaultValue;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axiom.soap.SOAPMessage;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl;
+import org.apache.axiom.soap.impl.dom.SOAPMessageImpl;
+import org.apache.axiom.soap.impl.dom.soap11.SOAP11FaultDetailImpl;
+
+public class DOMSOAPFactory extends OMDOMFactory implements SOAPFactory {
+
+	public DOMSOAPFactory() {}
+	
+	public DOMSOAPFactory(DocumentImpl doc) {
+		super(doc);
+	}
+
+    public String getSoapVersionURI() {
+        throw new UnsupportedOperationException();
+    }
+
+    public SOAPMessage createSOAPMessage(OMXMLParserWrapper builder) {
+        SOAPMessageImpl messageImpl = new SOAPMessageImpl(builder, this);
+        this.document = messageImpl;
+        return messageImpl;
+    }
+
+	public SOAPMessage createSOAPMessage(SOAPEnvelope envelope, OMXMLParserWrapper parserWrapper) {
+		SOAPMessageImpl messageImpl = new SOAPMessageImpl(envelope, parserWrapper, this);
+		this.document = messageImpl;
+		return messageImpl;
+	}
+
+	public SOAPEnvelope createSOAPEnvelope(OMXMLParserWrapper builder) {
+		return new SOAPEnvelopeImpl((DocumentImpl)this.createOMDocument(), builder, this);
+	}
+
+	public SOAPEnvelope createSOAPEnvelope() throws SOAPProcessingException {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPHeader createSOAPHeader(SOAPEnvelope envelope) throws SOAPProcessingException {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPHeader createSOAPHeader(SOAPEnvelope envelope, OMXMLParserWrapper builder) {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns, SOAPHeader parent) throws SOAPProcessingException {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns, SOAPHeader parent, OMXMLParserWrapper builder) throws SOAPProcessingException {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFault createSOAPFault(SOAPBody parent, Exception e) throws SOAPProcessingException {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFault createSOAPFault(SOAPBody parent) throws SOAPProcessingException {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFault createSOAPFault(SOAPBody parent, OMXMLParserWrapper builder) {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPBody createSOAPBody(SOAPEnvelope envelope) throws SOAPProcessingException {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPBody createSOAPBody(SOAPEnvelope envelope, OMXMLParserWrapper builder) {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFaultCode createSOAPFaultCode(SOAPFault parent) throws SOAPProcessingException {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFaultCode createSOAPFaultCode(SOAPFault parent, OMXMLParserWrapper builder) {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent) throws SOAPProcessingException {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent, OMXMLParserWrapper builder) {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent) throws SOAPProcessingException {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent, OMXMLParserWrapper builder) {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent) throws SOAPProcessingException {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent, OMXMLParserWrapper builder) {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent) throws SOAPProcessingException {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent, OMXMLParserWrapper builder) {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFaultReason createSOAPFaultReason(SOAPFault parent) throws SOAPProcessingException {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFaultReason createSOAPFaultReason(SOAPFault parent, OMXMLParserWrapper builder) {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent) throws SOAPProcessingException {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent, OMXMLParserWrapper builder) {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFaultNode createSOAPFaultNode(SOAPFault parent) throws SOAPProcessingException {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFaultNode createSOAPFaultNode(SOAPFault parent, OMXMLParserWrapper builder) {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFaultRole createSOAPFaultRole(SOAPFault parent) throws SOAPProcessingException {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFaultRole createSOAPFaultRole(SOAPFault parent, OMXMLParserWrapper builder) {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent) throws SOAPProcessingException {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent, OMXMLParserWrapper builder) {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException {
+		throw new UnsupportedOperationException();
+	}
+
+	public SOAPEnvelope getDefaultFaultEnvelope() throws SOAPProcessingException {
+        SOAPEnvelope defaultEnvelope = getDefaultEnvelope();
+        SOAPFault fault = createSOAPFault(defaultEnvelope.getBody());
+
+        SOAPFaultCode faultCode = createSOAPFaultCode(fault);
+        createSOAPFaultValue(faultCode);
+
+        SOAPFaultReason reason = createSOAPFaultReason(fault);
+        createSOAPFaultText(reason);
+
+        createSOAPFaultNode(fault);
+        createSOAPFaultRole(fault);
+        createSOAPFaultDetail(fault);
+
+        return defaultEnvelope;
+	}
+
+    public SOAPMessage createSOAPMessage() {
+        return new SOAPMessageImpl(this);
+    }
+
+    public SOAPHeader createSOAPHeader() throws SOAPProcessingException {
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public SOAPHeaderBlock createSOAPHeaderBlock(String localName, OMNamespace ns) throws SOAPProcessingException {
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public SOAPFault createSOAPFault() throws SOAPProcessingException {
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public SOAPBody createSOAPBody() throws SOAPProcessingException {
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public SOAPFaultCode createSOAPFaultCode() throws SOAPProcessingException {
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public SOAPFaultValue createSOAPFaultValue() throws SOAPProcessingException {
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public SOAPFaultSubCode createSOAPFaultSubCode() throws SOAPProcessingException {
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public SOAPFaultReason createSOAPFaultReason() throws SOAPProcessingException {
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public SOAPFaultText createSOAPFaultText() throws SOAPProcessingException {
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public SOAPFaultNode createSOAPFaultNode() throws SOAPProcessingException {
+         throw new UnsupportedOperationException("TODO");
+    }
+
+    public SOAPFaultRole createSOAPFaultRole() throws SOAPProcessingException {
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public SOAPFaultDetail createSOAPFaultDetail() throws SOAPProcessingException {
+        return new SOAP11FaultDetailImpl(this);
+    }
+
+    public OMNamespace getNamespace() {
+        throw new UnsupportedOperationException();
+    }
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11BodyImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11BodyImpl.java
new file mode 100644
index 0000000..9f5fe95
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11BodyImpl.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap11;
+
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPBodyImpl;
+
+public class SOAP11BodyImpl extends SOAPBodyImpl {
+    /**
+     * @param envelope
+     */
+    public SOAP11BodyImpl(SOAPEnvelope envelope, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(envelope, factory);
+    }
+
+    /**
+     * Constructor SOAPBodyImpl
+     *
+     * @param envelope
+     * @param builder
+     */
+    public SOAP11BodyImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(envelope, builder, factory);
+    }
+
+    public SOAPFault addFault(Exception e) throws OMException {
+    	SOAPFault soapFault = new SOAP11FaultImpl(this, e, (SOAPFactory)this.factory);
+    	this.hasSOAPFault = true;
+    	return soapFault;
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11Factory.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11Factory.java
new file mode 100644
index 0000000..cdcde0c
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11Factory.java
@@ -0,0 +1,230 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap11;
+
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.dom.DocumentImpl;
+import org.apache.axiom.om.impl.dom.NamespaceImpl;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAPFaultDetail;
+import org.apache.axiom.soap.SOAPFaultNode;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPFaultRole;
+import org.apache.axiom.soap.SOAPFaultSubCode;
+import org.apache.axiom.soap.SOAPFaultText;
+import org.apache.axiom.soap.SOAPFaultValue;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl;
+import org.apache.axiom.soap.impl.dom.factory.DOMSOAPFactory;
+
+public class SOAP11Factory extends DOMSOAPFactory {
+
+	public SOAP11Factory() {}
+	
+	public SOAP11Factory(DocumentImpl doc) {
+		super(doc);
+	}
+
+    public String getSoapVersionURI() {
+        return SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+    }
+
+    public SOAPEnvelope createSOAPEnvelope() {
+        return new SOAPEnvelopeImpl(
+                new NamespaceImpl(
+                        SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+                        SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX),
+                this);
+    }
+
+    public SOAPHeader createSOAPHeader(SOAPEnvelope envelope)
+            throws SOAPProcessingException {
+        return new SOAP11HeaderImpl(envelope, this);
+    }
+
+    public SOAPHeader createSOAPHeader(SOAPEnvelope envelope,
+                                       OMXMLParserWrapper builder) {
+        return new SOAP11HeaderImpl(envelope, builder, this);
+    }
+
+    public SOAPHeaderBlock createSOAPHeaderBlock(String localName,
+            OMNamespace ns, SOAPHeader parent) throws SOAPProcessingException {
+        return new SOAP11HeaderBlockImpl(localName, ns, parent, this);
+    }
+
+    public SOAPHeaderBlock createSOAPHeaderBlock(String localName,
+            OMNamespace ns, SOAPHeader parent, OMXMLParserWrapper builder)
+            throws SOAPProcessingException {
+        return new SOAP11HeaderBlockImpl(localName, ns, parent, builder, this);
+    }
+
+    public SOAPFault createSOAPFault(SOAPBody parent, Exception e)
+            throws SOAPProcessingException {
+        return new SOAP11FaultImpl(parent, e, this);
+    }
+
+    public SOAPFault createSOAPFault(SOAPBody parent)
+            throws SOAPProcessingException {
+        return new SOAP11FaultImpl(parent, this);
+    }
+
+    public SOAPFault createSOAPFault(SOAPBody parent,
+                                     OMXMLParserWrapper builder) {
+        return new SOAP11FaultImpl(parent, builder, this);
+    }
+
+    public SOAPBody createSOAPBody(SOAPEnvelope envelope)
+            throws SOAPProcessingException {
+        return new SOAP11BodyImpl(envelope, (SOAPFactory) envelope
+                .getOMFactory());
+    }
+
+    public SOAPBody createSOAPBody(SOAPEnvelope envelope,
+                                   OMXMLParserWrapper builder) {
+        return new SOAP11BodyImpl(envelope, builder, (SOAPFactory) envelope
+                .getOMFactory());
+    }
+
+    public SOAPFaultCode createSOAPFaultCode(SOAPFault parent)
+            throws SOAPProcessingException {
+        return new SOAP11FaultCodeImpl(parent, this);
+    }
+
+    public SOAPFaultCode createSOAPFaultCode(SOAPFault parent,
+                                             OMXMLParserWrapper builder) {
+        return new SOAP11FaultCodeImpl(parent, builder, this);
+    }
+
+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent)
+            throws SOAPProcessingException {
+        return new SOAP11FaultValueImpl(parent, this);
+    }
+
+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent,
+                                               OMXMLParserWrapper builder) {
+        return new SOAP11FaultValueImpl(parent, builder, this);
+    }
+
+    //added
+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent)
+            throws SOAPProcessingException {
+        return new SOAP11FaultValueImpl(parent, this);
+    }
+
+    //added
+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent,
+                                               OMXMLParserWrapper builder) {
+        return new SOAP11FaultValueImpl(parent, builder, this);
+    }
+
+    //changed
+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent)
+            throws SOAPProcessingException {
+        return new SOAP11FaultSubCodeImpl(parent, this);
+    }
+
+    //changed
+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent,
+                                                   OMXMLParserWrapper builder) {
+        return new SOAP11FaultSubCodeImpl(parent, builder, this);
+    }
+
+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent)
+            throws SOAPProcessingException {
+        return new SOAP11FaultSubCodeImpl(parent, this);
+    }
+
+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent,
+                                                   OMXMLParserWrapper builder) {
+        return new SOAP11FaultSubCodeImpl(parent, builder, this);
+    }
+
+    public SOAPFaultReason createSOAPFaultReason(SOAPFault parent)
+            throws SOAPProcessingException {
+        return new SOAP11FaultReasonImpl(parent, this);
+    }
+
+    public SOAPFaultReason createSOAPFaultReason(SOAPFault parent,
+                                                 OMXMLParserWrapper builder) {
+        return new SOAP11FaultReasonImpl(parent, builder, this);
+    }
+
+    public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent)
+            throws SOAPProcessingException {
+        return new SOAP11FaultTextImpl(parent, this);
+    }
+
+    public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent,
+                                             OMXMLParserWrapper builder) {
+        return new SOAP11FaultTextImpl(parent, builder, this);
+    }
+
+    public SOAPFaultNode createSOAPFaultNode(SOAPFault parent)
+            throws SOAPProcessingException {
+        return new SOAP11FaultNodeImpl(parent, this);
+    }
+
+    public SOAPFaultNode createSOAPFaultNode(SOAPFault parent,
+                                             OMXMLParserWrapper builder) {
+        return new SOAP11FaultNodeImpl(parent, builder, this);
+    }
+
+    public SOAPFaultRole createSOAPFaultRole(SOAPFault parent)
+            throws SOAPProcessingException {
+        return new SOAP11FaultRoleImpl(parent, this);
+    }
+
+    public SOAPFaultRole createSOAPFaultRole(SOAPFault parent,
+                                             OMXMLParserWrapper builder) {
+        return new SOAP11FaultRoleImpl(parent, builder, this);
+    }
+
+    public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent)
+            throws SOAPProcessingException {
+        return new SOAP11FaultDetailImpl(parent, this);
+    }
+
+    public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent,
+                                                 OMXMLParserWrapper builder) {
+        return new SOAP11FaultDetailImpl(parent, builder, this);
+    }
+
+    public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException {
+        OMNamespace ns =
+                new NamespaceImpl(
+                        SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+                        SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX);
+        SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns, this);
+        createSOAPHeader(env);
+        createSOAPBody(env);
+        return env;
+    }
+    
+    public OMNamespace getNamespace() {
+        return new NamespaceImpl(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+                SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX);
+    }
+    
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultCodeImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultCodeImpl.java
new file mode 100644
index 0000000..d98ba69
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultCodeImpl.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap11;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultSubCode;
+import org.apache.axiom.soap.SOAPFaultValue;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultCodeImpl;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class SOAP11FaultCodeImpl extends SOAPFaultCodeImpl {
+    /**
+     * Constructor OMElementImpl
+     *
+     * @param parent
+     * @param builder
+     */
+    public SOAP11FaultCodeImpl(SOAPFault parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    /**
+     * @param parent
+     */
+    public SOAP11FaultCodeImpl(SOAPFault parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, false, factory);
+    }
+
+
+    public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException {
+        if (!(subCode instanceof SOAP11FaultSubCodeImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault Sub " +
+                    "Code. But received some other implementation");
+        }
+        super.setSubCode(subCode);
+    }
+
+    public void setValue(SOAPFaultValue value) throws SOAPProcessingException {
+        if (!(value instanceof SOAP11FaultValueImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault Value. " +
+                    "But received some other implementation");
+        }
+        super.setValue(value);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP11FaultImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault as the " +
+                    "parent. But received some other implementation");
+        }
+    }
+
+    protected void internalSerialize(
+            XMLStreamWriter writer, boolean cache)
+            throws XMLStreamException {
+
+        // select the builder
+        short builderType = PULL_TYPE_BUILDER;    // default is pull type
+        if (builder != null) {
+            builderType = this.builder.getBuilderType();
+        }
+        if ((builderType == PUSH_TYPE_BUILDER)
+                && (builder.getRegisteredContentHandler() == null)) {
+            builder.registerExternalContentHandler(
+                    new StreamWriterToContentHandlerConverter(writer));
+        }
+
+        OMSerializerUtil.serializeStartpart(this, 
+        		SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME, 
+        		writer);
+    
+        String text = this.getValue().getText();
+        writer.writeCharacters(text);
+        writer.writeEndElement();
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultDetailImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultDetailImpl.java
new file mode 100644
index 0000000..098d90e
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultDetailImpl.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap11;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultDetailImpl;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class SOAP11FaultDetailImpl extends SOAPFaultDetailImpl {
+    
+    public SOAP11FaultDetailImpl(SOAPFault parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, false, factory);
+    }
+
+    public SOAP11FaultDetailImpl(SOAPFault parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    public SOAP11FaultDetailImpl(SOAPFactory factory) {
+        super(factory);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP11FaultImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault as " +
+                    "the parent. But received some other implementation");
+        }
+    }
+
+    public void internalSerialize(XMLStreamWriter writer, boolean cache)
+            throws XMLStreamException {
+
+        // select the builder
+        short builderType = PULL_TYPE_BUILDER;    // default is pull type
+        if (builder != null) {
+            builderType = this.builder.getBuilderType();
+        }
+        if ((builderType == PUSH_TYPE_BUILDER)
+                && (builder.getRegisteredContentHandler() == null)) {
+            builder.registerExternalContentHandler(
+                    new StreamWriterToContentHandlerConverter(writer));
+        }
+
+        OMSerializerUtil.serializeStartpart(this, 
+        		SOAP11Constants.SOAP_FAULT_DETAIL_LOCAL_NAME, 
+        		writer);
+
+        String text = this.getText();
+        writer.writeCharacters(text);
+
+
+        if (firstChild != null) {
+            firstChild.internalSerializeAndConsume(writer);
+        }
+        writer.writeEndElement();
+    }
+
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultImpl.java
new file mode 100644
index 0000000..6fbc2c0
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultImpl.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap11;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAPFaultDetail;
+import org.apache.axiom.soap.SOAPFaultNode;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPFaultRole;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultImpl;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class SOAP11FaultImpl extends SOAPFaultImpl {
+
+    public SOAP11FaultImpl(SOAPBody parent, Exception e, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, e, factory);
+    }
+
+    public SOAP11FaultImpl(SOAPBody parent, OMXMLParserWrapper builder,
+                           SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    /**
+     * This is a convenience method for the SOAP Fault Impl.
+     *
+     * @param parent
+     */
+    public SOAP11FaultImpl(SOAPBody parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, factory);
+    }
+
+    protected SOAPFaultDetail getNewSOAPFaultDetail(SOAPFault fault)
+            throws SOAPProcessingException {
+        return new SOAP11FaultDetailImpl(fault, (SOAPFactory)this.factory);
+    }
+
+    public void setCode(SOAPFaultCode soapFaultCode)
+            throws SOAPProcessingException {
+        if (!(soapFaultCode instanceof SOAP11FaultCodeImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault Code. " +
+                    "But received some other implementation");
+        }
+        super.setCode(soapFaultCode);
+    }
+
+    public void setReason(SOAPFaultReason reason) throws SOAPProcessingException {
+        if (!(reason instanceof SOAP11FaultReasonImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault Reason. " +
+                    "But received some other implementation");
+        }
+        super.setReason(reason);
+    }
+
+    public void setNode(SOAPFaultNode node) throws SOAPProcessingException {
+        if (!(node instanceof SOAP11FaultNodeImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault Node. " +
+                    "But received some other implementation");
+        }
+        super.setNode(node);
+    }
+
+    public void setRole(SOAPFaultRole role) throws SOAPProcessingException {
+        if (!(role instanceof SOAP11FaultRoleImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault Role. " +
+                    "But received some other implementation");
+        }
+        super.setRole(role);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP11BodyImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Body as the " +
+                    "parent. But received some other implementation");
+        }
+    }
+
+    public void setDetail(SOAPFaultDetail detail) throws SOAPProcessingException {
+        if (!(detail instanceof SOAP11FaultDetailImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault Detail. " +
+                    "But received some other implementation");
+        }
+        super.setDetail(detail);
+    }
+
+    protected void serializeFaultNode(
+            XMLStreamWriter writer)
+            throws XMLStreamException {
+
+    }
+
+    public SOAPFaultRole getRole() {
+        return (SOAP11FaultRoleImpl) this
+                .getChildWithName(SOAP11Constants.SOAP_FAULT_ACTOR_LOCAL_NAME);
+    }
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultNodeImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultNodeImpl.java
new file mode 100644
index 0000000..6ccae62
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultNodeImpl.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap11;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultNodeImpl;
+
+public class SOAP11FaultNodeImpl extends SOAPFaultNodeImpl {
+
+    public SOAP11FaultNodeImpl(SOAPFault parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, factory);
+    }
+
+    public SOAP11FaultNodeImpl(SOAPFault parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP11FaultImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault as the " +
+                    "parent. But received some other implementation");
+        }
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultReasonImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultReasonImpl.java
new file mode 100644
index 0000000..9374008
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultReasonImpl.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap11;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultText;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultReasonImpl;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class SOAP11FaultReasonImpl extends SOAPFaultReasonImpl {
+
+	public SOAP11FaultReasonImpl(SOAPFault parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    /**
+     * @param parent
+     */
+    public SOAP11FaultReasonImpl(SOAPFault parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, false, factory);
+    }
+
+    public void addSOAPText(SOAPFaultText soapFaultText)
+            throws SOAPProcessingException {
+        if (!(soapFaultText instanceof SOAP11FaultTextImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault Text. " +
+                    "But received some other implementation");
+        }
+        super.addSOAPText(soapFaultText);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP11FaultImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault as the " +
+                    "parent. But received some other implementation");
+        }
+    }
+
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache)
+            throws XMLStreamException {
+
+        // select the builder
+        short builderType = PULL_TYPE_BUILDER;    // default is pull type
+        if (builder != null) {
+            builderType = this.builder.getBuilderType();
+        }
+        if ((builderType == PUSH_TYPE_BUILDER)
+                && (builder.getRegisteredContentHandler() == null)) {
+            builder.registerExternalContentHandler(
+                    new StreamWriterToContentHandlerConverter(writer));
+        }
+
+        OMSerializerUtil.serializeStartpart(this, 
+        		SOAP11Constants.SOAP_FAULT_STRING_LOCAL_NAME, 
+        		writer);
+      
+        String text = this.getFirstSOAPText().getText();
+        writer.writeCharacters(text);
+        writer.writeEndElement();
+    }
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultRoleImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultRoleImpl.java
new file mode 100644
index 0000000..f965085
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultRoleImpl.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap11;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultRoleImpl;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class SOAP11FaultRoleImpl extends SOAPFaultRoleImpl {
+    
+    public SOAP11FaultRoleImpl(SOAPFault parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, SOAP11Constants.SOAP_FAULT_ACTOR_LOCAL_NAME, false,
+                factory);
+    }
+
+    public SOAP11FaultRoleImpl(SOAPFault parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP11FaultImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault as the " +
+                    "parent. But received some other implementation");
+        }
+    }
+
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache)
+            throws XMLStreamException {
+
+        // select the builder
+        short builderType = PULL_TYPE_BUILDER;    // default is pull type
+        if (builder != null) {
+            builderType = this.builder.getBuilderType();
+        }
+        if ((builderType == PUSH_TYPE_BUILDER)
+                && (builder.getRegisteredContentHandler() == null)) {
+            builder.registerExternalContentHandler(
+                    new StreamWriterToContentHandlerConverter(writer));
+        }
+
+        OMSerializerUtil.serializeStartpart(this, 
+        		SOAP11Constants.SOAP_FAULT_ACTOR_LOCAL_NAME, 
+        		writer);
+       
+        String text = this.getText();
+        writer.writeCharacters(text);
+        writer.writeEndElement();
+    }
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultSubCodeImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultSubCodeImpl.java
new file mode 100644
index 0000000..b287899
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultSubCodeImpl.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap11;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAPFaultSubCode;
+import org.apache.axiom.soap.SOAPFaultValue;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultSubCodeImpl;
+
+public class SOAP11FaultSubCodeImpl extends SOAPFaultSubCodeImpl {
+	
+    //changed
+    public SOAP11FaultSubCodeImpl(SOAPFaultCode parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, factory);
+    }
+
+    //changed
+    public SOAP11FaultSubCodeImpl(SOAPFaultCode parent,
+                                  OMXMLParserWrapper builder,
+                                  SOAPFactory factory) {
+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder,
+                factory);
+    }
+
+    public SOAP11FaultSubCodeImpl(SOAPFaultSubCode parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, factory);
+    }
+
+    public SOAP11FaultSubCodeImpl(SOAPFaultSubCode parent,
+                                  OMXMLParserWrapper builder,
+                                  SOAPFactory factory) {
+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder,
+                factory);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP11FaultSubCodeImpl) ||
+                (parent instanceof SOAP11FaultCodeImpl)) {
+            throw new SOAPProcessingException("Expecting SOAP 1.1 " +
+                    "implementation of SOAP FaultSubCode or SOAP FaultCode as" +
+                    " the parent. But received some other implementation");
+        }
+    }
+
+    public void setSubCode(SOAPFaultSubCode subCode)
+            throws SOAPProcessingException {
+        if (!((parentNode instanceof SOAP11FaultSubCodeImpl) || 
+                (parentNode instanceof SOAP11FaultCodeImpl))) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault Sub " +
+                    "Code. But received some other implementation");
+        }
+        super.setSubCode(subCode);
+    }
+
+    public void setValue(SOAPFaultValue soapFaultSubCodeValue)
+            throws SOAPProcessingException {
+        if (!(soapFaultSubCodeValue instanceof SOAP11FaultValueImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault Value. " +
+                    "But received some other implementation");
+        }
+        super.setValue(soapFaultSubCodeValue);
+    }
+
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultTextImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultTextImpl.java
new file mode 100644
index 0000000..a65a733
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultTextImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap11;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultTextImpl;
+
+public class SOAP11FaultTextImpl extends SOAPFaultTextImpl  {
+    public SOAP11FaultTextImpl(SOAPFaultReason parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, factory);
+    }
+
+    public SOAP11FaultTextImpl(SOAPFaultReason parent,
+            OMXMLParserWrapper builder, SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP11FaultReasonImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP FaultReason " +
+                    "as the parent. But received some other implementation");
+        }
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultValueImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultValueImpl.java
new file mode 100644
index 0000000..0570b29
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11FaultValueImpl.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap11;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultValueImpl;
+
+public class SOAP11FaultValueImpl extends SOAPFaultValueImpl {
+    
+    public SOAP11FaultValueImpl(OMElement parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, factory);
+    }
+
+    public SOAP11FaultValueImpl(OMElement parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!((parent instanceof SOAP11FaultSubCodeImpl) ||
+                (parent instanceof SOAP11FaultCodeImpl))) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP FaultSubCode " +
+                    "or SOAP FaultCode as the parent. But received some other" +
+                    " implementation." +
+                    parent.getClass());
+        }
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11HeaderBlockImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11HeaderBlockImpl.java
new file mode 100644
index 0000000..833a46a
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11HeaderBlockImpl.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap11;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAPConstants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPHeaderBlockImpl;
+
+public class SOAP11HeaderBlockImpl extends SOAPHeaderBlockImpl {
+    /**
+     * @param localName
+     * @param ns
+     */
+    public SOAP11HeaderBlockImpl(String localName,
+                                 OMNamespace ns,
+                                 SOAPHeader parent,
+                                 SOAPFactory factory) throws SOAPProcessingException {
+        super(localName, ns, parent, factory);
+        checkParent(parent);
+    }
+
+    /**
+     * Constructor SOAPHeaderBlockImpl
+     *
+     * @param localName
+     * @param ns
+     * @param parent
+     * @param builder
+     */
+    public SOAP11HeaderBlockImpl(String localName,
+                                 OMNamespace ns,
+                                 OMElement parent,
+                                 OMXMLParserWrapper builder,
+                                 SOAPFactory factory) {
+        super(localName, ns, parent, builder, factory);
+    }
+
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP11HeaderImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Body as the parent. But received some other implementation");
+        }
+    }
+
+    public void setRole(String roleURI) {
+        setAttribute(SOAP11Constants.ATTR_ACTOR,
+                roleURI,
+                SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+
+    }
+
+    public String getRole() {
+        return getAttribute(SOAP11Constants.ATTR_ACTOR,
+                SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+    }
+
+    public void setMustUnderstand(boolean mustUnderstand) {
+        setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,
+                mustUnderstand ? "1" : "0",
+                SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+    }
+
+    public void setMustUnderstand(String mustUnderstand) throws SOAPProcessingException {
+        if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equals(mustUnderstand) ||
+                SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equals(mustUnderstand) ||
+                SOAPConstants.ATTR_MUSTUNDERSTAND_0.equals(mustUnderstand) ||
+                SOAPConstants.ATTR_MUSTUNDERSTAND_1.equals(mustUnderstand)) {
+            setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,
+                    mustUnderstand,
+                    SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+        } else {
+            throw new SOAPProcessingException(
+                    "mustUndertand should be one of \"true\", \"false\", \"0\" or \"1\" ");
+        }
+    }
+
+    /**
+     * Returns whether the mustUnderstand attribute for this
+     * <CODE>SOAPHeaderBlock</CODE> object is turned on.
+     *
+     * @return <CODE>true</CODE> if the mustUnderstand attribute of
+     *         this <CODE>SOAPHeaderBlock</CODE> object is turned on;
+     *         <CODE>false</CODE> otherwise
+     */
+    public boolean getMustUnderstand() throws SOAPProcessingException {
+        String mustUnderstand = "";
+        if ((mustUnderstand =
+                getAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,
+                        SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI))
+                != null) {
+            if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equalsIgnoreCase(
+                    mustUnderstand) ||
+                    SOAPConstants.ATTR_MUSTUNDERSTAND_1.equalsIgnoreCase(
+                            mustUnderstand)) {
+                return true;
+            } else if (SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equalsIgnoreCase(
+                    mustUnderstand) ||
+                    SOAPConstants.ATTR_MUSTUNDERSTAND_0.equalsIgnoreCase(
+                            mustUnderstand)) {
+                return false;
+            } else {
+                throw new SOAPProcessingException(
+                        "Invalid value found in mustUnderstand value of " +
+                        this.getLocalName() +
+                        " header block");
+            }
+        }
+        return false;
+
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11HeaderImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11HeaderImpl.java
new file mode 100644
index 0000000..56e0422
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11HeaderImpl.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap11;
+
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.om.impl.traverse.OMChildrenWithSpecificAttributeIterator;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPHeaderImpl;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+public class SOAP11HeaderImpl extends SOAPHeaderImpl {
+      
+    
+    /**
+     * @param envelope
+     */
+    public SOAP11HeaderImpl(SOAPEnvelope envelope, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(envelope, factory);
+    }
+
+    /**
+     * Constructor SOAPHeaderImpl
+     *
+     * @param envelope
+     * @param builder
+     */
+    public SOAP11HeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(envelope, builder, factory);
+    }
+
+    public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns)
+            throws OMException {
+        if (ns == null || ns.getNamespaceURI() == null || "".equals(ns.getNamespaceURI())) {
+            throw new OMException(
+                    "All the SOAP Header blocks should be namespace qualified");
+        }
+
+        OMNamespace namespace = findNamespace(ns.getNamespaceURI(), ns.getPrefix());
+        if (namespace != null) {
+            ns = namespace;
+        }
+
+        SOAPHeaderBlock soapHeaderBlock = null;
+        try {
+            soapHeaderBlock = new SOAP11HeaderBlockImpl(localName, ns, this,
+                    (SOAPFactory)this.factory);
+        } catch (SOAPProcessingException e) {
+            throw new OMException(e);
+        }
+        ((OMNodeEx)soapHeaderBlock).setComplete(true);
+        return soapHeaderBlock;
+    }
+
+    public Iterator extractHeaderBlocks(String role) {
+        return new OMChildrenWithSpecificAttributeIterator(getFirstOMChild(),
+                new QName(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+                        SOAP11Constants.ATTR_ACTOR),
+                role,
+                true);
+
+    }
+
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12BodyImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12BodyImpl.java
new file mode 100644
index 0000000..2f2cd6d
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12BodyImpl.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPBodyImpl;
+
+public class SOAP12BodyImpl extends SOAPBodyImpl {
+    /**
+     * @param envelope
+     */
+    public SOAP12BodyImpl(SOAPEnvelope envelope, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(envelope, factory);
+    }
+
+    /**
+     * Constructor SOAPBodyImpl
+     *
+     * @param envelope
+     * @param builder
+     */
+    public SOAP12BodyImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(envelope, builder, factory);
+    }
+
+    public SOAPFault addFault(Exception e) throws OMException {
+        SOAPFault soapFault = new SOAP12FaultImpl(this, e,
+                (SOAPFactory) this.factory);
+        this.hasSOAPFault = true;
+        return soapFault;
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java
new file mode 100644
index 0000000..6af9bb9
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java
@@ -0,0 +1,211 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.dom.DocumentImpl;
+import org.apache.axiom.om.impl.dom.NamespaceImpl;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAPFaultDetail;
+import org.apache.axiom.soap.SOAPFaultNode;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPFaultRole;
+import org.apache.axiom.soap.SOAPFaultSubCode;
+import org.apache.axiom.soap.SOAPFaultText;
+import org.apache.axiom.soap.SOAPFaultValue;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl;
+import org.apache.axiom.soap.impl.dom.factory.DOMSOAPFactory;
+
+public class SOAP12Factory extends DOMSOAPFactory {
+	
+	public SOAP12Factory() {}
+	
+	public SOAP12Factory(DocumentImpl doc) {
+		super(doc);
+	}
+	
+    public String getSoapVersionURI() {
+        return SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+    }
+
+    public SOAPEnvelope createSOAPEnvelope() {
+        return new SOAPEnvelopeImpl(
+                new NamespaceImpl(
+                        SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+                        SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX),
+                this);
+    }
+
+    public SOAPHeader createSOAPHeader(SOAPEnvelope envelope) throws SOAPProcessingException {
+        return new SOAP12HeaderImpl(envelope, this);
+    }
+
+    public SOAPHeader createSOAPHeader(SOAPEnvelope envelope,
+                                       OMXMLParserWrapper builder) {
+        return new SOAP12HeaderImpl(envelope, builder, this);
+    }
+
+    public SOAPHeaderBlock createSOAPHeaderBlock(String localName,
+                                                 OMNamespace ns,
+                                                 SOAPHeader parent) throws SOAPProcessingException {
+        return new SOAP12HeaderBlockImpl(localName, ns, parent, this);
+    }
+
+    public SOAPHeaderBlock createSOAPHeaderBlock(String localName,
+                                                 OMNamespace ns,
+                                                 SOAPHeader parent,
+                                                 OMXMLParserWrapper builder) throws SOAPProcessingException {
+        return new SOAP12HeaderBlockImpl(localName, ns, parent, builder, this);
+    }
+
+    public SOAPFault createSOAPFault(SOAPBody parent, Exception e) throws SOAPProcessingException {
+        return new SOAP12FaultImpl(parent, e, this);
+    }
+
+    public SOAPFault createSOAPFault(SOAPBody parent) throws SOAPProcessingException {
+        return new SOAP12FaultImpl(parent, this);
+    }
+
+    public SOAPFault createSOAPFault(SOAPBody parent,
+                                     OMXMLParserWrapper builder) {
+        return new SOAP12FaultImpl(parent, builder, this);
+    }
+
+    public SOAPBody createSOAPBody(SOAPEnvelope envelope) throws SOAPProcessingException {
+        return new SOAP12BodyImpl(envelope, this);
+    }
+
+    public SOAPBody createSOAPBody(SOAPEnvelope envelope,
+                                   OMXMLParserWrapper builder) {
+        return new SOAP12BodyImpl(envelope, builder, this);
+    }
+
+    public SOAPFaultCode createSOAPFaultCode(SOAPFault parent) throws SOAPProcessingException {
+        return new SOAP12FaultCodeImpl(parent, this);
+    }
+
+    public SOAPFaultCode createSOAPFaultCode(SOAPFault parent,
+                                             OMXMLParserWrapper builder) {
+        return new SOAP12FaultCodeImpl(parent, builder, this);
+    }
+
+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent) throws SOAPProcessingException {
+        return new SOAP12FaultValueImpl(parent, this);
+    }
+
+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent,
+                                               OMXMLParserWrapper builder) {
+        return new SOAP12FaultValueImpl(parent, builder, this);
+    }
+
+    //added
+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent) throws SOAPProcessingException {
+        return new SOAP12FaultValueImpl(parent, this);
+    }
+
+    //added
+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent,
+                                               OMXMLParserWrapper builder) {
+        return new SOAP12FaultValueImpl(parent, builder, this);
+    }
+
+    //changed
+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent) throws SOAPProcessingException {
+        return new SOAP12FaultSubCodeImpl(parent, this);
+    }
+
+    //changed
+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent,
+                                                   OMXMLParserWrapper builder) {
+        return new SOAP12FaultSubCodeImpl(parent, builder, this);
+    }
+
+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent) throws SOAPProcessingException {
+        return new SOAP12FaultSubCodeImpl(parent, this);
+    }
+
+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent,
+                                                   OMXMLParserWrapper builder) {
+        return new SOAP12FaultSubCodeImpl(parent, builder, this);
+    }
+
+    public SOAPFaultReason createSOAPFaultReason(SOAPFault parent) throws SOAPProcessingException {
+        return new SOAP12FaultReasonImpl(parent, this);
+    }
+
+    public SOAPFaultReason createSOAPFaultReason(SOAPFault parent,
+                                                 OMXMLParserWrapper builder) {
+        return new SOAP12FaultReasonImpl(parent, builder, this);
+    }
+
+    public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent) throws SOAPProcessingException {
+        return new SOAP12FaultTextImpl(parent, this);
+    }
+
+    public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent,
+                                             OMXMLParserWrapper builder) {
+        return new SOAP12FaultTextImpl(parent, builder, this);
+    }
+
+    public SOAPFaultNode createSOAPFaultNode(SOAPFault parent) throws SOAPProcessingException {
+        return new SOAP12FaultNodeImpl(parent, this);
+    }
+
+    public SOAPFaultNode createSOAPFaultNode(SOAPFault parent,
+                                             OMXMLParserWrapper builder) {
+        return new SOAP12FaultNodeImpl(parent, builder, this);
+    }
+
+    public SOAPFaultRole createSOAPFaultRole(SOAPFault parent) throws SOAPProcessingException {
+        return new SOAP12FaultRoleImpl(parent, this);
+    }
+
+    public SOAPFaultRole createSOAPFaultRole(SOAPFault parent,
+                                             OMXMLParserWrapper builder) {
+        return new SOAP12FaultRoleImpl(parent, builder, this);
+    }
+
+    public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent) throws SOAPProcessingException {
+        return new SOAP12FaultDetailImpl(parent, this);
+    }
+
+    public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent,
+                                                 OMXMLParserWrapper builder) {
+        return new SOAP12FaultDetailImpl(parent, builder, this);
+    }
+
+    public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException {
+        OMNamespace ns =
+                new NamespaceImpl(
+                        SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+                        SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX);
+        SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns, this);
+        createSOAPHeader(env);
+        createSOAPBody(env);
+
+        return env;
+    }
+
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultCodeImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultCodeImpl.java
new file mode 100644
index 0000000..51460d3
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultCodeImpl.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultSubCode;
+import org.apache.axiom.soap.SOAPFaultValue;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultCodeImpl;
+
+public class SOAP12FaultCodeImpl extends SOAPFaultCodeImpl {
+    /**
+     * Constructor OMElementImpl
+     *
+     * @param parent
+     * @param builder
+     */
+    public SOAP12FaultCodeImpl(SOAPFault parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    /**
+     * @param parent
+     */
+    public SOAP12FaultCodeImpl(SOAPFault parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, true, factory);
+    }
+
+
+    public void setSubCode(SOAPFaultSubCode subCode)
+            throws SOAPProcessingException {
+        if (!(subCode instanceof SOAP12FaultSubCodeImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault " +
+                    "Sub Code. But received some other implementation");
+        }
+        super.setSubCode(subCode);
+    }
+
+    public void setValue(SOAPFaultValue value) throws SOAPProcessingException {
+        if (!(value instanceof SOAP12FaultValueImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault Value. " +
+                    "But received some other implementation");
+        }
+        super.setValue(value);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12FaultImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault as " +
+                    "the parent. But received some other implementation");
+        }
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultDetailImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultDetailImpl.java
new file mode 100644
index 0000000..c7727f5
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultDetailImpl.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultDetailImpl;
+
+public class SOAP12FaultDetailImpl extends SOAPFaultDetailImpl {
+    
+    public SOAP12FaultDetailImpl(SOAPFault parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, true, factory);
+    }
+
+    public SOAP12FaultDetailImpl(SOAPFault parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12FaultImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault as the " +
+                    "parent. But received some other implementation");
+        }
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultImpl.java
new file mode 100644
index 0000000..4e8625e
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultImpl.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAPFaultDetail;
+import org.apache.axiom.soap.SOAPFaultNode;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPFaultRole;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultImpl;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class SOAP12FaultImpl extends SOAPFaultImpl {
+    public SOAP12FaultImpl(SOAPBody parent, Exception e, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, e, factory);
+    }
+
+    public SOAP12FaultImpl(SOAPBody parent, OMXMLParserWrapper builder,
+                           SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    /**
+     * This is a convenience method for the SOAP Fault Impl.
+     *
+     * @param parent
+     */
+    public SOAP12FaultImpl(SOAPBody parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, factory);
+    }
+
+    protected SOAPFaultDetail getNewSOAPFaultDetail(SOAPFault fault) {
+        return new SOAP12FaultDetailImpl(fault, (SOAPFactory)this.factory);
+
+    }
+
+    public void setCode(SOAPFaultCode soapFaultCode) throws SOAPProcessingException {
+        if (!(soapFaultCode instanceof SOAP12FaultCodeImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault Code. " +
+                    "But received some other implementation");
+        }
+        super.setCode(soapFaultCode);
+    }
+
+
+    public void setReason(SOAPFaultReason reason) throws SOAPProcessingException {
+        if (!(reason instanceof SOAP12FaultReasonImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault Reason. But received some other implementation");
+        }
+        super.setReason(reason);
+    }
+
+    public void setNode(SOAPFaultNode node) throws SOAPProcessingException {
+        if (!(node instanceof SOAP12FaultNodeImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault Node. But received some other implementation");
+        }
+        super.setNode(node);
+    }
+
+    public void setRole(SOAPFaultRole role) throws SOAPProcessingException {
+        if (!(role instanceof SOAP12FaultRoleImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault Role. But received some other implementation");
+        }
+        super.setRole(role);
+    }
+
+    public void setDetail(SOAPFaultDetail detail) throws SOAPProcessingException {
+        if (!(detail instanceof SOAP12FaultDetailImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault Detail. But received some other implementation");
+        }
+        super.setDetail(detail);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12BodyImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Body as the parent. But received some other implementation");
+        }
+    }
+
+    protected void serializeFaultNode(XMLStreamWriter writer) throws XMLStreamException {
+        SOAPFaultNode faultNode = getNode();
+        if (faultNode != null) {
+            (faultNode).serialize(writer);
+        }
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultNodeImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultNodeImpl.java
new file mode 100644
index 0000000..e5e1df0
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultNodeImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultNodeImpl;
+
+public class SOAP12FaultNodeImpl extends SOAPFaultNodeImpl {
+    public SOAP12FaultNodeImpl(SOAPFault parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, factory);
+    }
+
+    public SOAP12FaultNodeImpl(SOAPFault parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12FaultImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault as the " +
+                    "parent. But received some other implementation");
+        }
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultReasonImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultReasonImpl.java
new file mode 100644
index 0000000..68712d9
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultReasonImpl.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultText;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultReasonImpl;
+
+public class SOAP12FaultReasonImpl extends SOAPFaultReasonImpl {
+
+    public SOAP12FaultReasonImpl(SOAPFault parent, OMXMLParserWrapper builder,
+                                 SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    /**
+     * @param parent
+     */
+    public SOAP12FaultReasonImpl(SOAPFault parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, true, factory);
+    }
+
+    public void addSOAPText(SOAPFaultText soapFaultText)
+            throws SOAPProcessingException {
+        if (!(soapFaultText instanceof SOAP12FaultTextImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault Text. " +
+                    "But received some other implementation");
+        }
+        super.addSOAPText(soapFaultText);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12FaultImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault as the " +
+                    "parent. But received some other implementation");
+        }
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultRoleImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultRoleImpl.java
new file mode 100644
index 0000000..f9595de
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultRoleImpl.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultRoleImpl;
+
+public class SOAP12FaultRoleImpl extends SOAPFaultRoleImpl {
+    
+    public SOAP12FaultRoleImpl(SOAPFault parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME, true, factory);
+    }
+
+    public SOAP12FaultRoleImpl(SOAPFault parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12FaultImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault as the " +
+                    "parent. But received some other implementation");
+        }
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultSubCodeImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultSubCodeImpl.java
new file mode 100644
index 0000000..4e173fd
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultSubCodeImpl.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAPFaultSubCode;
+import org.apache.axiom.soap.SOAPFaultValue;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultSubCodeImpl;
+
+public class SOAP12FaultSubCodeImpl extends SOAPFaultSubCodeImpl {
+    //changed
+    public SOAP12FaultSubCodeImpl(SOAPFaultCode parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, factory);
+    }
+
+    //changed
+    public SOAP12FaultSubCodeImpl(SOAPFaultCode parent,
+                                  OMXMLParserWrapper builder,
+                                  SOAPFactory factory) {
+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder,
+                factory);
+    }
+
+    public SOAP12FaultSubCodeImpl(SOAPFaultSubCode parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, factory);
+    }
+
+    public SOAP12FaultSubCodeImpl(SOAPFaultSubCode parent,
+                                  OMXMLParserWrapper builder,
+                                  SOAPFactory factory) {
+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder,
+                factory);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!((parent instanceof SOAP12FaultSubCodeImpl) ||
+                (parent instanceof SOAP12FaultCodeImpl))) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP FaultSubCode " +
+                    "or SOAP FaultCodeValue as the parent. But received some " +
+                    "other implementation");
+        }
+    }
+
+    public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException {
+        if (!(subCode instanceof SOAP12FaultSubCodeImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault " +
+                    "Sub Code. But received some other implementation");
+        }
+        super.setSubCode(subCode);
+    }
+
+    public void setValue(SOAPFaultValue soapFaultSubCodeValue)
+            throws SOAPProcessingException {
+        if (!(soapFaultSubCodeValue instanceof SOAP12FaultValueImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault Value. " +
+                    "But received some other implementation");
+        }
+        super.setValue(soapFaultSubCodeValue);
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultTextImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultTextImpl.java
new file mode 100644
index 0000000..096eb4d
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultTextImpl.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultTextImpl;
+
+public class SOAP12FaultTextImpl extends SOAPFaultTextImpl {
+    
+    public SOAP12FaultTextImpl(SOAPFaultReason parent, SOAPFactory factory) throws SOAPProcessingException {
+        super(parent, factory);
+    }
+
+    public SOAP12FaultTextImpl(SOAPFaultReason parent,
+                               OMXMLParserWrapper builder,
+                               SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12FaultReasonImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP FaultReason " +
+                    "as the parent. But received some other implementation");
+        }
+    }
+}
\ No newline at end of file
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultValueImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultValueImpl.java
new file mode 100644
index 0000000..74a1f4b
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultValueImpl.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultValueImpl;
+
+public class SOAP12FaultValueImpl extends SOAPFaultValueImpl {
+    
+    public SOAP12FaultValueImpl(OMElement parent, SOAPFactory factory) throws SOAPProcessingException {
+        super(parent, factory);
+    }
+
+    public SOAP12FaultValueImpl(OMElement parent, OMXMLParserWrapper builder, SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!((parent instanceof SOAP12FaultSubCodeImpl) ||
+                (parent instanceof SOAP12FaultCodeImpl))) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP FaultSubCode or SOAP FaultCode as the parent. But received some other implementation");
+        }
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderBlockImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderBlockImpl.java
new file mode 100644
index 0000000..90fab1b
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderBlockImpl.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPConstants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPHeaderBlockImpl;
+
+public class SOAP12HeaderBlockImpl extends SOAPHeaderBlockImpl {
+    /**
+     * @param localName
+     * @param ns
+     */
+    public SOAP12HeaderBlockImpl(String localName,
+                                 OMNamespace ns,
+                                 SOAPHeader parent,
+                                 SOAPFactory factory) throws SOAPProcessingException {
+        super(localName, ns, parent, factory);
+        checkParent(parent);
+    }
+
+    /**
+     * Constructor SOAPHeaderBlockImpl
+     *
+     * @param localName
+     * @param ns
+     * @param parent
+     * @param builder
+     */
+    public SOAP12HeaderBlockImpl(String localName,
+                                 OMNamespace ns,
+                                 SOAPHeader parent,
+                                 OMXMLParserWrapper builder,
+                                 SOAPFactory factory) {
+        super(localName, ns, parent, builder, factory);
+
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12HeaderImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Body as the parent. But received some other implementation");
+        }
+    }
+
+    public void setRole(String roleURI) {
+        setAttribute(SOAP12Constants.SOAP_ROLE,
+                roleURI,
+                SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+    }
+
+    public String getRole() {
+        return getAttribute(SOAP12Constants.SOAP_ROLE,
+                SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+
+    }
+
+    public void setMustUnderstand(boolean mustUnderstand) {
+        setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,
+                mustUnderstand ? "1" : "0",
+                SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+
+    }
+
+    public void setMustUnderstand(String mustUnderstand) throws SOAPProcessingException {
+        if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equals(mustUnderstand) ||
+                SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equals(mustUnderstand) ||
+                SOAPConstants.ATTR_MUSTUNDERSTAND_0.equals(mustUnderstand) ||
+                SOAPConstants.ATTR_MUSTUNDERSTAND_1.equals(mustUnderstand)) {
+            setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,
+                    mustUnderstand,
+                    SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+        } else {
+            throw new SOAPProcessingException(
+                    "mustUndertand should be one of \"true\", \"false\", \"0\" or \"1\" ");
+        }
+    }
+
+    public boolean getMustUnderstand() throws SOAPProcessingException {
+        String mustUnderstand = "";
+        if ((mustUnderstand =
+                getAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,
+                        SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI))
+                != null) {
+            if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equalsIgnoreCase(
+                    mustUnderstand) ||
+                    SOAPConstants.ATTR_MUSTUNDERSTAND_1.equalsIgnoreCase(
+                            mustUnderstand)) {
+                return true;
+            } else if (SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equalsIgnoreCase(
+                    mustUnderstand) ||
+                    SOAPConstants.ATTR_MUSTUNDERSTAND_0.equalsIgnoreCase(
+                            mustUnderstand)) {
+                return false;
+            } else {
+                throw new SOAPProcessingException(
+                        "Invalid value found in mustUnderstand value of " +
+                        this.getLocalName() +
+                        " header block");
+            }
+        }
+        return false;
+
+    }
+}
diff --git a/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderImpl.java b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderImpl.java
new file mode 100644
index 0000000..13d733e
--- /dev/null
+++ b/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderImpl.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.om.impl.traverse.OMChildrenWithSpecificAttributeIterator;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPHeaderImpl;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+public class SOAP12HeaderImpl extends SOAPHeaderImpl {
+    /**
+     * @param envelope
+     */
+    public SOAP12HeaderImpl(SOAPEnvelope envelope, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(envelope, factory);
+    }
+
+    /**
+     * Constructor SOAPHeaderImpl
+     *
+     * @param envelope
+     * @param builder
+     */
+    public SOAP12HeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(envelope, builder, factory);
+    }
+
+    public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns) throws OMException {
+        if (ns == null || ns.getNamespaceURI() == null || "".equals(ns.getNamespaceURI())) {
+            throw new OMException(
+                    "All the SOAP Header blocks should be namespace qualified");
+        }
+
+        OMNamespace namespace = findNamespace(ns.getNamespaceURI(), ns.getPrefix());
+        if (namespace != null) {
+            ns = namespace;
+        }
+
+        SOAPHeaderBlock soapHeaderBlock = null;
+        try {
+            soapHeaderBlock = new SOAP12HeaderBlockImpl(localName, ns, this,
+                    (SOAPFactory)this.factory);
+        } catch (SOAPProcessingException e) {
+            throw new OMException(e);
+        }
+        ((OMNodeEx)soapHeaderBlock).setComplete(true);
+        return soapHeaderBlock;
+    }
+
+
+    public Iterator extractHeaderBlocks(String role) {
+        return new OMChildrenWithSpecificAttributeIterator(getFirstOMChild(),
+                new QName(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+                        SOAP12Constants.SOAP_ROLE),
+                role,
+                true);
+    }
+}
diff --git a/axiom/modules/axiom-impl/pom.xml b/axiom/modules/axiom-impl/pom.xml
new file mode 100644
index 0000000..ba75528
--- /dev/null
+++ b/axiom/modules/axiom-impl/pom.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+    xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.ws.commons.axiom</groupId>
+    <artifactId>axiom-parent</artifactId>
+    <version>SNAPSHOT</version> <!-- Should better be ${axiom.version} -->
+  </parent>
+  <artifactId>axiom-impl</artifactId>
+  <name>Axiom Impl</name>
+  <description>The Axiom default implementation.</description>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.ws.commons.axiom</groupId>
+      <artifactId>axiom-api</artifactId>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMAttributeImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMAttributeImpl.java
new file mode 100644
index 0000000..b5d189e
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMAttributeImpl.java
@@ -0,0 +1,136 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.llom;

+

+import org.apache.axiom.om.OMAttribute;

+import org.apache.axiom.om.OMFactory;

+import org.apache.axiom.om.OMNamespace;

+

+import javax.xml.namespace.QName;

+

+/**

+ * Class OMAttributeImpl

+ */

+public class OMAttributeImpl implements OMAttribute {

+    /**

+     * Field localName

+     */

+    private String localName;

+

+    /**

+     * Field value

+     */

+    private String value;

+

+    /**

+     * Field namespace

+     */

+    private OMNamespace namespace;

+    

+    /**

+     * <code>OMFactory</code> that created this <code>OMAttribute</code>

+     */

+    private OMFactory factory;

+

+    /**

+     * Constructor OMAttributeImpl.

+     *

+     * @param localName

+     * @param ns

+     * @param value

+     */

+    public OMAttributeImpl(String localName, OMNamespace ns, String value, 

+            OMFactory factory) {

+        setLocalName(localName);

+        setAttributeValue(value);

+        setOMNamespace(ns);

+        this.factory = factory;

+    }

+

+    /**

+     *

+     * @return Returns QName.

+     */

+    public QName getQName() {

+        if(namespace != null){

+            return new QName(namespace.getNamespaceURI(), localName, namespace.getPrefix());

+        }else{

+            return new QName(localName);

+        }

+    }

+

+    // -------- Getters and Setters

+

+    /**

+     * Method getLocalName.

+     *

+     * @return Returns local name.

+     */

+    public String getLocalName() {

+        return localName;

+    }

+

+    /**

+     * Method setLocalName.

+     *

+     * @param localName

+     */

+    public void setLocalName(String localName) {

+        this.localName = localName;

+    }

+

+    /**

+     * Method getAttributeValue.

+     *

+     * @return Returns value.

+     */

+    public String getAttributeValue() {

+        return value;

+    }

+

+    /**

+     * Method setAttributeValue.

+     *

+     * @param value

+     */

+    public void setAttributeValue(String value) {

+        this.value = value;

+    }

+

+    /**

+     * Method setOMNamespace.

+     *

+     * @param omNamespace

+     */

+    public void setOMNamespace(OMNamespace omNamespace) {

+        this.namespace = omNamespace;

+    }

+

+    /**

+     * Method getNamespace.

+     *

+     * @return Returns namespace.

+     */

+    public OMNamespace getNamespace() {

+        return namespace;

+    }

+

+    public OMFactory getOMFactory() {

+        return this.factory;

+    }

+    

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMCommentImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMCommentImpl.java
new file mode 100644
index 0000000..dec6e98
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMCommentImpl.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.llom;
+
+import org.apache.axiom.om.*;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class OMCommentImpl extends OMNodeImpl implements OMComment {
+    protected String value;
+
+    /**
+     * Constructor OMCommentImpl.
+     *
+     * @param parentNode
+     * @param contentText
+     */
+    public OMCommentImpl(OMContainer parentNode, String contentText, 
+            OMFactory factory) {
+        super(parentNode, factory, true);
+        this.value = contentText;
+        nodeType = OMNode.COMMENT_NODE;
+    }
+
+    /**
+     * Constructor OMCommentImpl.
+     *
+     * @param parentNode
+     */
+    public OMCommentImpl(OMContainer parentNode, OMFactory factory) {
+        this(parentNode, null, factory);
+    }
+
+    /**
+     * Serializes the node with caching.
+     *
+     * @param writer
+     * @throws XMLStreamException
+     */
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
+        writer.writeComment(this.value);
+    }
+
+    /**
+     * Serializes the node without caching.
+     *
+     * @param writer
+     * @throws XMLStreamException
+     */
+    public void internalSerializeAndConsume(XMLStreamWriter writer) throws XMLStreamException {
+        internalSerialize(writer);
+    }
+
+    /**
+     * Gets the value of this comment.
+     *
+     * @return Returns String.
+     */
+    public String getValue() {
+        return value;
+    }
+
+    /**
+     * Sets the value of this comment.
+     *
+     * @param text
+     */
+    public void setValue(String text) {
+        this.value = text;
+    }
+
+    /**
+     * Discards this node.
+     *
+     * @throws OMException
+     */
+    public void discard() throws OMException {
+        if (done) {
+            this.detach();
+        } else {
+            builder.discard((OMElement) this.parent);
+        }
+    }
+}
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java
new file mode 100644
index 0000000..296a446
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocTypeImpl.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.llom;
+
+import org.apache.axiom.om.*;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class OMDocTypeImpl extends OMNodeImpl implements OMDocType {
+    protected String value;
+
+    /**
+     * Constructor OMDocTypeImpl.
+     *
+     * @param parentNode
+     * @param contentText
+     */
+    public OMDocTypeImpl(OMContainer parentNode, String contentText, 
+            OMFactory factory) {
+        super(parentNode, factory, true);
+        this.value = contentText;
+        nodeType = OMNode.DTD_NODE;
+    }
+
+    /**
+     * Constructor OMDocTypeImpl.
+     *
+     * @param parentNode
+     */
+    public OMDocTypeImpl(OMContainer parentNode, OMFactory factory) {
+        this(parentNode, null, factory);
+    }
+
+    /**
+     * Serializes the node with caching.
+     *
+     * @param writer
+     * @throws XMLStreamException
+     */
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
+        writer.writeDTD(this.value);
+    }
+
+    /**
+     * Serializes the node without caching.
+     *
+     * @param writer
+     * @throws XMLStreamException
+     */
+    public void internalSerializeAndConsume(XMLStreamWriter writer) throws XMLStreamException {
+        internalSerialize(writer);
+    }
+
+    /**
+     * Gets the value of this DocType.
+     *
+     * @return Returns String.
+     */
+    public String getValue() {
+        return value;
+    }
+
+    /**
+     * Sets the value of this DocType.
+     *
+     * @param text
+     */
+    public void setValue(String text) {
+        this.value = text;
+    }
+
+    /**
+     * Discards this node.
+     *
+     * @throws OMException
+     */
+    public void discard() throws OMException {
+        if (done) {
+            this.detach();
+        } else {
+            builder.discard((OMElement) this.parent);
+        }
+    }
+}
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java
new file mode 100644
index 0000000..a207677
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java
@@ -0,0 +1,436 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.llom;
+
+import org.apache.axiom.om.*;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
+import org.apache.axiom.om.impl.OMContainerEx;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.om.impl.traverse.OMChildrenIterator;
+import org.apache.axiom.om.impl.traverse.OMChildrenQNameIterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.OutputStream;
+import java.util.Iterator;
+
+/**
+ * Class OMDocumentImpl
+ */
+public class OMDocumentImpl implements OMDocument, OMContainerEx {
+    /**
+     * Field documentElement
+     */
+    protected OMElement documentElement;
+
+    /**
+     * Field firstChild
+     */
+    protected OMNode firstChild;
+
+    /**
+     * Field lastChild
+     */
+    protected OMNode lastChild;
+
+    /**
+     * Field done
+     */
+    protected boolean done = false;
+
+    /**
+     * Field parserWrapper
+     */
+    protected OMXMLParserWrapper parserWrapper;
+
+    /**
+     * Field charSetEncoding
+     * Default : UTF-8
+     */
+    protected String charSetEncoding = "UTF-8";
+
+    /**
+     * Field xmlVersion
+     */
+    protected String xmlVersion = "1.0";
+
+    protected String isStandalone;
+
+    protected OMFactory factory;
+    
+    /**
+     * Default constructor
+     */
+    public OMDocumentImpl() {
+        this.done = true;
+    }
+
+    /**
+     * @param documentElement
+     * @param parserWrapper
+     */
+    public OMDocumentImpl(OMElement documentElement, OMXMLParserWrapper parserWrapper) {
+        this.documentElement = documentElement;
+        this.parserWrapper = parserWrapper;
+    }
+
+    /**
+     * @param parserWrapper
+     */
+    public OMDocumentImpl(OMXMLParserWrapper parserWrapper) {
+        this.parserWrapper = parserWrapper;
+    }
+
+    /**
+     * Create a <code>OMDocument</code> given the <code>OMFactory</code>
+     * @param factory The <code>OMFactory</code> that created this instace
+     */
+    public OMDocumentImpl(OMFactory factory) {
+        this();
+        this.factory = factory;
+    }
+
+    /**
+     * Create the <code>OMDocument</code> with the factory
+     * @param parserWrapper
+     * @param factory
+     */
+    public OMDocumentImpl(OMXMLParserWrapper parserWrapper, OMFactory factory) {
+        this(parserWrapper);
+        this.factory = factory;
+    }
+    
+    /**
+     * Create the <code>OMDoucment</code> with the factory and set the given 
+     * <code>OMElement</code> as the document element
+     * @param documentElement
+     * @param parserWrapper
+     * @param factory
+     */
+    public OMDocumentImpl(OMElement documentElement, OMXMLParserWrapper parserWrapper, OMFactory factory) {
+        this(documentElement, parserWrapper);
+        this.factory = factory;
+    }
+
+    
+    /**
+     * Method getDocumentElement.
+     *
+     * @return Returns OMElement.
+     */
+    public OMElement getOMDocumentElement() {
+        while (documentElement == null) {
+            parserWrapper.next();
+        }
+        return documentElement;
+    }
+
+    /**
+     * Method setDocumentElement.
+     *
+     * @param documentElement
+     */
+    public void setOMDocumentElement(OMElement documentElement) {
+        this.documentElement = documentElement;
+    }
+
+    /**
+     * Indicates whether parser has parsed this information item completely or not.
+     * If some information is not available in the item, one has to check this 
+     * attribute to make sure that, this item has been parsed completely or not.
+     *
+     * @return Returns boolean.
+     */
+    public boolean isComplete() {
+        return done;
+    }
+
+    /**
+     * Method setComplete.
+     *
+     * @param state
+     */
+    public void setComplete(boolean state) {
+        this.done = state;
+    }
+
+    /**
+     * Forces the parser to proceed, if parser has not yet finished with the XML input.
+     */
+    public void buildNext() {
+        if (!parserWrapper.isCompleted())
+            parserWrapper.next();
+    }
+
+    /**
+     * Adds child to the element. One can decide whether to append the child or to add to the
+     * front of the children list.
+     *
+     * @param child
+     */
+    public void addChild(OMNode child) {
+    	if(child instanceof OMElement) {
+    		if(this.documentElement == null) {
+    			addChild((OMNodeImpl) child);
+    			this.documentElement = (OMElement)child;
+    		} else {
+    			throw new OMException("Document element already exists");
+    		}
+    	} else {
+    		addChild((OMNodeImpl) child);
+    	}
+    }
+
+    /**
+     * Method addChild.
+     *
+     * @param child
+     */
+    private void addChild(OMNodeImpl child) {
+        if (firstChild == null) {
+            firstChild = child;
+            child.setPreviousOMSibling(null);
+        } else {
+            child.setPreviousOMSibling(lastChild);
+            ((OMNodeEx)lastChild).setNextOMSibling(child);
+        }
+        child.setNextOMSibling(null);
+        child.setParent(this);
+        lastChild = child;
+
+    }
+
+    /**
+     * Returns a collection of this element.
+     * Children can be of types OMElement, OMText.
+     *
+     * @return Returns iterator.
+     */
+    public Iterator getChildren() {
+        return new OMChildrenIterator(getFirstOMChild());
+    }
+
+    /**
+     * Searches for children with a given QName and returns an iterator to traverse through
+     * the OMNodes.
+     * The QName can contain any combination of prefix, localname and URI.
+     *
+     * @param elementQName
+     * @return Returns Iterator.
+     * @throws org.apache.axiom.om.OMException
+     */
+    public Iterator getChildrenWithName(QName elementQName) {
+        return new OMChildrenQNameIterator(getFirstOMChild(),
+                elementQName);
+    }
+
+    /**
+     * Method getFirstOMChild.
+     *
+     * @return Returns first om child.
+     */
+    public OMNode getFirstOMChild() {
+        while ((firstChild == null) && !done) {
+            buildNext();
+        }
+        return firstChild;
+    }
+
+    /**
+     * Method getFirstChildWithName.
+     *
+     * @param elementQName
+     * @return Returns OMElement.
+     * @throws OMException
+     */
+    public OMElement getFirstChildWithName(QName elementQName) throws OMException {
+        OMChildrenQNameIterator omChildrenQNameIterator =
+                new OMChildrenQNameIterator(getFirstOMChild(),
+                        elementQName);
+        OMNode omNode = null;
+        if (omChildrenQNameIterator.hasNext()) {
+            omNode = (OMNode) omChildrenQNameIterator.next();
+        }
+
+        return ((omNode != null) && (OMNode.ELEMENT_NODE == omNode.getType())) ?
+                (OMElement) omNode : null;
+
+    }
+
+    /**
+     * Method setFirstChild.
+     *
+     * @param firstChild
+     */
+    public void setFirstChild(OMNode firstChild) {
+        this.firstChild = firstChild;
+    }
+
+
+    /**
+     * Returns the character set encoding scheme to be used.
+     *
+     * @return Returns charset.
+     */
+    public String getCharsetEncoding() {
+        return charSetEncoding;
+    }
+
+    /**
+     * Sets the character set encoding scheme.
+     *
+     * @param charEncoding
+     */
+    public void setCharsetEncoding(String charEncoding) {
+        this.charSetEncoding = charEncoding;
+    }
+
+    public String isStandalone() {
+        return isStandalone;
+    }
+
+    public void setStandalone(String isStandalone) {
+        this.isStandalone = isStandalone;
+    }
+
+    public String getXMLVersion() {
+        return xmlVersion;
+    }
+
+    public void setXMLVersion(String xmlVersion) {
+        this.xmlVersion = xmlVersion;
+    }
+
+    /**
+     * Serialize the docuement with/without the XML declaration
+     */
+    public void internalSerializeAndConsume(XMLStreamWriter writer, boolean includeXMLDeclaration) throws XMLStreamException {
+        internalSerialize(writer, false, includeXMLDeclaration);
+    }
+
+    /**
+     * Serializes the document with the XML declaration.
+     */
+    public void internalSerializeAndConsume(XMLStreamWriter writer)
+            throws XMLStreamException {
+        internalSerialize(writer, false, !((MTOMXMLStreamWriter)writer).isIgnoreXMLDeclaration());
+    }
+
+
+    /**
+     * Serializes the document with cache.
+     */
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
+        internalSerialize(writer, true, !((MTOMXMLStreamWriter)writer).isIgnoreXMLDeclaration());
+
+    }
+
+    /**
+     * Serializes the document directly to the output stream with caching disabled.
+     * 
+     * @param output
+     * @throws XMLStreamException
+     */
+    public void serializeAndConsume(OutputStream output) throws XMLStreamException {
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, new OMOutputFormat());
+        internalSerializeAndConsume(writer);
+        writer.flush();
+    }
+
+    /**
+     * Serializes the document directly to the output stream with caching enabled.
+     * 
+     * @param output
+     * @throws XMLStreamException
+     */
+    public void serialize(OutputStream output) throws XMLStreamException {
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, new OMOutputFormat());
+        internalSerialize(writer);
+        writer.flush();
+    }
+
+    /**
+     * Serializes the document directly to the output stream with caching disabled.
+     * 
+     * @param output
+     * @param format
+     * @throws XMLStreamException
+     */
+    public void serializeAndConsume(OutputStream output, OMOutputFormat format) throws XMLStreamException {
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format);
+        internalSerializeAndConsume(writer);
+        writer.flush();
+    }
+
+    /**
+     * Serializes the document directly to the output stream with caching enabled.
+     * 
+     * @param output
+     * @param format
+     * @throws XMLStreamException
+     */
+    public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format);
+        internalSerialize(writer);
+        writer.flush();
+    }
+
+    /**
+     * Serializes the document with cache.
+     */
+    public void internalSerialize(XMLStreamWriter writer, boolean includeXMLDeclaration) throws XMLStreamException {
+        internalSerialize(writer, true, includeXMLDeclaration);
+
+    }
+
+    protected void internalSerialize(XMLStreamWriter writer2, boolean cache, boolean includeXMLDeclaration) throws XMLStreamException {
+        MTOMXMLStreamWriter writer = (MTOMXMLStreamWriter) writer2;
+        if (includeXMLDeclaration) {
+            //Check whether the OMOutput char encoding and OMDocument char
+            //encoding matches, if not use char encoding of OMOutput
+            String outputCharEncoding = writer.getCharSetEncoding();
+            if (outputCharEncoding == null || "".equals(outputCharEncoding)) {
+                writer.getXmlStreamWriter().writeStartDocument(charSetEncoding,
+                        xmlVersion);
+            } else {
+                writer.getXmlStreamWriter().writeStartDocument(outputCharEncoding,
+                        xmlVersion);
+            }
+        }
+
+        Iterator children = this.getChildren();
+
+        if (cache) {
+            while (children.hasNext()) {
+                OMNodeEx omNode = (OMNodeEx) children.next();
+                omNode.internalSerialize(writer);
+            }
+        } else {
+            while (children.hasNext()) {
+                OMNodeEx omNode = (OMNodeEx) children.next();
+                omNode.internalSerializeAndConsume(writer);
+            }
+        }
+    }
+
+    public OMFactory getOMFactory() {
+        return this.getOMDocumentElement().getOMFactory();
+    }
+
+
+}
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
new file mode 100644
index 0000000..f26e07d
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
@@ -0,0 +1,1005 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.llom;
+
+import org.apache.axiom.om.*;
+import org.apache.axiom.om.impl.OMContainerEx;
+import org.apache.axiom.om.impl.OMNamespaceImpl;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.impl.llom.factory.OMLinkedListImplFactory;
+import org.apache.axiom.om.impl.traverse.OMChildElementIterator;
+import org.apache.axiom.om.impl.traverse.OMChildrenIterator;
+import org.apache.axiom.om.impl.traverse.OMChildrenQNameIterator;
+import org.apache.axiom.om.impl.util.EmptyIterator;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.om.util.ElementHelper;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.ByteArrayOutputStream;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+
+/**
+ * Class OMElementImpl
+ */
+public class OMElementImpl extends OMNodeImpl
+        implements OMElement, OMConstants, OMContainerEx {
+
+    public static final OMNamespace DEFAULT_DEFAULT_NS_OBJECT = new OMNamespaceImpl("", "");
+
+    /**
+     * Field ns
+     */
+    protected OMNamespace ns;
+
+    /**
+     * Field localName
+     */
+    protected String localName;
+    /**
+     * Field firstChild
+     */
+    protected OMNode firstChild;
+
+    /**
+     * Field namespaces
+     */
+    protected HashMap namespaces = null;
+
+    /**
+     * Field attributes
+     */
+    protected HashMap attributes = null;
+
+    /**
+     * Field noPrefixNamespaceCounter
+     */
+    protected int noPrefixNamespaceCounter = 0;
+    protected OMNode lastChild;
+    private int lineNumber;
+    private static final EmptyIterator EMPTY_ITERATOR = new EmptyIterator();
+
+    /**
+     * Constructor OMElementImpl.
+     * A null namespace indicates that the default namespace in scope is used
+     */
+    public OMElementImpl(String localName, OMNamespace ns, OMContainer parent,
+                         OMXMLParserWrapper builder, OMFactory factory) {
+        super(parent, factory, false);
+        this.localName = localName;
+        if (ns != null) {
+            setNamespace(ns);
+        }
+        this.builder = builder;
+        firstChild = null;
+    }
+
+
+    /**
+     * Constructor OMElementImpl.
+     */
+    public OMElementImpl(String localName, OMNamespace ns, OMFactory factory) {
+        this(localName, ns, null, factory);
+    }
+
+    /**
+     * This is the basic constructor for OMElement. All the other constructors
+     * depends on this.
+     *
+     * @param localName - this MUST always be not null
+     * @param ns        - can be null
+     * @param parent    - this should be an OMContainer
+     * @param factory   - factory that created this OMElement
+     *                  <p/>
+     *                  A null namespace indicates that the default namespace in scope is used
+     */
+    public OMElementImpl(String localName, OMNamespace ns, OMContainer parent,
+                         OMFactory factory) {
+        super(parent, factory, true);
+        if (localName == null || localName.trim().length() == 0) {
+            throw new OMException("localname can not be null or empty");
+        }
+        this.localName = localName;
+        if (ns != null) {
+            setNamespace(ns);
+        }
+    }
+
+    /**
+     * It is assumed that the QName passed contains, at least, the localName for this element.
+     *
+     * @param qname - this should be valid qname according to javax.xml.namespace.QName
+     * @throws OMException
+     */
+    public OMElementImpl(QName qname, OMContainer parent, OMFactory factory)
+            throws OMException {
+        this(qname.getLocalPart(), null, parent, factory);
+        this.ns = handleNamespace(qname);
+    }
+
+    /**
+     * Method handleNamespace.
+     */
+    OMNamespace handleNamespace(QName qname) {
+        OMNamespace ns = null;
+
+        // first try to find a namespace from the scope
+        String namespaceURI = qname.getNamespaceURI();
+        if (namespaceURI != null && namespaceURI.length() > 0) {
+            ns = findNamespace(qname.getNamespaceURI(),
+                    qname.getPrefix());
+
+            /**
+             * What is left now is
+             *  1. nsURI = null & parent != null, but ns = null
+             *  2. nsURI != null, (parent doesn't have an ns with given URI), but ns = null
+             */
+            if (ns == null) {
+                String prefix = qname.getPrefix();
+                if ("".equals(prefix)) {
+                    prefix = OMSerializerUtil.getNextNSPrefix();
+                }
+                ns = declareNamespace(namespaceURI, prefix);
+            }
+            if (ns != null) {
+                this.ns = ns;
+            }
+        }
+        return ns;
+    }
+
+    /**
+     * Method handleNamespace.
+     *
+     * @return Returns namespace.
+     */
+    private OMNamespace handleNamespace(OMNamespace ns) {
+        OMNamespace namespace = findNamespace(ns.getNamespaceURI(),
+                ns.getPrefix());
+        if (namespace == null) {
+            namespace = declareNamespace(ns);
+        }
+        return namespace;
+    }
+
+    /**
+     * Adds child to the element. One can decide whether to append the child or to add to the
+     * front of the children list.
+     */
+    public void addChild(OMNode child) {
+		if (child.getOMFactory() instanceof OMLinkedListImplFactory) {
+			addChild((OMNodeImpl) child);
+		} else {
+			addChild(importNode(child));
+		}
+    }
+    
+
+    /**
+     * Searches for children with a given QName and returns an iterator to traverse through
+     * the OMNodes.
+     * This QName can contain any combination of prefix, localname and URI.
+     *
+     * @throws OMException
+     */
+    public Iterator getChildrenWithName(QName elementQName) {
+        return new OMChildrenQNameIterator(getFirstOMChild(),
+                elementQName);
+    }
+
+    /**
+     * Method getFirstChildWithName.
+     *
+     * @throws OMException
+     */
+    public OMElement getFirstChildWithName(QName elementQName) throws OMException {
+        OMChildrenQNameIterator omChildrenQNameIterator =
+                new OMChildrenQNameIterator(getFirstOMChild(),
+                        elementQName);
+        OMNode omNode = null;
+        if (omChildrenQNameIterator.hasNext()) {
+            omNode = (OMNode) omChildrenQNameIterator.next();
+        }
+
+        return ((omNode != null) && (OMNode.ELEMENT_NODE == omNode.getType())) ?
+                (OMElement) omNode : null;
+
+    }
+
+    /**
+     * Method addChild.
+     */
+    private void addChild(OMNodeImpl child) {
+        //the order of these statements is VERY important
+        //Since setting the parent has a detach method inside
+        //it strips down all the rerefences to siblings.
+        //setting the siblings should take place AFTER setting the parent
+
+        child.setParent(this);
+
+        if (firstChild == null) {
+            firstChild = child;
+            child.previousSibling = null;
+        } else {
+            child.previousSibling = (OMNodeImpl) lastChild;
+            ((OMNodeImpl) lastChild).nextSibling = child;
+        }
+
+        child.nextSibling = null;
+        lastChild = child;
+
+        if (!child.isComplete()) {
+            this.setComplete(false);
+        }
+
+    }
+
+    /**
+     * Gets the next sibling. This can be an OMAttribute or OMText or
+     * OMELement for others.
+     *
+     * @throws OMException
+     */
+    public OMNode getNextOMSibling() throws OMException {
+        while (!done && builder != null) {
+            int token = builder.next();
+            if (token == XMLStreamConstants.END_DOCUMENT) {
+                throw new OMException("Parser has already reached end of the document. No siblings found");
+            }
+        }
+        return super.getNextOMSibling();
+    }
+
+    /**
+     * Returns a collection of this element. Children can be of types OMElement, OMText.
+     *
+     * @return Returns children.
+     */
+    public Iterator getChildren() {
+        return new OMChildrenIterator(getFirstOMChild());
+    }
+
+    /**
+     * Returns a filtered list of children - just the elements.
+     *
+     * @return Returns an iterator of the child elements.
+     */
+    public Iterator getChildElements() {
+        return new OMChildElementIterator(getFirstElement());
+    }
+
+    /**
+     * Creates a namespace in the current element scope.
+     *
+     * @return Returns namespace.
+     */
+    public OMNamespace declareNamespace(String uri, String prefix) {
+        if ("".equals(prefix))
+            prefix = OMSerializerUtil.getNextNSPrefix();
+        OMNamespaceImpl ns = new OMNamespaceImpl(uri, prefix);
+        return declareNamespace(ns);
+    }
+
+    /**
+     * We use "" to store the default namespace of this element. As one can see user can not give ""
+     * as the prefix, when he declare a usual namespace.
+     *
+     * @param uri
+     */
+    public OMNamespace declareDefaultNamespace(String uri) {
+
+        OMNamespaceImpl namespace = new OMNamespaceImpl(uri == null ? "" : uri, "");
+
+        if (namespaces == null) {
+            this.namespaces = new HashMap(5);
+        }
+        namespaces.put("", namespace);
+        return namespace;
+    }
+
+    public OMNamespace getDefaultNamespace() {
+        OMNamespace defaultNS;
+        if (namespaces != null && (defaultNS = (OMNamespace) namespaces.get("")) != null) {
+            return defaultNS;
+        }
+        if (parent instanceof OMElementImpl) {
+            return ((OMElementImpl) parent).getDefaultNamespace();
+
+        }
+        return null;
+    }
+
+    /**
+     * @return Returns namespace.
+     */
+    public OMNamespace declareNamespace(OMNamespace namespace) {
+        if (namespaces == null) {
+            this.namespaces = new HashMap(5);
+        }
+        String prefix = namespace.getPrefix();
+        if (prefix == null) {
+            prefix = OMSerializerUtil.getNextNSPrefix();
+            namespace = new OMNamespaceImpl(namespace.getNamespaceURI(), prefix);
+        }
+        namespaces.put(prefix, namespace);
+        return namespace;
+    }
+
+    /**
+     * Finds a namespace with the given uri and prefix, in the scope of the document.
+     * Starts to find from the current element and goes up in the hiararchy until one is found.
+     * If none is found, returns null.
+     */
+    public OMNamespace findNamespace(String uri, String prefix) {
+
+        // check in the current element
+        OMNamespace namespace = findDeclaredNamespace(uri, prefix);
+        if (namespace != null) {
+            return namespace;
+        }
+
+        // go up to check with ancestors
+        if (parent != null) {
+            //For the OMDocumentImpl there won't be any explicit namespace
+            //declarations, so going up the parent chain till the document
+            //element should be enough.
+            if (parent instanceof OMElement) {
+                namespace = ((OMElementImpl) parent).findNamespace(uri, prefix);
+            }
+        }
+
+        return namespace;
+    }
+
+    public OMNamespace findNamespaceURI(String prefix) {
+        OMNamespace ns = this.namespaces == null ?
+                null :
+                (OMNamespace) this.namespaces.get(prefix);
+
+        if (ns == null && this.parent instanceof OMElement) {
+            // try with the parent
+            ns = ((OMElement) this.parent).findNamespaceURI(prefix);
+        }
+        return ns;
+    }
+
+    // Constant
+    static final OMNamespaceImpl xmlns =
+            new OMNamespaceImpl(OMConstants.XMLNS_URI,
+                    OMConstants.XMLNS_PREFIX);
+
+    /**
+     * Checks for the namespace <B>only</B> in the current Element.
+     * This is also used to retrieve the prefix of a known namespace URI.
+     */
+    private OMNamespace findDeclaredNamespace(String uri, String prefix) {
+        if (uri == null) {
+            return null;
+        }
+
+        //If the prefix is available and uri is available and its the xml namespace
+        if (prefix != null && prefix.equals(OMConstants.XMLNS_PREFIX) && uri.equals(OMConstants.XMLNS_URI)) {
+            return xmlns;
+        }
+
+        if (namespaces == null) {
+            return null;
+        }
+
+        if (prefix == null || "".equals(prefix)) {
+
+            OMNamespace defaultNamespace = this.getDefaultNamespace();
+            if (defaultNamespace != null && uri.equals(defaultNamespace.getNamespaceURI())) {
+                return defaultNamespace;
+            }
+            Iterator namespaceListIterator = namespaces.values().iterator();
+
+            String nsUri;
+
+            while (namespaceListIterator.hasNext()) {
+                OMNamespace omNamespace =
+                        (OMNamespace) namespaceListIterator.next();
+                nsUri = omNamespace.getNamespaceURI();
+                if (nsUri != null &&
+                        nsUri.equals(uri)) {
+                    return omNamespace;
+                }
+            }
+        } else {
+            OMNamespace namespace = (OMNamespace) namespaces.get(prefix);
+            if (namespace != null && uri.equalsIgnoreCase(namespace.getNamespaceURI())) {
+                return namespace;
+            }
+        }
+        return null;
+    }
+
+
+    /**
+     * Method getAllDeclaredNamespaces.
+     *
+     * @return Returns Iterator.
+     */
+    public Iterator getAllDeclaredNamespaces() {
+        if (namespaces == null) {
+            return EMPTY_ITERATOR;
+        }
+        return namespaces.values().iterator();
+    }
+
+    /**
+     * Returns a List of OMAttributes.
+     *
+     * @return Returns iterator.
+     */
+    public Iterator getAllAttributes() {
+        if (attributes == null) {
+            return EMPTY_ITERATOR;
+        }
+        return attributes.values().iterator();
+    }
+
+    /**
+     * Returns a named attribute if present.
+     *
+     * @param qname the qualified name to search for
+     * @return Returns an OMAttribute with the given name if found, or null
+     */
+    public OMAttribute getAttribute(QName qname) {
+        return attributes == null ? null : (OMAttribute) attributes.get(qname);
+    }
+
+    /**
+     * Returns a named attribute's value, if present.
+     *
+     * @param qname the qualified name to search for
+     * @return Returns a String containing the attribute value, or null.
+     */
+    public String getAttributeValue(QName qname) {
+        OMAttribute attr = getAttribute(qname);
+        return (attr == null) ? null : attr.getAttributeValue();
+    }
+
+    /**
+     * Inserts an attribute to this element. Implementor can decide as to insert this
+     * in the front or at the end of set of attributes.
+     *
+     * @return Returns attribute.
+     */
+    public OMAttribute addAttribute(OMAttribute attr) {
+        if (attributes == null) {
+            this.attributes = new LinkedHashMap(5);
+        }
+        OMNamespace namespace = attr.getNamespace();
+        if (namespace != null && this.findNamespace(namespace.getNamespaceURI(), namespace.getPrefix()) == null) {
+            this.declareNamespace(namespace.getNamespaceURI(), namespace.getPrefix());
+        }
+
+        attributes.put(attr.getQName(), attr);
+        return attr;
+    }
+
+    /**
+     * Method removeAttribute.
+     */
+    public void removeAttribute(OMAttribute attr) {
+        if (attributes != null) {
+            attributes.remove(attr.getQName());
+        }
+    }
+
+    /**
+     * Method addAttribute.
+     *
+     * @return Returns OMAttribute.
+     */
+    public OMAttribute addAttribute(String attributeName, String value,
+                                    OMNamespace ns) {
+        OMNamespace namespace;
+        if (ns != null) {
+            namespace = findNamespace(ns.getNamespaceURI(), ns.getPrefix());
+            if (namespace == null) {
+                throw new OMException("Given OMNamespace(" + ns.getNamespaceURI() + " " +
+                        ns.getPrefix()
+                        + ") for "
+                        +
+                        "this attribute is not declared in the scope of this element. First declare the namespace"
+                        + " and then use it with the attribute");
+            }
+        }
+        return addAttribute(new OMAttributeImpl(attributeName, ns, value, this.factory));
+    }
+
+    /**
+     * Method setBuilder.
+     */
+    public void setBuilder(OMXMLParserWrapper wrapper) {
+        this.builder = wrapper;
+    }
+
+    /**
+     * Method getBuilder.
+     *
+     * @return Returns OMXMLParserWrapper.
+     */
+    public OMXMLParserWrapper getBuilder() {
+        return builder;
+    }
+
+    /**
+     * Forces the parser to proceed, if parser has not yet finished with the XML input.
+     */
+    public void buildNext() {
+        if (builder != null) {
+            builder.next();
+        }
+    }
+
+    /**
+     * Method getFirstOMChild.
+     *
+     * @return Returns child.
+     */
+    public OMNode getFirstOMChild() {
+        while ((firstChild == null) && !done) {
+            buildNext();
+        }
+        return firstChild;
+    }
+
+    /**
+     * Method setFirstChild.
+     */
+    public void setFirstChild(OMNode firstChild) {
+        if (firstChild != null) {
+            ((OMNodeEx) firstChild).setParent(this);
+        }
+        this.firstChild = firstChild;
+    }
+
+    /**
+     * Removes this information item and its children, from the model completely.
+     *
+     * @throws OMException
+     */
+    public OMNode detach() throws OMException {
+        if (!done) {
+            build();
+        }
+        super.detach();
+        return this;
+    }
+
+    /**
+     * Method isComplete.
+     *
+     * @return Returns boolean.
+     */
+    public boolean isComplete() {
+        return done;
+    }
+
+    /**
+     * Gets the type of node, as this is the super class of all the nodes.
+     */
+    public int getType() {
+        return OMNode.ELEMENT_NODE;
+    }
+
+    public void build() throws OMException {
+        /**
+         * builder is null. Meaning this is a programatical created element but it has children which are not completed
+         * Build them all.
+         */
+        if (builder == null && !done) {
+            for (Iterator childrenIterator = this.getChildren(); childrenIterator.hasNext();) {
+                OMNode omNode = (OMNode) childrenIterator.next();
+                omNode.build();
+            }
+        } else {
+            super.build();
+        }
+
+    }
+
+    /**
+     * Method getXMLStreamReader.
+     *
+     * @see OMElement#getXMLStreamReader()
+     */
+    public XMLStreamReader getXMLStreamReader() {
+        return getXMLStreamReader(true);
+    }
+
+    /**
+     * Method getXMLStreamReaderWithoutCaching.
+     *
+     * @see OMElement#getXMLStreamReaderWithoutCaching()
+     */
+    public XMLStreamReader getXMLStreamReaderWithoutCaching() {
+        return getXMLStreamReader(false);
+    }
+
+    /**
+     * Method getXMLStreamReader.
+     *
+     * @return Returns reader.
+     */
+    private XMLStreamReader getXMLStreamReader(boolean cache) {
+        if ((builder == null) && !cache) {
+            throw new UnsupportedOperationException(
+                    "This element was not created in a manner to be switched");
+        }
+        if (builder != null && builder.isCompleted() && !cache) {
+            throw new UnsupportedOperationException(
+                    "The parser is already consumed!");
+        }
+        return new OMStAXWrapper(builder, this, cache);
+    }
+
+    /**
+     * Sets the text of the given element.
+     * caution - This method will wipe out all the text elements (and hence any
+     * mixed content) before setting the text.
+     */
+    public void setText(String text) {
+
+        OMNode child = this.getFirstOMChild();
+        while (child != null) {
+            if (child.getType() == OMNode.TEXT_NODE) {
+                child.detach();
+            }
+            child = child.getNextOMSibling();
+        }
+
+        OMAbstractFactory.getOMFactory().createOMText(this, text);
+    }
+
+    /**
+     * Sets the text, as a QName, of the given element.
+     * caution - This method will wipe out all the text elements (and hence any
+     * mixed content) before setting the text.
+     */
+    public void setText(QName text) {
+
+        OMNode child = this.getFirstOMChild();
+        while (child != null) {
+            if (child.getType() == OMNode.TEXT_NODE) {
+                child.detach();
+            }
+            child = child.getNextOMSibling();
+        }
+
+        OMAbstractFactory.getOMFactory().createOMText(this, text);
+    }
+
+    /**
+     * Selects all the text children and concatinates them to a single string.
+     *
+     * @return Returns String.
+     */
+    public String getText() {
+        String childText = "";
+        OMNode child = this.getFirstOMChild();
+        OMText textNode;
+
+        while (child != null) {
+            if (child.getType() == OMNode.TEXT_NODE) {
+                textNode = (OMText) child;
+                if (textNode.getText() != null &&
+                        !"".equals(textNode.getText())) {
+                    childText += textNode.getText();
+                }
+            }
+            child = child.getNextOMSibling();
+        }
+
+        return childText;
+    }
+
+    public QName getTextAsQName() {
+        String childText = "";
+        OMNode child = this.getFirstOMChild();
+        OMText textNode;
+
+        while (child != null) {
+            if (child.getType() == OMNode.TEXT_NODE) {
+                textNode = (OMText) child;
+                if (textNode.getText() != null &&
+                        !"".equals(textNode.getText())) {
+                    String namespaceURI = textNode.getTextAsQName().getNamespaceURI();
+                    if (namespaceURI != null && !"".equals(namespaceURI)) {
+                        return textNode.getTextAsQName();
+                    }
+                    childText += textNode.getText();
+                }
+            }
+            child = child.getNextOMSibling();
+        }
+
+        return new QName(childText);
+    }
+
+    /**
+     * Returns the concatination string of TRIMMED values of all
+     * OMText  child nodes of this element.
+     * This is included purely to improve usability.
+     */
+    public String getTrimmedText() {
+        String childText = "";
+        OMNode child = this.getFirstOMChild();
+        OMText textNode;
+
+        while (child != null) {
+            if (child.getType() == OMNode.TEXT_NODE) {
+                textNode = (OMText) child;
+                if (textNode.getText() != null &&
+                        !"".equals(textNode.getText().trim())) {
+                    childText += textNode.getText().trim();
+                }
+            }
+            child = child.getNextOMSibling();
+        }
+
+        return childText;
+    }
+
+    /**
+     * Method internalSerialize.
+     *
+     * @throws XMLStreamException
+     */
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
+        internalSerialize(writer, true);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////
+
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException {
+
+        if (cache) {
+            //in this case we don't care whether the elements are built or not
+            //we just call the serializeAndConsume methods
+            OMSerializerUtil.serializeStartpart(this, writer);
+            //serialize children
+            Iterator children = this.getChildren();
+            while (children.hasNext()) {
+                ((OMNodeEx) children.next()).internalSerialize(writer);
+            }
+            OMSerializerUtil.serializeEndpart(writer);
+
+        } else {
+            //Now the caching is supposed to be off. However caching been switched off
+            //has nothing to do if the element is already built!
+            if (this.done || (this.builder == null)) {
+                OMSerializerUtil.serializeStartpart(this, writer);
+                OMNodeImpl child = (OMNodeImpl) firstChild;
+                while (child != null) {
+                    if ((!(child instanceof OMElement)) || child.isComplete() || child.builder == null) {
+                        child.internalSerializeAndConsume(writer);
+                    } else {
+                        OMElement element = (OMElement) child;
+                        element.getBuilder().setCache(false);
+                        OMSerializerUtil.serializeByPullStream(element, writer, cache);
+                    }
+                    child = child.nextSibling;
+                }
+                OMSerializerUtil.serializeEndpart(writer);
+            } else {
+                OMSerializerUtil.serializeByPullStream(this, writer, cache);
+            }
+
+
+        }
+    }
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * This method serializes and consumes without building the object structure in memory.
+     * Misuse of this method will cause loss of data. So it is advised to use
+     * populateYourSelf() method, before calling this method, if one wants to
+     * preserve data in the stream. This was requested during the second Axis2 summit.
+     *
+     * @throws XMLStreamException
+     */
+    public void internalSerializeAndConsume(XMLStreamWriter writer) throws XMLStreamException {
+        this.internalSerialize(writer, false);
+    }
+
+    /**
+     * Gets first element.
+     *
+     * @return Returns element.
+     */
+    public OMElement getFirstElement() {
+        OMNode node = getFirstOMChild();
+        while (node != null) {
+            if (node.getType() == OMNode.ELEMENT_NODE) {
+                return (OMElement) node;
+            } else {
+                node = node.getNextOMSibling();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Method getLocalName.
+     *
+     * @return Returns local name.
+     */
+    public String getLocalName() {
+        return localName;
+    }
+
+    /**
+     * Method setLocalName.
+     */
+    public void setLocalName(String localName) {
+        this.localName = localName;
+    }
+
+    /**
+     * Method getNamespace.
+     *
+     * @throws OMException
+     */
+    public OMNamespace getNamespace() throws OMException {
+//        return ns != null ? ns : DEFAULT_DEFAULT_NS_OBJECT;
+        if (ns == null) {
+            // User wants to keep this element in the default default namespace. Let's try to see the default namespace
+            // is overriden by some one up in the tree
+            OMNamespace parentDefaultNS = this.findNamespaceURI("");
+
+            if(parentDefaultNS != null && !"".equals(parentDefaultNS.getNamespaceURI())){
+                // if it was overriden, then we must explicitly declare default default namespace as the namespace
+                // of this element
+                ns = DEFAULT_DEFAULT_NS_OBJECT;
+            }
+        }
+        return ns;
+    }
+
+    /**
+     * Method setNamespace.
+     */
+    public void setNamespace(OMNamespace namespace) {
+        OMNamespace nsObject = null;
+        if (namespace != null) {
+            nsObject = handleNamespace(namespace);
+        }
+        this.ns = nsObject;
+    }
+
+    public void setNamespaceWithNoFindInCurrentScope(OMNamespace namespace) {
+        this.ns = namespace;
+    }
+
+    /**
+     * Method getQName.
+     *
+     * @return Returns QName.
+     */
+    public QName getQName() {
+        QName qName;
+        if (ns != null) {
+            if (ns.getPrefix() != null) {
+                qName = new QName(ns.getNamespaceURI(), localName, ns.getPrefix());
+            } else {
+                qName = new QName(ns.getNamespaceURI(), localName);
+            }
+        } else {
+            qName = new QName(localName);
+        }
+        return qName;
+    }
+
+    public String toStringWithConsume() throws XMLStreamException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        this.serializeAndConsume(baos);
+        return new String(baos.toByteArray());
+    }
+
+    public String toString() {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try {
+            this.serialize(baos);
+        } catch (XMLStreamException e) {
+            throw new RuntimeException("Can not serialize OM Element " + this.getLocalName(), e);
+        }
+        return new String(baos.toByteArray());
+    }
+
+    /**
+     * Method discard.
+     *
+     * @throws OMException
+     */
+    public void discard() throws OMException {
+        if (done || builder == null) {
+            this.detach();
+        } else {
+            builder.discard(this);
+        }
+    }
+
+    /**
+     * Converts a prefix:local qname string into a proper QName, evaluating it
+     * in the OMElement context. Unprefixed qnames resolve to the local namespace.
+     *
+     * @param qname prefixed qname string to resolve
+     * @return Returns null for any failure to extract a qname.
+     */
+    public QName resolveQName(String qname) {
+        ElementHelper helper = new ElementHelper(this);
+        return helper.resolveQName(qname);
+    }
+
+    public OMElement cloneOMElement() {
+        OMElement clonedElement = new StAXOMBuilder(this.getXMLStreamReader(true)).getDocumentElement();
+        clonedElement.build();
+        return clonedElement;
+    }
+
+    public void setLineNumber(int lineNumber) {
+        this.lineNumber = lineNumber;
+    }
+
+    public int getLineNumber() {
+        return lineNumber;
+    }
+
+    /* (non-Javadoc)
+      * @see org.apache.axiom.om.OMNode#buildAll()
+      */
+    public void buildWithAttachments() {
+        if (!done) {
+            this.build();
+        }
+        Iterator iterator = getChildren();
+        while (iterator.hasNext()) {
+            OMNode node = (OMNode) iterator.next();
+            node.buildWithAttachments();
+        }
+    }
+
+    /**
+     * This method will be called when one of the children becomes complete.
+     */
+    protected void notifyChildComplete() {
+        if (!this.done && builder == null) {
+            Iterator iterator = getChildren();
+            while (iterator.hasNext()) {
+                OMNode node = (OMNode) iterator.next();
+                if (!node.isComplete()) {
+                    return;
+                }
+            }
+            this.setComplete(true);
+        }
+    }
+}
+
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMNamespaceImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMNamespaceImpl.java
new file mode 100644
index 0000000..dedfe1a
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMNamespaceImpl.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.llom;
+
+/**
+ * @deprecated Use {@link OMNamespaceImpl}
+ */
+public class OMNamespaceImpl extends org.apache.axiom.om.impl.OMNamespaceImpl {
+	public OMNamespaceImpl(String pUri, String prefix) {
+		super(pUri, prefix);
+	}
+}
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMNavigator.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMNavigator.java
new file mode 100644
index 0000000..dac861f
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMNavigator.java
@@ -0,0 +1,194 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.llom;

+

+import org.apache.axiom.om.OMContainer;

+import org.apache.axiom.om.OMDocument;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMNode;

+

+/**

+ * Refer to the testClass to find out how to use

+ * features like isNavigable, isComplete and step.

+ */

+public class OMNavigator {

+    /**

+     * Field node

+     */

+    protected OMNode node;

+

+    /**

+     * Field visited

+     */

+    private boolean visited;

+

+    /**

+     * Field next

+     */

+    private OMNode next;

+

+    // root is the starting element. Once the navigator comes back to the

+    // root, the traversal is terminated

+

+    /**

+     * Field root

+     */

+    private OMNode root;

+

+    /**

+     * Field backtracked

+     */

+    private boolean backtracked;

+

+    // flags that tell the status of the navigator

+

+    /**

+     * Field end

+     */

+    private boolean end = false;

+

+    /**

+     * Field start

+     */

+    private boolean start = true;

+

+    /**

+     * Constructor OMNavigator.

+     */

+    public OMNavigator() {

+    }

+

+    /**

+     * Constructor OMNavigator.

+     *

+     * @param node

+     */

+    public OMNavigator(OMNode node) {

+        init(node);

+    }

+

+    /**

+     * Method init.

+     *

+     * @param node

+     */

+    public void init(OMNode node) {

+        next = node;

+        root = node;

+        backtracked = false;

+    }

+

+    /**

+     * Gets the next node.

+     *

+     * @return Returns OMnode in the sequence of preorder traversal. Note however 

+     *         that an element node is treated slightly differently. Once the 

+     *         element is passed it returns the same element in the next encounter as well.

+     */

+    public OMNode next() {

+        if (next == null) {

+            return null;

+        }

+        node = next;

+        visited = backtracked;

+        backtracked = false;

+        updateNextNode();

+

+        // set the starting and ending flags

+        if (root.equals(node)) {

+            if (!start) {

+                end = true;

+            } else {

+                start = false;

+            }

+        }

+        return node;

+    }

+

+    /**

+     * Private method to encapsulate the searching logic.

+     */

+    private void updateNextNode() {

+        if ((next instanceof OMElement) && !visited) {

+            OMElementImpl e = (OMElementImpl) next;

+            if (e.firstChild != null) {

+                next = e.firstChild;

+            } else if (e.isComplete()) {

+                backtracked = true;

+            } else {

+                next = null;

+            }

+        } else {

+            OMNode nextSibling = ((OMNodeImpl) next).nextSibling;

+            //OMNode parent = next.getParent();

+            OMContainer parent = next.getParent();

+            if (nextSibling != null) {

+                next = nextSibling;

+            } else if ((parent != null) && parent.isComplete() && !(parent instanceof OMDocument)) {

+                next = (OMNodeImpl) parent;

+                backtracked = true;

+            } else {

+                next = null;

+            }

+        }

+    }

+

+    /**

+     * Method visited.

+     *

+     * @return Returns boolean.

+     */

+    public boolean visited() {

+        return visited;

+    }

+

+    /**

+     * This is a very special method. This allows the navigator to step

+     * once it has reached the existing OM. At this point the isNavigable

+     * method will return false but the isComplete method may return false

+     * which means that the navigating the given element is not complete and

+     * the navigator cannot proceed.

+     */

+    public void step() {

+        if (!end) {

+            next = node;

+            updateNextNode();

+        }

+    }

+

+    /**

+     * Returns the navigable status.

+     *

+     * @return Returns boolean.

+     */

+    public boolean isNavigable() {

+        if (end) {

+            return false;

+        } else {

+            return !(next == null);

+        }

+    }

+

+    /**

+     * Returns the completed status.

+     *

+     * @return Returns boolean.

+     */

+    public boolean isCompleted() {

+        return end;

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMNodeImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMNodeImpl.java
new file mode 100644
index 0000000..0fa92f7
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMNodeImpl.java
@@ -0,0 +1,490 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.llom;
+
+import org.apache.axiom.om.*;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
+import org.apache.axiom.om.impl.OMContainerEx;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.impl.llom.factory.OMLinkedListImplFactory;
+import org.apache.axiom.om.util.StAXUtils;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.OutputStream;
+import java.io.Writer;
+
+/**
+ * Class OMNodeImpl
+ */
+public abstract class OMNodeImpl implements OMNode, OMNodeEx {
+    /**
+     * Field parent
+     */
+    protected OMContainerEx parent;
+
+    /**
+     * Field nextSibling
+     */
+    protected OMNodeImpl nextSibling;
+
+    /**
+     * Field previousSibling
+     */
+    protected OMNodeImpl previousSibling;
+    /**
+     * Field builder
+     */
+    protected OMXMLParserWrapper builder;
+
+    /**
+     * Field done
+     */
+    protected boolean done = false;
+
+    /**
+     * Field nodeType
+     */
+    protected int nodeType;
+
+    protected OMFactory factory;
+
+    /**
+     * Constructor OMNodeImpl
+     * @param factory The <code>OMFactory</code> that created this
+     */
+    public OMNodeImpl(OMFactory factory) {
+        this.factory = factory;
+    }
+
+    /**
+     * For a node to exist there must be a parent.
+     *
+     * @param parent Parent <code>OMContainer</code> of this node
+     * @param factory The <code>OMFactory</code> that created this
+     */
+    public OMNodeImpl(OMContainer parent, OMFactory factory, boolean done) {
+        this.done = done;
+        this.factory = factory;
+        if ((parent != null)) {
+            this.parent = (OMContainerEx) parent;
+            parent.addChild(this);
+        }
+        
+    }
+
+    /**
+     * Returns the immediate parent of the node. Parent is always an Element.
+     *
+     * @return Returns OMContainer.
+     * @throws OMException
+     */
+    public OMContainer getParent() {
+        return parent;
+    }
+
+    /**
+     * Method setParent.
+     *
+     * @param element
+     */
+    public void setParent(OMContainer element) {
+
+        if ((this.parent) == element) {
+            return;
+        }
+
+        //If we are asked to assign a new parent in place 
+        //of an existing one. We should detach this node
+        //from the previous parent.
+        if (element!=null){
+            if (this.parent != null) {
+                this.detach();
+            }
+            this.parent = (OMContainerEx) element;
+        }else{
+            this.parent = null;
+        }
+    }
+
+    /**
+     * Returns the next sibling. This can be an OMAttribute or
+     * OMText or OMElement for others.
+     *
+     * @return Returns OMNode.
+     * @throws org.apache.axiom.om.OMException
+     *
+     */
+    public OMNode getNextOMSibling() throws OMException {
+        if ((nextSibling == null) && (parent != null) && !parent.isComplete()) {
+            parent.buildNext();
+        }
+        return nextSibling;
+    }
+
+    /**
+     * Method setNextOMSibling.
+     *
+     * @param node
+     */
+    public void setNextOMSibling(OMNode node) {
+		if (node ==null || node.getOMFactory() instanceof OMLinkedListImplFactory) {
+			this.nextSibling = (OMNodeImpl) node;
+		} else {
+			this.nextSibling = (OMNodeImpl)importNode(node);
+		}
+        this.nextSibling = (OMNodeImpl) node;
+    }
+
+
+    /**
+     * Indicates whether parser has parsed this information item completely or not.
+     * If some information is not available in the item, one has to check this
+     * attribute to make sure that, this item has been parsed completely or not.
+     *
+     * @return Returns boolean.
+     */
+    public boolean isComplete() {
+        return done;
+    }
+
+    /**
+     * Method setComplete.
+     *
+     * @param state
+     */
+    public void setComplete(boolean state) {
+        this.done = state;
+        if(parent != null){
+            if(!done) {
+                parent.setComplete(false);
+            }else if(parent instanceof OMElementImpl){
+                ((OMElementImpl) parent).notifyChildComplete();
+            }
+        }
+    }
+
+    /**
+     * Removes this information item and its children, from the model completely.
+     *
+     * @throws OMException
+     */
+    public OMNode detach() throws OMException {
+        if (parent == null) {
+            throw new OMException(
+                    "Elements that doesn't have a parent can not be detached");
+        }
+        OMNodeImpl nextSibling = (OMNodeImpl) getNextOMSibling();
+        if (previousSibling == null) {
+            parent.setFirstChild(nextSibling);
+        } else {
+            ((OMNodeEx) getPreviousOMSibling()).setNextOMSibling(nextSibling);
+        }
+        if (nextSibling != null) {
+            nextSibling.setPreviousOMSibling(getPreviousOMSibling());
+        }
+
+        if ((parent instanceof OMElementImpl) && ((OMElementImpl) parent).lastChild == this) {
+            ((OMElementImpl) parent).lastChild = getPreviousOMSibling();
+        }
+
+        this.parent = null;
+        return this;
+    }
+
+    /**
+     * Inserts a sibling just after the current information item.
+     *
+     * @param sibling
+     * @throws OMException
+     */
+    public void insertSiblingAfter(OMNode sibling) throws OMException {
+        if (parent == null) {
+            throw new OMException("Parent can not be null");
+        }else if(this == sibling){
+            throw new OMException("Inserting self as the sibling is not allowed");
+        }
+        ((OMNodeEx) sibling).setParent(parent);
+        if (sibling instanceof OMNodeImpl) {
+            OMNodeImpl siblingImpl = (OMNodeImpl) sibling;
+            if (nextSibling == null) {
+                getNextOMSibling();
+            }
+            siblingImpl.setPreviousOMSibling(this);
+            if (nextSibling != null) {
+                nextSibling.setPreviousOMSibling(sibling);
+            }
+            ((OMNodeEx) sibling).setNextOMSibling(nextSibling);
+            nextSibling = siblingImpl;
+        }
+    }
+
+    /**
+     * Inserts a sibling just before the current information item.
+     *
+     * @param sibling
+     * @throws OMException
+     */
+    public void insertSiblingBefore(OMNode sibling) throws OMException {
+        if (parent == null) {
+            throw new OMException("Parent can not be null");
+        } else if(this == sibling){
+            throw new OMException("Inserting self as the sibling is not allowed");
+        }
+        if (sibling instanceof OMNodeImpl) {
+            OMNodeImpl siblingImpl = (OMNodeImpl) sibling;
+            siblingImpl.nextSibling = this;
+            if (previousSibling == null) {
+                parent.setFirstChild(siblingImpl);
+                siblingImpl.previousSibling = null;
+            } else {
+                siblingImpl.setParent(parent);
+                previousSibling.setNextOMSibling(siblingImpl);
+                siblingImpl.setPreviousOMSibling(previousSibling);
+            }
+            previousSibling = siblingImpl;
+
+        }
+    }
+
+    /**
+     * Gets the type of node, as this is the super class of all the nodes.
+     *
+     * @return Returns the type of node as indicated by {@link #setType}
+     * @see #setType
+     */
+    public int getType() {
+        return nodeType;
+    }
+
+    /**
+     * Method setType.
+     *
+     * @param nodeType
+     * @throws OMException
+     */
+    public void setType(int nodeType) throws OMException {
+        this.nodeType = nodeType;
+    }
+
+    /**
+     * Gets the previous sibling.
+     *
+     * @return boolean
+     */
+    public OMNode getPreviousOMSibling() {
+        return previousSibling;
+    }
+
+    /**
+     * Method setPreviousOMSibling.
+     *
+     * @param previousSibling
+     */
+    public void setPreviousOMSibling(OMNode previousSibling) {
+		if (previousSibling ==null || previousSibling.getOMFactory() instanceof OMLinkedListImplFactory) {
+			this.previousSibling = (OMNodeImpl) previousSibling;
+		} else {
+			this.previousSibling = (OMNodeImpl)importNode(previousSibling);
+		}   
+    }
+
+    /**
+     * Parses this node and builds the object structure in memory.
+     * However a node, created programmatically, will have done set to true by
+     * default and this will cause populateyourself not to work properly!
+     *
+     * @throws OMException
+     */
+    public void build() throws OMException {
+        while (!done) {
+            builder.next();
+        }
+    }
+
+    /**
+     * Parses this node and builds the object structure in memory. AXIOM
+     * supports two levels of deffered building. First is deffered building of
+     * AXIOM using StAX. Second level is the deffered building of attachments.
+     * AXIOM reads in the attachements from the stream only when user asks by
+     * calling getDataHandler(). build() method builds the OM without the
+     * attachments. buildAll() builds the OM together with attachement data.
+     * This becomes handy when user wants to free the input stream.
+     */
+    public void buildWithAttachments() {
+        if (!this.done) {
+            this.build();
+        }
+    }
+
+    /**
+     * Serializes the node with caching.
+     *
+     * @param xmlWriter
+     * @throws javax.xml.stream.XMLStreamException
+     */
+    public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(xmlWriter);
+        internalSerialize(writer);
+        writer.flush();
+    }
+
+    /**
+     * Serializes the node without caching.
+     *
+     * @param xmlWriter
+     * @throws javax.xml.stream.XMLStreamException
+     *
+     */
+    public void serializeAndConsume(XMLStreamWriter xmlWriter) throws XMLStreamException {
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(xmlWriter);
+        internalSerializeAndConsume(writer);
+        writer.flush();
+    }
+
+    /**
+     * Serializes the node with caching.
+     *
+     * @param writer
+     * @throws XMLStreamException
+     */
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
+        throw new RuntimeException("Not implemented yet!");
+    }
+
+    /**
+     * Serializes the node without caching.
+     *
+     * @param writer
+     * @throws XMLStreamException
+     */
+    public void internalSerializeAndConsume(XMLStreamWriter writer) throws XMLStreamException {
+        throw new RuntimeException("Not implemented yet!");
+    }
+
+    public void serialize(OutputStream output) throws XMLStreamException {
+        serialize(StAXUtils.createXMLStreamWriter(output));
+    }
+
+    public void serialize(Writer writer) throws XMLStreamException {
+        serialize(StAXUtils.createXMLStreamWriter(writer));
+    }
+
+    public void serializeAndConsume(OutputStream output) throws XMLStreamException {
+        serializeAndConsume(StAXUtils.createXMLStreamWriter(output));
+    }
+
+    public void serializeAndConsume(Writer writer) throws XMLStreamException {
+        serializeAndConsume(StAXUtils.createXMLStreamWriter(writer));
+    }
+
+    public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format);
+        internalSerialize(writer);
+        writer.flush();
+    }
+
+    public void serialize(Writer writer2, OMOutputFormat format) throws XMLStreamException {
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writer2));
+        writer.setOutputFormat(format);
+        internalSerialize(writer);
+        writer.flush();
+    }
+
+    public void serializeAndConsume(OutputStream output, OMOutputFormat format) throws XMLStreamException {
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format);
+        internalSerializeAndConsume(writer);
+        writer.flush();
+    }
+
+    public void serializeAndConsume(Writer writer2, OMOutputFormat format) throws XMLStreamException {
+        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writer2));
+        writer.setOutputFormat(format);
+        internalSerializeAndConsume(writer);
+        writer.flush();
+    }
+
+    public OMFactory getOMFactory() {
+        return this.factory;
+    }
+    
+ 	/**	
+	 * This method is intended only to be used by Axiom intenals when merging Objects
+	 * from different Axiom implementations to the LLOM implementation.
+	 * 
+	 * @param child
+	 */
+ 	protected OMNode importNode(OMNode child)
+ 	{
+ 		int type = child.getType();
+		switch (type) {
+		case (OMNode.ELEMENT_NODE): 
+		{
+			OMElement childElement = (OMElement) child;
+			OMElement newElement = (new StAXOMBuilder(this.factory, childElement
+					.getXMLStreamReader())).getDocumentElement();
+			newElement.buildWithAttachments();
+			return newElement;
+		}
+		case (OMNode.TEXT_NODE): 
+		{
+			OMText importedText = (OMText) child;
+			OMText newText;
+			if (importedText.isBinary()) {
+				boolean isOptimize = importedText.isOptimized();
+				newText = this.factory.createOMText(importedText
+						.getDataHandler(), isOptimize);
+			}
+			else if (importedText.getNamespace()!=null)
+			{
+				newText = this.factory.createOMText(null,importedText.getTextAsQName(),importedText.getType());
+			}
+			else if (importedText.isCharacters()) {
+				newText = this.factory.createOMText(null, importedText
+						.getTextCharacters(), importedText.getType());
+			} else {
+				newText = this.factory.createOMText(null, importedText
+						.getText()/*, importedText.getOMNodeType()*/);
+			}
+			return newText;
+		}
+		
+		case (OMNode.PI_NODE): {
+			OMProcessingInstruction importedPI = (OMProcessingInstruction) child;
+			OMProcessingInstruction newPI = this.factory
+					.createOMProcessingInstruction(null, importedPI
+							.getTarget(), importedPI.getValue());
+			return newPI;
+		}
+		case (OMNode.COMMENT_NODE): {
+			OMComment importedComment = (OMComment) child;
+			OMComment newComment = this.factory.createOMComment(null,
+					importedComment.getValue());
+			return newComment;
+		}
+		case (OMNode.DTD_NODE) :{
+			OMDocType importedDocType = (OMDocType)child;
+			OMDocType newDocType = this.factory.createOMDocType(null,importedDocType.getValue());
+			return newDocType;
+		}
+		default: {
+			throw new UnsupportedOperationException("Not Implemented Yet for the given node type");
+		}
+		}
+ 	}
+}
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMProcessingInstructionImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMProcessingInstructionImpl.java
new file mode 100644
index 0000000..2c9ee0f
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMProcessingInstructionImpl.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.llom;
+
+import org.apache.axiom.om.*;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class OMProcessingInstructionImpl extends OMNodeImpl implements OMProcessingInstruction {
+    protected String target;
+    protected String value;
+
+    /**
+     * Constructor OMProcessingInstructionImpl.
+     *
+     * @param parentNode
+     * @param target
+     * @param value
+     */
+    public OMProcessingInstructionImpl(OMContainer parentNode, String target, 
+            String value, OMFactory factory) {
+        super(parentNode, factory, true);
+        this.target = (target == null) ? null : target.trim();
+        this.value = (value == null) ? null : value.trim();
+        nodeType = OMNode.PI_NODE;
+    }
+
+    /**
+     * Constructor OMProcessingInstructionImpl.
+     *
+     * @param parentNode
+     */
+    public OMProcessingInstructionImpl(OMContainer parentNode, 
+            OMFactory factory) {
+        this(parentNode, null, null, factory);
+    }
+
+    /**
+     * Serializes the node with caching.
+     *
+     * @param writer
+     * @throws XMLStreamException
+     */
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
+        writer.writeProcessingInstruction(this.target+" ", this.value);
+    }
+
+    /**
+     * Serializes the node without caching.
+     *
+     * @param writer
+     * @throws XMLStreamException
+     */
+    public void internalSerializeAndConsume(XMLStreamWriter writer) throws XMLStreamException {
+        internalSerialize(writer);
+    }
+
+    /**
+     * Gets the value of this Processing Instruction.
+     *
+     * @return string
+     */
+    public String getValue() {
+        return value;
+    }
+
+    /**
+     * Sets the target of this Processing Instruction.
+     *
+     * @param target
+     */
+    public void setTarget(String target) {
+        this.target = target;
+    }
+
+    /**
+     * Gets the target of this Processing Instruction.
+     *
+     * @return Returns String.
+     */
+    public String getTarget() {
+        return target;
+    }
+
+    /**
+     * Sets the value of this Processing Instruction.
+     *
+     * @param text
+     */
+    public void setValue(String text) {
+        this.value = text;
+    }
+
+    /**
+     * Discards this node.
+     *
+     * @throws OMException
+     */
+    public void discard() throws OMException {
+        if (done) {
+            this.detach();
+        } else {
+            builder.discard((OMElement) this.parent);
+        }
+    }
+}
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
new file mode 100644
index 0000000..9273bf0
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
@@ -0,0 +1,727 @@
+/*

+ * Copyright 2006 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.llom;

+

+import org.apache.axiom.om.*;

+import org.apache.axiom.om.impl.builder.StAXOMBuilder;

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+

+import javax.xml.namespace.QName;

+import javax.xml.stream.XMLStreamConstants;

+import javax.xml.stream.XMLStreamException;

+import javax.xml.stream.XMLStreamReader;

+import javax.xml.stream.XMLStreamWriter;

+import java.io.OutputStream;

+import java.io.StringWriter;

+import java.io.Writer;

+import java.util.Iterator;

+

+/**

+ * <p>Element backed by an arbitrary data source. When necessary, this element

+ * will be expanded by creating a parser from the data source.</p>

+ * 

+ * <p>Whenever methods are added to the base {@link

+ * org.apache.axiom.om.impl.llom.OMElementImpl} class the corresponding methods

+ * must be added to this class (there's a unit test to verify that this has been

+ * done, just to make sure nothing gets accidentally broken). If the method

+ * only requires the element name and/or namespace information, the base class

+ * method can be called directly. Otherwise, the element must be expanded into a

+ * full OM tree (by calling the {@link #forceExpand()} method) before the base

+ * class method is called. This will typically involve a heavy overhead penalty,

+ * so should be avoided if possible.</p>

+ */

+public class OMSourcedElementImpl extends OMElementImpl

+{

+    /** Data source for element data. */

+    private final OMDataSource dataSource;

+    

+    /** Namespace for element, needed in order to bypass base class handling. */

+    private OMNamespace definedNamespace;

+    

+    /** Flag for parser provided to base element class. */

+    private boolean isParserSet;

+    

+    private static Log log = LogFactory.getLog(OMSourcedElementImpl.class);

+    

+    /**

+     * Constructor.

+     * 

+     * @param localName

+     * @param ns

+     * @param factory

+     * @param source

+     */

+    public OMSourcedElementImpl(String localName, OMNamespace ns, OMFactory factory, OMDataSource source) {

+        super(localName, null, factory);

+        dataSource = source;

+        definedNamespace = ns;

+    }

+

+    /**

+     * Constructor that takes a QName instead of the

+     * local name and the namespace seperately

+     *

+     * @param QName

+     * @param factory

+     * @param source

+     */

+    public OMSourcedElementImpl(QName qName, OMFactory factory, OMDataSource source) {

+        //create a namespace

+        this(qName.getLocalPart(),

+            factory.createOMNamespace(qName.getNamespaceURI(),

+                                      qName.getPrefix()),

+            factory,

+            source);

+

+    }

+    

+    /**

+     * Generate element name for output.

+     * @return name

+     */

+    private String getPrintableName() {

+        String uri = getNamespace().getNamespaceURI();

+        if (uri == null || uri.length() == 0) {

+            return getLocalName();

+        } else {

+            return "{" + uri + '}' + getLocalName();

+        }

+    }

+

+    /**

+     * Get parser from data source.

+     * @return parser

+     */

+    private XMLStreamReader getDirectReader() {

+        try {

+            return dataSource.getReader();

+        } catch (XMLStreamException e) {

+            log.error("Could not get parser from data source for element " +

+                getPrintableName(), e);

+            throw new RuntimeException("Error obtaining parser from data source:" +

+                e.getMessage());

+        }

+    }

+

+    /**

+     * Set parser for OM, if not previously set. Since the builder is what

+     * actually constructs the tree on demand, this first creates a builder

+     */

+    private void forceExpand() {

+        if (!isParserSet) {

+            

+            if (log.isDebugEnabled()) {

+                log.debug("forceExpand: expanding element " +

+                    getPrintableName());

+            }

+            

+            // position reader to start tag

+            XMLStreamReader reader = getDirectReader();

+            try {

+            	if (reader.getEventType()!= XMLStreamConstants.START_ELEMENT) {

+                   while (reader.next() != XMLStreamConstants.START_ELEMENT);

+            	}

+            } catch (XMLStreamException e) {

+                log.error("forceExpand: error parsing data soruce document for element " +

+                    getLocalName(), e);

+                throw new RuntimeException("Error parsing data source document:" +

+                    e.getMessage());

+            }

+            

+            // make sure element name matches what was expected

+            if (!reader.getLocalName().equals(getLocalName())) {

+                log.error("forceExpand: expected element name " +

+                    getLocalName() + ", found " + reader.getLocalName());

+                throw new RuntimeException("Element name from data source is " +

+                    reader.getLocalName() + ", not the expected " + getLocalName());

+            }

+            if (!reader.getNamespaceURI().equals(getNamespace().getNamespaceURI())) {

+                String uri = getNamespace().getNamespaceURI();

+                log.error("forceExpand: expected element namespace " +

+                    getLocalName() + ", found " + uri);

+                throw new RuntimeException("Element namespace from data source is " +

+                    reader.getNamespaceURI() + ", not the expected " + uri);

+            }

+            

+            // set the builder for this element

+            isParserSet = true;

+            super.setBuilder(new StAXOMBuilder(getOMFactory(), reader, this));

+            setComplete(false);

+        }

+    }

+    

+    /**

+     * Check if element has been expanded into tree.

+     * 

+     * @return <code>true</code> if expanded, <code>false</code> if not

+     */

+    public boolean isExpanded() {

+        return isParserSet;

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#getChildElements()

+     */

+    public Iterator getChildElements() {

+        forceExpand();

+        return super.getChildElements();

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#declareNamespace(java.lang.String, java.lang.String)

+     */

+    public OMNamespace declareNamespace(String uri, String prefix) {

+        forceExpand();

+        return super.declareNamespace(uri, prefix);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#declareDefaultNamespace(java.lang.String)

+     */

+    public OMNamespace declareDefaultNamespace(String uri) {

+        forceExpand();

+        return super.declareDefaultNamespace(uri);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#getDefaultNamespace()

+     */

+    public OMNamespace getDefaultNamespace() {

+        forceExpand();

+        return super.getDefaultNamespace();

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#declareNamespace(org.apache.axiom.om.OMNamespace)

+     */

+    public OMNamespace declareNamespace(OMNamespace namespace) {

+        forceExpand();

+        return super.declareNamespace(namespace);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#findNamespace(java.lang.String, java.lang.String)

+     */

+    public OMNamespace findNamespace(String uri, String prefix) {

+        forceExpand();

+        return super.findNamespace(uri, prefix);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#findNamespaceURI(java.lang.String)

+     */

+    public OMNamespace findNamespaceURI(String prefix) {

+        forceExpand();

+        return super.findNamespaceURI(prefix);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#getAllDeclaredNamespaces()

+     */

+    public Iterator getAllDeclaredNamespaces() throws OMException {

+        forceExpand();

+        return super.getAllDeclaredNamespaces();

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#getAllAttributes()

+     */

+    public Iterator getAllAttributes() {

+        forceExpand();

+        return super.getAllAttributes();

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#getAttribute(javax.xml.namespace.QName)

+     */

+    public OMAttribute getAttribute(QName qname) {

+        forceExpand();

+        return super.getAttribute(qname);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#getAttributeValue(javax.xml.namespace.QName)

+     */

+    public String getAttributeValue(QName qname) {

+        forceExpand();

+        return super.getAttributeValue(qname);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#addAttribute(org.apache.axiom.om.OMAttribute)

+     */

+    public OMAttribute addAttribute(OMAttribute attr) {

+        forceExpand();

+        return super.addAttribute(attr);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#addAttribute(java.lang.String, java.lang.String, org.apache.axiom.om.OMNamespace)

+     */

+    public OMAttribute addAttribute(String attributeName, String value, OMNamespace namespace) {

+        forceExpand();

+        return super.addAttribute(attributeName, value, namespace);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#removeAttribute(org.apache.axiom.om.OMAttribute)

+     */

+    public void removeAttribute(OMAttribute attr) {

+        forceExpand();

+        super.removeAttribute(attr);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#setBuilder(org.apache.axiom.om.OMXMLParserWrapper)

+     */

+    public void setBuilder(OMXMLParserWrapper wrapper) {

+        throw new UnsupportedOperationException("Builder cannot be set for element backed by data source");

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#getBuilder()

+     */

+    public OMXMLParserWrapper getBuilder() {

+        forceExpand();

+        return super.getBuilder();

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#setFirstChild(org.apache.axiom.om.OMNode)

+     */

+    public void setFirstChild(OMNode node) {

+        forceExpand();

+        super.setFirstChild(node);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#getFirstElement()

+     */

+    public OMElement getFirstElement() {

+        forceExpand();

+        return super.getFirstElement();

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#getXMLStreamReader()

+     */

+    public XMLStreamReader getXMLStreamReader() {

+        if (log.isDebugEnabled()) {

+            log.debug("getting XMLStreamReader for " + getPrintableName());

+        }

+        if (isParserSet) {

+            return super.getXMLStreamReader();

+        } else {

+            return getDirectReader();

+        }

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#getXMLStreamReaderWithoutCaching()

+     */

+    public XMLStreamReader getXMLStreamReaderWithoutCaching() {

+        if (log.isDebugEnabled()) {

+            log.debug("getting XMLStreamReader without caching for " +

+                getPrintableName());

+        }

+        if (isParserSet) {

+            return super.getXMLStreamReaderWithoutCaching();

+        } else {

+            return getDirectReader();

+        }

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#setText(java.lang.String)

+     */

+    public void setText(String text) {

+        forceExpand();

+        super.setText(text);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#setText(javax.xml.namespace.QName)

+     */

+    public void setText(QName text) {

+        forceExpand();

+        super.setText(text);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#getText()

+     */

+    public String getText() {

+        forceExpand();

+        return super.getText();

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#getTextAsQName()

+     */

+    public QName getTextAsQName() {

+        forceExpand();

+        return super.getTextAsQName();

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#getLocalName()

+     */

+    public String getLocalName() {

+        // no need to set the parser, just call base method directly

+        return super.getLocalName();

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#setLocalName(java.lang.String)

+     */

+    public void setLocalName(String localName) {

+        // no need to expand the tree, just call base method directly

+        super.setLocalName(localName);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#getNamespace()

+     */

+    public OMNamespace getNamespace() throws OMException {

+        return definedNamespace;

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#setNamespace(org.apache.axiom.om.OMNamespace)

+     */

+    public void setNamespace(OMNamespace namespace) {

+        forceExpand();

+        super.setNamespace(namespace);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#setNamespaceWithNoFindInCurrentScope(org.apache.axiom.om.OMNamespace)

+     */

+    public void setNamespaceWithNoFindInCurrentScope(OMNamespace namespace) {

+        forceExpand();

+        super.setNamespaceWithNoFindInCurrentScope(namespace);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#getQName()

+     */

+    public QName getQName() {

+        if (isParserSet) {

+            return super.getQName();

+        } else if (definedNamespace != null) {

+            // always ignore prefix on name from sourced element

+            return new QName(definedNamespace.getNamespaceURI(), getLocalName());

+

+        } else {

+            return new QName(getLocalName());

+        }

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#toStringWithConsume()

+     */

+    public String toStringWithConsume() throws XMLStreamException {

+        StringWriter writer = new StringWriter();

+        dataSource.serialize(writer, null);

+        return writer.toString();

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#resolveQName(java.lang.String)

+     */

+    public QName resolveQName(String qname) {

+        forceExpand();

+        return super.resolveQName(qname);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#cloneOMElement()

+     */

+    public OMElement cloneOMElement() {

+        forceExpand();

+        return super.cloneOMElement();

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#setLineNumber(int)

+     */

+    public void setLineNumber(int lineNumber) {

+        // no need to expand the tree, just call base method directly

+        super.setLineNumber(lineNumber);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMElement#getLineNumber()

+     */

+    public int getLineNumber() {

+        // no need to expand the tree, just call base method directly

+        return super.getLineNumber();

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMNode#discard()

+     */

+    public void discard() throws OMException {

+        // discard without expanding the tree

+        setComplete(true);

+        super.detach();

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMNode#getType()

+     */

+    public int getType() {

+        // no need to expand the tree, just call base method directly

+        return super.getType();

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMNode#internalSerialize(javax.xml.stream.XMLStreamWriter)

+     */

+    public void internalSerialize(javax.xml.stream.XMLStreamWriter writer) throws XMLStreamException {

+        internalSerializeAndConsume(writer);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.impl.llom.OMElementImpl#internalSerialize(javax.xml.stream.XMLStreamWriter, boolean)

+     */

+    protected void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException {

+        internalSerializeAndConsume(writer);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMNode#internalSerializeAndConsume(javax.xml.stream.XMLStreamWriter)

+     */

+    public void internalSerializeAndConsume(XMLStreamWriter writer) throws XMLStreamException {

+        if (log.isDebugEnabled()) {

+            log.debug("serialize " + getPrintableName() + " to XMLStreamWriter");

+        }

+        dataSource.serialize(writer);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMNode#serialize(javax.xml.stream.XMLStreamWriter)

+     */

+    public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {

+        internalSerializeAndConsume(xmlWriter);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMNode#serialize(java.io.OutputStream)

+     */

+    public void serialize(OutputStream output) throws XMLStreamException {

+        serializeAndConsume(output);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMNode#serialize(java.io.Writer)

+     */

+    public void serialize(Writer writer) throws XMLStreamException {

+        serializeAndConsume(writer);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMNode#serialize(java.io.OutputStream, org.apache.axiom.om.OMOutputFormat)

+     */

+    public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {

+        serializeAndConsume(output, format);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMNode#serialize(java.io.Writer, org.apache.axiom.om.OMOutputFormat)

+     */

+    public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException {

+        serializeAndConsume(writer, format);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMNode#serializeAndConsume(javax.xml.stream.XMLStreamWriter)

+     */

+    public void serializeAndConsume(javax.xml.stream.XMLStreamWriter xmlWriter) throws XMLStreamException {

+        internalSerializeAndConsume(xmlWriter);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMNode#serializeAndConsume(java.io.OutputStream)

+     */

+    public void serializeAndConsume(OutputStream output) throws XMLStreamException {

+        if (log.isDebugEnabled()) {

+            log.debug("serialize " + getPrintableName() + " to output stream");

+        }

+        dataSource.serialize(output, null);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMNode#serializeAndConsume(java.io.Writer)

+     */

+    public void serializeAndConsume(Writer writer) throws XMLStreamException {

+        if (log.isDebugEnabled()) {

+            log.debug("serialize " + getPrintableName() + " to writer");

+        }

+        dataSource.serialize(writer, null);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMNode#serializeAndConsume(java.io.OutputStream, org.apache.axiom.om.OMOutputFormat)

+     */

+    public void serializeAndConsume(OutputStream output, OMOutputFormat format) throws XMLStreamException {

+        if (log.isDebugEnabled()) {

+            log.debug("serialize formatted " + getPrintableName() +

+                " to output stream");

+        }

+        dataSource.serialize(output, format);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMNode#serializeAndConsume(java.io.Writer, org.apache.axiom.om.OMOutputFormat)

+     */

+    public void serializeAndConsume(Writer writer, OMOutputFormat format) throws XMLStreamException {

+        if (log.isDebugEnabled()) {

+            log.debug("serialize formatted " + getPrintableName() +

+                " to writer");

+        }

+        dataSource.serialize(writer, format);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMContainer#addChild(org.apache.axiom.om.OMNode)

+     */

+    public void addChild(OMNode omNode) {

+        forceExpand();

+        super.addChild(omNode);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMContainer#getChildrenWithName(javax.xml.namespace.QName)

+     */

+    public Iterator getChildrenWithName(QName elementQName) {

+        forceExpand();

+        return super.getChildrenWithName(elementQName);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMContainer#getFirstChildWithName(javax.xml.namespace.QName)

+     */

+    public OMElement getFirstChildWithName(QName elementQName) throws OMException {

+        forceExpand();

+        return super.getFirstChildWithName(elementQName);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMContainer#getChildren()

+     */

+    public Iterator getChildren() {

+        forceExpand();

+        return super.getChildren();

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMContainer#getFirstOMChild()

+     */

+    public OMNode getFirstOMChild() {

+        forceExpand();

+        return super.getFirstOMChild();

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.OMContainer#buildNext()

+     */

+    public void buildNext() {

+        forceExpand();

+        super.buildNext();

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.impl.llom.OMElementImpl#detach()

+     */

+    public OMNode detach() throws OMException {

+        // detach without expanding the tree

+        boolean complete = isComplete();

+        setComplete(true);

+        OMNode result = super.detach();

+        setComplete(complete);

+        return result;

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.impl.llom.OMElementImpl#getNextOMSibling()

+     */

+    public OMNode getNextOMSibling() throws OMException {

+        // no need to expand the tree, just call base method directly

+        return super.getNextOMSibling();

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.impl.llom.OMElementImpl#getTrimmedText()

+     */

+    public String getTrimmedText() {

+        forceExpand();

+        return super.getTrimmedText();

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.impl.llom.OMElementImpl#handleNamespace(javax.xml.namespace.QName)

+     */

+    OMNamespace handleNamespace(QName qname) {

+        forceExpand();

+        return super.handleNamespace(qname);

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.impl.llom.OMElementImpl#isComplete()

+     */

+    public boolean isComplete() {

+        if (isParserSet) {

+            return super.isComplete();

+        } else {

+            return true;

+        }

+    }

+

+    /* (non-Javadoc)

+     * @see org.apache.axiom.om.impl.llom.OMElementImpl#toString()

+     */

+    public String toString() {

+        forceExpand();

+        return super.toString();

+    }

+    

+	/* (non-Javadoc)

+	 * @see org.apache.axiom.om.OMNode#buildAll()

+	 */

+	public void buildWithAttachments() {

+		if (!done)

+		{

+			this.build();

+		}

+		Iterator iterator = getChildren();

+		while(iterator.hasNext())

+		{

+			OMNode node = (OMNode)iterator.next();

+			node.buildWithAttachments();

+		}

+	}

+

+    public void build() throws OMException {

+        super.build();

+    }

+

+    protected void notifyChildComplete() {

+        super.notifyChildComplete();    

+    }

+}
\ No newline at end of file
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMStAXWrapper.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMStAXWrapper.java
new file mode 100644
index 0000000..80ac090
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMStAXWrapper.java
@@ -0,0 +1,1305 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.llom;

+

+import org.apache.axiom.om.*;

+import org.apache.axiom.om.impl.EmptyOMLocation;

+import org.apache.axiom.om.impl.exception.OMStreamingException;

+import org.apache.axiom.om.impl.llom.util.NamespaceContextImpl;

+

+import javax.xml.namespace.NamespaceContext;

+import javax.xml.namespace.QName;

+import javax.xml.stream.Location;

+import javax.xml.stream.XMLStreamConstants;

+import javax.xml.stream.XMLStreamException;

+import javax.xml.stream.XMLStreamReader;

+import java.util.*;

+

+/**

+ * Note  - This class also implements the streaming constants interface

+ * to get access to the StAX constants

+ */

+public class OMStAXWrapper implements XMLStreamReader, XMLStreamConstants {

+    /**

+     * Field navigator

+     */

+    private OMNavigator navigator;

+

+    /**

+     * Field builder

+     */

+    private OMXMLParserWrapper builder;

+

+    /**

+     * Field parser

+     */

+    private XMLStreamReader parser;

+

+    /**

+     * Field rootNode

+     */

+    private OMNode rootNode;

+

+    /**

+     * Field isFirst

+     */

+    private boolean isFirst = true;

+

+    // Navigable means the output should be taken from the navigator.

+    // As soon as the navigator returns a null navigable will be reset

+    // to false and the subsequent events will be taken from the builder

+    // or the parser directly.

+

+    /**

+     * Field NAVIGABLE

+     */

+    private static final short NAVIGABLE = 0;

+    private static final short SWITCH_AT_NEXT = 1;

+    private static final short COMPLETED = 2;

+    private static final short SWITCHED = 3;

+    private static final short DOCUMENT_COMPLETE = 4;

+

+

+    /**

+     * Field state

+     */

+    private short state;

+

+    /**

+     * Field currentEvent

+     * Default set to START_DOCUMENT

+     */

+    private int currentEvent = START_DOCUMENT;

+

+    // SwitchingAllowed is set to false by default.

+    // This means that unless the user explicitly states

+    // that he wants things not to be cached, everything will

+    // be cached.

+

+    /**

+     * Field switchingAllowed

+     */

+    boolean switchingAllowed = false;

+

+    /**

+     * Field elementStack

+     */

+    private Stack elementStack = new Stack();

+

+    // keeps the next event. The parser actually keeps one step ahead to

+    // detect the end of navigation. (at the end of the stream the navigator

+    // returns a null

+

+    /**

+     * Field nextNode

+     */

+    private OMNode nextNode = null;

+

+    // holder for the current node. Needs this to generate events from the current node

+

+    /**

+     * Field currentNode

+     */

+    private OMNode currentNode = null;

+

+    // needs this to refer to the last known node

+

+    /**

+     * Field lastNode

+     */

+    private OMNode lastNode = null;

+

+    /**

+     * Track depth to ensure we stop generating events when we are done with the root node.  

+     */

+    int depth = 0;

+

+    private boolean needToThrowEndDocument = false;

+

+    /**

+     * Method setAllowSwitching.

+     *

+     * @param b

+     */

+    public void setAllowSwitching(boolean b) {

+        this.switchingAllowed = b;

+    }

+

+    /**

+     * Method isAllowSwitching.

+     *

+     * @return Returns boolean.

+     */

+    public boolean isAllowSwitching() {

+        return switchingAllowed;

+    }

+

+    /**

+     * When constructing the OMStaxWrapper, the creator must produce the

+     * builder (an instance of the OMXMLparserWrapper of the input) and the

+     * Element Node to start parsing. The wrapper will parse(proceed) until

+     * the end of the given element. Hence care should be taken to pass the

+     * root element if the entire document is needed.

+     *

+     * @param builder

+     * @param startNode

+     */

+    public OMStAXWrapper(OMXMLParserWrapper builder, OMElement startNode) {

+        this(builder, startNode, false);

+    }

+

+    /**

+     * Constructor OMStAXWrapper.

+     *

+     * @param builder

+     * @param startNode

+     * @param cache

+     */

+    public OMStAXWrapper(OMXMLParserWrapper builder, OMElement startNode,

+                         boolean cache) {

+

+        // create a navigator

+        this.navigator = new OMNavigator(startNode);

+        this.builder = builder;

+        this.rootNode = startNode;

+        if (rootNode != null && rootNode.getParent() != null && rootNode.getParent() instanceof OMDocument) {

+            needToThrowEndDocument = true;

+        }

+

+        // initaite the next and current nodes

+        // Note -  navigator is written in such a way that it first

+        // returns the starting node at the first call to it

+        currentNode = navigator.next();

+        updateNextNode();

+        switchingAllowed = !cache;

+    }

+

+    /**

+     * @return Returns String.

+     * @see javax.xml.stream.XMLStreamReader#getPrefix()

+     */

+    public String getPrefix() {

+        String returnStr = null;

+        if (parser != null) {

+            returnStr = parser.getPrefix();

+        } else {

+            if ((currentEvent == START_ELEMENT)

+                    || (currentEvent == END_ELEMENT)) {

+                OMNamespace ns = ((OMElement) lastNode).getNamespace();

+                returnStr = (ns == null)

+                        ? null

+                        : ns.getPrefix();

+            }

+        }

+        return returnStr;

+    }

+

+    /**

+     * @return Returns String.

+     * @see javax.xml.stream.XMLStreamReader#getNamespaceURI()

+     */

+    public String getNamespaceURI() {

+        String returnStr = null;

+        if (parser != null) {

+            returnStr = parser.getNamespaceURI();

+        } else {

+            if ((currentEvent == START_ELEMENT)

+                    || (currentEvent == END_ELEMENT)

+                    || (currentEvent == NAMESPACE)) {

+                OMNamespace ns = ((OMElement) lastNode).getNamespace();

+                returnStr = (ns == null)

+                        ? null

+                        : ns.getNamespaceURI();

+            }

+        }

+        return returnStr;

+    }

+

+    /**

+     * @return Returns boolean.

+     * @see javax.xml.stream.XMLStreamReader#hasName()

+     */

+    public boolean hasName() {

+        if (parser != null) {

+            return parser.hasName();

+        } else {

+            return ((currentEvent == START_ELEMENT)

+                    || (currentEvent == END_ELEMENT));

+        }

+    }

+

+    /**

+     * @return Returns String.

+     * @see javax.xml.stream.XMLStreamReader#getLocalName()

+     */

+    public String getLocalName() {

+        String returnStr = null;

+        if (parser != null) {

+            returnStr = parser.getLocalName();

+        } else {

+            if ((currentEvent == START_ELEMENT)

+                    || (currentEvent == END_ELEMENT)

+                    || (currentEvent == ENTITY_REFERENCE)) {

+                returnStr = ((OMElement) lastNode).getLocalName();

+            }

+        }

+        return returnStr;

+    }

+

+    /**

+     * @return Returns QName.

+     * @see javax.xml.stream.XMLStreamReader#getName()

+     */

+    public QName getName() {

+        QName returnName = null;

+        if (parser != null) {

+            returnName = parser.getName();

+        } else {

+            if ((currentEvent == START_ELEMENT)

+                    || (currentEvent == END_ELEMENT)) {

+                returnName = getQName((OMElement) lastNode);

+            }

+        }

+        return returnName;

+    }

+

+    /**

+     * @return Returns boolean.

+     * @see javax.xml.stream.XMLStreamReader#hasText()

+     */

+    public boolean hasText() {

+        return ((currentEvent == CHARACTERS) || (currentEvent == DTD)

+                || (currentEvent == ENTITY_REFERENCE)

+                || (currentEvent == COMMENT) || (currentEvent == SPACE));

+    }

+

+    /**

+     * @return Returns int.

+     * @see javax.xml.stream.XMLStreamReader#getTextLength()

+     */

+    public int getTextLength() {

+        int returnLength = 0;

+        if (parser != null) {

+            returnLength = parser.getTextLength();

+        } else {

+            OMText textNode = (OMText) lastNode;

+            returnLength = textNode.getText().length();

+        }

+        return returnLength;

+    }

+

+    /**

+     * @return Returns int.

+     * @see javax.xml.stream.XMLStreamReader#getTextStart()

+     */

+    public int getTextStart() {

+        int returnLength = 0;

+        if (parser != null) {

+            returnLength = parser.getTextStart();

+        }

+

+        // Note - this has no relevant method in the OM

+        return returnLength;

+    }

+

+    /**

+     * @param i

+     * @param chars

+     * @param i1

+     * @param i2

+     * @return Returns int.

+     * @throws XMLStreamException

+     * @see javax.xml.stream.XMLStreamReader#getTextCharacters(int, char[], int, int)

+     */

+    public int getTextCharacters(int i, char[] chars, int i1, int i2)

+            throws XMLStreamException {

+        int returnLength = 0;

+        if (parser != null) {

+            try {

+                returnLength = parser.getTextCharacters(i, chars, i1, i2);

+            } catch (XMLStreamException e) {

+                throw new OMStreamingException(e);

+            }

+        } else {

+            if (hasText()) {

+                OMText textNode = (OMText) lastNode;

+                String str = textNode.getText();

+                str.getChars(i, i + i2, chars, i1);

+            }

+        }

+        return returnLength;

+    }

+

+    /**

+     * @return Returns char[].

+     * @see javax.xml.stream.XMLStreamReader#getTextCharacters()

+     */

+    public char[] getTextCharacters() {

+        char[] returnArray = null;

+        if (parser != null) {

+            returnArray = parser.getTextCharacters();

+        } else {

+            if (hasText()) {

+                OMText textNode = (OMText) lastNode;

+                String str = textNode.getText();

+                returnArray = str.toCharArray();

+            }

+        }

+        return returnArray;

+    }

+

+    /**

+     * @return Returns String.

+     * @see javax.xml.stream.XMLStreamReader#getText()

+     */

+    public String getText() {

+        String returnString = null;

+        if (parser != null) {

+            returnString = parser.getText();

+        } else {

+            if (hasText()) {

+                if (lastNode instanceof OMText) {

+                    returnString = ((OMText) lastNode).getText();

+                } else if (lastNode instanceof OMComment) {

+                    returnString = ((OMComment) lastNode).getValue();

+                }

+            }

+        }

+        return returnString;

+    }

+

+    /**

+     * @return Returns int.

+     * @see javax.xml.stream.XMLStreamReader#getEventType()

+     */

+

+    // todo this should be improved

+    public int getEventType() {

+        return currentEvent;

+    }

+

+    /**

+     * @param i

+     * @return Returns String.

+     * @see javax.xml.stream.XMLStreamReader#getNamespaceURI

+     */

+    public String getNamespaceURI(int i) {

+        String returnString = null;

+        if (parser != null) {

+            returnString = parser.getNamespaceURI(i);

+

+        } else {

+            if (isStartElement() || isEndElement()

+                    || (currentEvent == NAMESPACE)) {

+                OMNamespace ns = (OMNamespace) getItemFromIterator(

+                        ((OMElement) lastNode).getAllDeclaredNamespaces(), i);

+                returnString = (ns == null)

+                        ? null

+                        : ns.getNamespaceURI();

+            }

+        }

+

+         /*

+           The following line is necessary to overcome an issue where the empty

+           namespace URI returning null rather than the empty string. Our resolution

+           is to return "" if the return is actually null

+

+           Note that this is not the case for  getNamespaceURI(prefix) method

+           where the contract clearly specifies that the return may be null

+

+         */

+        if (returnString==null) returnString = "";

+

+        return returnString;

+    }

+

+    /**

+     * @param i

+     * @return Returns String.

+     * @see javax.xml.stream.XMLStreamReader#getNamespacePrefix

+     */

+    public String getNamespacePrefix(int i) {

+        String returnString = null;

+        if (parser != null) {

+            returnString = parser.getNamespacePrefix(i);

+        } else {

+            if (isStartElement() || isEndElement()

+                    || (currentEvent == NAMESPACE)) {

+                OMNamespace ns = (OMNamespace) getItemFromIterator(

+                        ((OMElement) lastNode).getAllDeclaredNamespaces(), i);

+                returnString = (ns == null)

+                        ? null

+                        : ns.getPrefix();

+            }

+        }

+        return returnString;

+    }

+

+    /**

+     * @return Returns int.

+     * @see javax.xml.stream.XMLStreamReader#getNamespaceCount()

+     */

+    public int getNamespaceCount() {

+        int returnCount = 0;

+        if (parser != null) {

+            returnCount = parser.getNamespaceCount();

+        } else {

+            if (isStartElement() || isEndElement()

+                    || (currentEvent == NAMESPACE)) {

+                returnCount =

+                        getCount(

+                                ((OMElement) lastNode).getAllDeclaredNamespaces());

+            }

+        }

+        return returnCount;

+    }

+

+    /**

+     * @param i

+     * @return Returns boolean.

+     * @see javax.xml.stream.XMLStreamReader#isAttributeSpecified

+     */

+    public boolean isAttributeSpecified(int i) {

+        boolean returnValue = false;

+        if (parser != null) {

+            returnValue = parser.isAttributeSpecified(i);

+        } else {

+            if (isStartElement() || (currentEvent == ATTRIBUTE)) {

+

+                // theres nothing to be returned here

+            } else {

+                throw new IllegalStateException(

+                        "attribute type accessed in illegal event!");

+            }

+        }

+        return returnValue;

+    }

+

+    /**

+     * @param i

+     * @return Returns String.

+     * @see javax.xml.stream.XMLStreamReader#getAttributeValue

+     */

+    public String getAttributeValue(int i) {

+        String returnString = null;

+        if (parser != null) {

+            returnString = parser.getAttributeValue(i);

+        } else {

+            if (isStartElement() || (currentEvent == ATTRIBUTE)) {

+                OMAttribute attrib = getAttribute((OMElement) lastNode, i);

+                if (attrib != null) {

+                    returnString = attrib.getAttributeValue();

+                }

+            } else {

+                throw new IllegalStateException(

+                        "attribute type accessed in illegal event!");

+            }

+        }

+        return returnString;

+    }

+

+    /**

+     * @param i

+     * @return Returns String.

+     * @see javax.xml.stream.XMLStreamReader#getAttributeType

+     */

+    public String getAttributeType(int i) {

+        String returnString = null;

+        if (parser != null) {

+            returnString = parser.getAttributeType(i);

+        } else {

+            if (isStartElement() || (currentEvent == ATTRIBUTE)) {

+

+                // todo implement this

+            } else {

+                throw new IllegalStateException(

+                        "attribute type accessed in illegal event!");

+            }

+        }

+        return returnString;

+    }

+

+    /**

+     * @param i

+     * @return Returns String.

+     * @see javax.xml.stream.XMLStreamReader#getAttributePrefix

+     */

+    public String getAttributePrefix(int i) {

+        String returnString = null;

+        if (parser != null) {

+            returnString = parser.getAttributePrefix(i);

+        } else {

+            if (isStartElement() || (currentEvent == ATTRIBUTE)) {

+                OMAttribute attrib = getAttribute((OMElement) lastNode, i);

+                if (attrib != null) {

+                    OMNamespace nameSpace = attrib.getNamespace();

+                    if (nameSpace != null) {

+                        returnString = nameSpace.getPrefix();

+                    }

+                }

+            } else {

+                throw new IllegalStateException(

+                        "attribute prefix accessed in illegal event!");

+            }

+        }

+        return returnString;

+    }

+

+    /**

+     * @param i

+     * @return Returns String.

+     * @see javax.xml.stream.XMLStreamReader#getAttributeLocalName

+     */

+    public String getAttributeLocalName(int i) {

+        String returnString = null;

+        if (parser != null) {

+            returnString = parser.getAttributeLocalName(i);

+        } else {

+            if (isStartElement() || (currentEvent == ATTRIBUTE)) {

+                OMAttribute attrib = getAttribute((OMElement) lastNode, i);

+                if (attrib != null) {

+                    returnString = attrib.getLocalName();

+                }

+            } else {

+                throw new IllegalStateException(

+                        "attribute localName accessed in illegal event!");

+            }

+        }

+        return returnString;

+    }

+

+    /**

+     * @param i

+     * @return Returns String.

+     * @see javax.xml.stream.XMLStreamReader#getAttributeNamespace

+     */

+    public String getAttributeNamespace(int i) {

+        String returnString = null;

+        if (parser != null) {

+            returnString = parser.getAttributeNamespace(i);

+        } else {

+            if (isStartElement() || (currentEvent == ATTRIBUTE)) {

+                OMAttribute attrib = getAttribute((OMElement) lastNode, i);

+                if (attrib != null) {

+                    OMNamespace nameSpace = attrib.getNamespace();

+                    if (nameSpace != null) {

+                        returnString = nameSpace.getNamespaceURI();

+                    }

+                }

+            } else {

+                throw new IllegalStateException(

+                        "attribute nameSpace accessed in illegal event!");

+            }

+        }

+        return returnString;

+    }

+

+    /**

+     * @param i

+     * @return Returns QName.

+     * @see javax.xml.stream.XMLStreamReader#getAttributeName

+     */

+    public QName getAttributeName(int i) {

+        QName returnQName = null;

+        if (parser != null) {

+            returnQName = parser.getAttributeName(i);

+        } else {

+            if (isStartElement() || (currentEvent == ATTRIBUTE)) {

+                returnQName = getAttribute((OMElement) lastNode, i).getQName();

+            } else {

+                throw new IllegalStateException(

+                        "attribute count accessed in illegal event!");

+            }

+        }

+        return returnQName;

+    }

+

+    /**

+     * @return Returns int.

+     * @see javax.xml.stream.XMLStreamReader#getAttributeCount

+     */

+    public int getAttributeCount() {

+        int returnCount = 0;

+        if (parser != null) {

+            returnCount = parser.getAttributeCount();

+        } else {

+            if (isStartElement() || (currentEvent == ATTRIBUTE)) {

+                OMElement elt = (OMElement) lastNode;

+                returnCount = getCount(elt.getAllAttributes());

+            } else {

+                throw new IllegalStateException(

+                        "attribute count accessed in illegal event (" +

+                                currentEvent + ")!");

+            }

+        }

+        return returnCount;

+    }

+

+    // todo

+

+    /**

+     * Method getAttributeValue.

+     *

+     * @param s

+     * @param s1

+     * @return Returns String.

+     */

+    public String getAttributeValue(String s, String s1) {

+        String returnString = null;

+        if (parser != null) {

+            returnString = parser.getAttributeValue(s, s1);

+        } else {

+            if (isStartElement() || (currentEvent == ATTRIBUTE)) {

+                QName qname = new QName(s, s1);

+                OMAttribute attrib = ((OMElement) lastNode).getAttribute(qname);

+                if (attrib != null) {

+                    returnString = attrib.getAttributeValue();

+                }

+            } else {

+                throw new IllegalStateException(

+                        "attribute type accessed in illegal event!");

+            }

+        }

+        return returnString;

+    }

+

+    /**

+     * Method isWhiteSpace.

+     *

+     * @return Returns boolean.

+     */

+    public boolean isWhiteSpace() {

+        boolean b;

+        if (parser != null) {

+            b = parser.isWhiteSpace();

+        } else {

+            b = (currentEvent == SPACE);

+        }

+        return b;

+    }

+

+    /**

+     * Method isCharacters.

+     *

+     * @return Returns boolean.

+     */

+    public boolean isCharacters() {

+        boolean b;

+        if (parser != null) {

+            b = parser.isCharacters();

+        } else {

+            b = (currentEvent == CHARACTERS);

+        }

+        return b;

+    }

+

+    /**

+     * Method isEndElement.

+     *

+     * @return Returns boolean.

+     */

+    public boolean isEndElement() {

+        boolean b;

+        if (parser != null) {

+            b = parser.isEndElement();

+        } else {

+            b = (currentEvent == END_ELEMENT);

+        }

+        return b;

+    }

+

+    /**

+     * @param i

+     * @param s

+     * @param s1

+     * @throws XMLStreamException

+     * @see javax.xml.stream.XMLStreamReader#require(int, String, String)

+     */

+    public void require(int i, String s, String s1) throws XMLStreamException {

+        throw new XMLStreamException();

+    }

+

+    /**

+     * Method isStartElement.

+     *

+     * @return Returns boolean.

+     */

+    public boolean isStartElement() {

+        boolean b;

+        if (parser != null) {

+            b = parser.isStartElement();

+        } else {

+            b = (currentEvent == START_ELEMENT);

+        }

+        return b;

+    }

+

+    /**

+     * Method getNamespaceURI.

+     *

+     * @param prefix

+     * @return Returns String.

+     */

+    public String getNamespaceURI(String prefix) {

+

+        String returnString = null;

+        if (parser != null) {

+            returnString = parser.getNamespaceURI(prefix);

+        } else {

+            if (isStartElement() || isEndElement()

+                    || (currentEvent == NAMESPACE)) {

+

+               if (rootNode instanceof OMElement){

+                   OMNamespace namespaceURI =

+                           ((OMElement) rootNode).findNamespaceURI(prefix);

+                   return namespaceURI!=null?namespaceURI.getNamespaceURI():null;

+               }

+            }

+        }

+

+

+        return returnString;

+    }

+

+    /**

+     * Method close.

+     *

+     * @throws XMLStreamException

+     */

+    public void close() throws XMLStreamException {

+

+        // this doesnot mean anything with respect to the OM

+        if (parser != null) {

+            parser.close();

+        }

+    }

+

+    /**

+     * Method hasNext.

+     *

+     * @return Returns boolean.

+     * @throws XMLStreamException

+     */

+    public boolean hasNext() throws XMLStreamException {

+        if(needToThrowEndDocument){

+            return !(state == DOCUMENT_COMPLETE);

+        } else {

+            return (state != COMPLETED && currentEvent != END_DOCUMENT);

+        }

+    }

+

+    /**

+     * Returns the next tag.

+     *

+     * @return Returns int.

+     * @throws org.apache.axiom.om.impl.exception.OMStreamingException

+     *

+     * @throws XMLStreamException

+     */

+    public int nextTag() throws XMLStreamException {

+        int eventType = next();

+        while((eventType == XMLStreamConstants.CHARACTERS && isWhiteSpace()) // skip whitespace

+            || (eventType == XMLStreamConstants.CDATA && isWhiteSpace()) // skip whitespace

+            || eventType == XMLStreamConstants.SPACE

+            || eventType == XMLStreamConstants.PROCESSING_INSTRUCTION

+            || eventType == XMLStreamConstants.COMMENT) {

+            eventType = next();

+         }

+         if (eventType != XMLStreamConstants.START_ELEMENT && eventType != XMLStreamConstants.END_ELEMENT) {

+             throw new XMLStreamException("expected start or end tag", getLocation());

+         }

+         return eventType;

+    }

+

+    /**

+     * @return Returns String.

+     * @throws XMLStreamException

+     * @see javax.xml.stream.XMLStreamReader#getElementText()

+     */

+    public String getElementText() throws XMLStreamException {

+        if (parser != null) {

+            try {

+                return parser.getElementText();

+            } catch (XMLStreamException e) {

+                throw new OMStreamingException(e);

+            }

+        } else {

+            ///////////////////////////////////////////////////////

+            //// Code block directly from the API documentation ///

+            if(getEventType() != XMLStreamConstants.START_ELEMENT) {

+                throw new XMLStreamException(

+                        "parser must be on START_ELEMENT to read next text", getLocation());

+            }

+            int eventType = next();

+            StringBuffer content = new StringBuffer();

+            while(eventType != XMLStreamConstants.END_ELEMENT ) {

+                if(eventType == XMLStreamConstants.CHARACTERS

+                        || eventType == XMLStreamConstants.CDATA

+                        || eventType == XMLStreamConstants.SPACE

+                        || eventType == XMLStreamConstants.ENTITY_REFERENCE) {

+                    content.append(getText());

+                } else if(eventType == XMLStreamConstants.PROCESSING_INSTRUCTION

+                        || eventType == XMLStreamConstants.COMMENT) {

+                    // skipping

+                } else if(eventType == XMLStreamConstants.END_DOCUMENT) {

+                    throw new XMLStreamException(

+                            "unexpected end of document when reading element text content");

+                } else if(eventType == XMLStreamConstants.START_ELEMENT) {

+                    throw new XMLStreamException(

+                            "element text content may not contain START_ELEMENT");

+                } else {

+                    throw new XMLStreamException(

+                            "Unexpected event type "+eventType, getLocation());

+                }

+                eventType = next();

+            }

+            return content.toString();

+            ///////////////////////////////////////////////////////////////

+        }

+

+    }

+

+    /**

+     * Method next.

+     *

+     * @return Returns int.

+     * @throws XMLStreamException

+     */

+    public int next() throws XMLStreamException {

+        switch (state) {

+            case DOCUMENT_COMPLETE:

+                throw new XMLStreamException("End of the document reached");

+            case COMPLETED:

+                state = DOCUMENT_COMPLETE;

+                currentEvent = END_DOCUMENT;

+                break;

+            case SWITCH_AT_NEXT:

+                state = SWITCHED;

+

+                // load the parser

+                try {

+                    parser = (XMLStreamReader) builder.getParser();

+                } catch (Exception e) {

+                    throw new XMLStreamException("problem accessing the parser. " + e.getMessage(), e);

+                }

+

+                // We should throw an END_DOCUMENT

+                if ((currentEvent == START_DOCUMENT) &&

+                        (currentEvent == parser.getEventType())) {

+                    currentEvent = parser.next();

+                } else {

+                    currentEvent = parser.getEventType();

+                }

+

+                updateCompleteStatus();

+                break;

+            case NAVIGABLE:

+                currentEvent = generateEvents(currentNode);

+                updateCompleteStatus();

+                updateLastNode();

+                break;

+            case SWITCHED:

+                if(parser.hasNext()) {

+                    currentEvent = parser.next();

+                }

+                updateCompleteStatus();

+                break;

+            default :

+                throw new OMStreamingException("unsuppported state!");

+        }

+        return currentEvent;

+    }

+

+    /**

+     * Method getProperty.

+     *

+     * @param s

+     * @return Returns Object.

+     * @throws IllegalArgumentException

+     */

+    public Object getProperty(String s) throws IllegalArgumentException {

+        throw new IllegalArgumentException();

+    }

+

+    /**

+     * This is a very important method. It keeps the navigator one step ahead 

+     * and pushes it one event ahead. If the nextNode is null then navigable is 

+     * set to false. At the same time the parser and builder are set up for 

+     * the upcoming event generation.

+     *

+     * @throws XMLStreamException

+     */

+    private void updateLastNode() throws XMLStreamException {

+        lastNode = currentNode;

+        currentNode = nextNode;

+        try {

+            updateNextNode();

+        } catch (Exception e) {

+            throw new XMLStreamException(e);

+        }

+    }

+

+    /**

+     * Method updateNextNode.

+     */

+    private void updateNextNode() {

+        if (navigator.isNavigable()) {

+            nextNode = navigator.next();

+        } else {

+            if (!switchingAllowed) {

+                if (navigator.isCompleted()) {

+                    nextNode = null;

+

+                } else {

+                    builder.next();

+                    navigator.step();

+                    nextNode = navigator.next();

+                }

+            } else {

+                //at this point check whether the navigator is done

+                //if the navigator is done then we are fine and can directly

+                // jump to the complete state ?

+               if (navigator.isCompleted()) {

+                    nextNode = null;

+               }else{

+                // reset caching (the default is ON so it was not needed in the

+                // earlier case!

+                builder.setCache(false);

+                state = SWITCH_AT_NEXT;

+               }

+            }

+        }

+    }

+

+    /**

+     * Method updateCompleteStatus.

+     */

+    private void updateCompleteStatus() {

+        if (state == NAVIGABLE) {

+            if (rootNode == currentNode) {

+                if (isFirst) {

+                    isFirst = false;

+                } else {

+                    state = COMPLETED;

+                }

+            }

+        } else {

+            if (state == SWITCHED) {

+                if (currentEvent == START_ELEMENT) {

+                    ++depth;

+                } else if (currentEvent == END_ELEMENT) {

+                    --depth;

+                    if(depth < 0) {

+                        state = COMPLETED;

+                    }

+                }

+            }

+            state = (currentEvent == END_DOCUMENT)

+                    ? DOCUMENT_COMPLETE

+                    : state;

+        }

+    }

+

+    /**

+     * Method getNamespaceContext.

+     *

+     * @return Returns NamespaceContext.

+     */

+    public NamespaceContext getNamespaceContext() {

+        return new NamespaceContextImpl(getAllNamespaces(lastNode));

+    }

+

+    /**

+     * Method getEncoding.

+     *

+     * @return Returns String.

+     */

+    public String getEncoding() {

+        return null;

+    }

+

+    /**

+     * Method getLocation.

+     *

+     * @return Returns Location.

+     */

+    public Location getLocation() {

+         return new EmptyOMLocation();

+    }

+

+    /**

+     * Method getVersion.

+     *

+     * @return Returns String.

+     */

+    public String getVersion() {

+        return "1.0"; //todo put the constant

+    }

+

+

+    /**

+     * Method isStandalone.

+     *

+     * @return Returns boolean.

+     */

+    public boolean isStandalone() {

+        return true;

+    }

+

+    /**

+     * Method standaloneSet.

+     *

+     * @return Returns boolean.

+     */

+    public boolean standaloneSet() {

+        return false;

+    }

+

+    /**

+     * Method getCharacterEncodingScheme.

+     *

+     * @return Returns String.

+     */

+    public String getCharacterEncodingScheme() {

+        return "utf-8";

+    }

+

+    /**

+     * Method getPITarget.

+     *

+     * @return Returns String.

+     */

+    public String getPITarget() {

+        throw new UnsupportedOperationException();

+    }

+

+    /**

+     * Method getPIData.

+     *

+     * @return Returns String.

+     */

+    public String getPIData() {

+        throw new UnsupportedOperationException();

+    }

+

+    /*

+     *

+     * ################################################################

+     * Generator methods for the OMNodes returned by the navigator

+     * ################################################################

+     *

+     */

+

+    /**

+     * Method generateEvents.

+     *

+     * @param node

+     * @return Returns int.

+     */

+    private int generateEvents(OMNode node) {

+        int returnEvent = 0;

+        int nodeType = node.getType();

+        switch (nodeType) {

+            case OMNode.ELEMENT_NODE:

+                OMElement element = (OMElement) node;

+                returnEvent = generateElementEvents(element);

+                break;

+            case OMNode.TEXT_NODE:

+                returnEvent = generateTextEvents();

+                break;

+            case OMNode.COMMENT_NODE:

+                returnEvent = generateCommentEvents();

+                break;

+            case OMNode.CDATA_SECTION_NODE:

+                returnEvent = generateCdataEvents();

+                break;

+            default :

+                break;    // just ignore any other nodes

+        }

+        return returnEvent;

+    }

+

+    /**

+     * Method generateElementEvents.

+     *

+     * @param elt

+     * @return Returns int.

+     */

+    private int generateElementEvents(OMElement elt) {

+        int returnValue = START_ELEMENT;

+        if (!elementStack.isEmpty() && elementStack.peek().equals(elt)) {

+            returnValue = END_ELEMENT;

+            elementStack.pop();

+        } else {

+            elementStack.push(elt);

+        }

+        return returnValue;

+    }

+

+    /**

+     * Method generateTextEvents.

+     *

+     * @return Returns int.

+     */

+    private int generateTextEvents() {

+        return CHARACTERS;

+    }

+

+    /**

+     * Method generateCommentEvents

+     *

+     * @return Returns int.

+     */

+    private int generateCommentEvents() {

+        return COMMENT;

+    }

+

+    /**

+     * Method generateCdataEvents

+     *

+     * @return Returns int.

+     */

+    private int generateCdataEvents() {

+        return CDATA;

+    }

+

+    /*

+     * ####################################################################

+     * Other helper methods

+     * ####################################################################

+     */

+

+    /**

+     * helper method getCount.

+     *

+     * @param it

+     * @return Returns int.

+     */

+    private int getCount(Iterator it) {

+        int count = 0;

+        if (it != null) {

+            while (it.hasNext()) {

+                it.next();

+                count++;

+            }

+        }

+        return count;

+    }

+

+    /**

+     * Helper method getItemFromIterator.

+     *

+     * @param it

+     * @param index

+     * @return Returns Object.

+     */

+    private Object getItemFromIterator(Iterator it, int index) {

+        int count = 0;

+        Object returnObject = null;

+        boolean found = false;

+        if (it != null) {

+            while (it.hasNext()) {

+                returnObject = it.next();

+                if (index == count++) {

+                    found = true;

+                    break;

+                }

+            }

+        }

+        if (found) {

+            return returnObject;

+        } else {

+            return null;

+        }

+    }

+

+    /**

+     * Helper method getQName.

+     *

+     * @param element

+     * @return Returns QName.

+     */

+    private QName getQName(OMElement element) {

+        QName returnName;

+        OMNamespace ns = element.getNamespace();

+        String localPart = element.getLocalName();

+        if (ns != null) {

+            String prefix = ns.getPrefix();

+            String uri = ns.getNamespaceURI();

+            if ((prefix == null) || prefix.equals("")) {

+                returnName = new QName(uri, localPart);

+            } else {

+                returnName = new QName(uri, localPart, prefix);

+            }

+        } else {

+            returnName = new QName(localPart);

+        }

+        return returnName;

+    }

+

+    /**

+     * @param elt

+     * @param index

+     * @return Returns OMAttribute.

+     */

+    private OMAttribute getAttribute(OMElement elt, int index) {

+        OMAttribute returnAttrib = null;

+        if (elt != null) {

+            returnAttrib =

+                    (OMAttribute) getItemFromIterator(elt.getAllAttributes(),

+                            index);

+        }

+        return returnAttrib;

+    }

+

+    public void setParser(XMLStreamReader parser) {

+        this.parser = parser;

+    }

+

+    private Map getAllNamespaces(Object contextNode) {

+        if (!(contextNode instanceof OMContainer &&

+                contextNode instanceof OMElement)) {

+            return new HashMap();

+        }

+        Map nsMap = new LinkedHashMap();

+        for (OMContainer context = (OMContainer) contextNode;

+             context != null && !(context instanceof OMDocument);

+             context = ((OMElement) context).getParent()) {

+            OMElement element = (OMElement) context;

+            Iterator i = element.getAllDeclaredNamespaces();

+            while (i != null && i.hasNext()) {

+                addNamespaceToMap((OMNamespace) i.next(),  nsMap);

+            }

+            addNamespaceToMap(element.getNamespace(),  nsMap);

+            for (Iterator iter = element.getAllAttributes();

+                 iter != null && iter.hasNext();) {

+                OMAttribute attr = (OMAttribute) iter.next();

+                addNamespaceToMap(attr.getNamespace(),  nsMap);

+            }

+        }

+        return nsMap;

+    }

+    

+    private void addNamespaceToMap(OMNamespace ns, Map map) {

+        if(map.get(ns.getPrefix())==null) {

+            map.put(ns.getPrefix(), ns.getNamespaceURI());

+        }

+    }

+    public OMXMLParserWrapper getBuilder() {

+        return builder;

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java
new file mode 100644
index 0000000..42936b6
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java
@@ -0,0 +1,541 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.llom;
+
+
+import org.apache.axiom.om.*;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
+import org.apache.axiom.om.impl.OMNamespaceImpl;
+import org.apache.axiom.om.impl.mtom.MTOMStAXSOAPModelBuilder;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.om.util.Base64;
+import org.apache.axiom.om.util.UUIDGenerator;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class OMTextImpl extends OMNodeImpl implements OMText, OMConstants {
+    /**
+     * Field nameSpace used when serializing Binary stuff as MTOM optimized.
+     */
+    public static final OMNamespace XOP_NS = new OMNamespaceImpl(
+            "http://www.w3.org/2004/08/xop/include", "xop");
+
+    protected String value = null;
+    protected char[] charArray;
+
+    protected OMNamespace textNS;
+
+    protected String mimeType;
+
+    protected boolean optimize = false;
+
+    protected boolean isBinary = false;
+
+    /**
+     * Field contentID for the mime part used when serializing Binary stuff as
+     * MTOM optimized.
+     */
+    private String contentID = null;
+
+    /**
+     * Field dataHandler contains the DataHandler
+     * Declaring as Object to remove the dependency on
+     * Javax.activation.DataHandler
+     */
+    private Object dataHandlerObject = null;
+
+    /**
+     * Field localName used when serializing Binary stuff as MTOM optimized.
+     */
+    protected String localName = "Include";
+
+    /**
+     * Field attributes used when serializing Binary stuff as MTOM optimized.
+     */
+    protected OMAttribute attribute;
+    private static final String EMTPY_STRING = "";
+
+    /**
+     * Constructor OMTextImpl.
+     *
+     * @param s
+     */
+    public OMTextImpl(String s, OMFactory factory) {
+        this(s, TEXT_NODE, factory);
+    }
+
+    /**
+     * @param s
+     * @param nodeType - OMText can handle CHARACTERS, SPACES, CDATA and ENTITY REFERENCES.
+     *                 Constants for this can be found in OMNode.
+     */
+    public OMTextImpl(String s, int nodeType, OMFactory factory) {
+        this(null, s, nodeType, factory);
+    }
+ 
+    /**
+     * Constructor OMTextImpl.
+     *
+     * @param parent
+     * @param text
+     */
+    public OMTextImpl(OMContainer parent, String text, OMFactory factory) {
+        this(parent, text, TEXT_NODE, factory);
+    }
+
+    public OMTextImpl(OMContainer parent, String text, int nodeType,
+                      OMFactory factory) {
+        super(parent, factory, true);
+        this.value = text == null ? EMTPY_STRING : text;
+        this.nodeType = nodeType;
+    }
+
+    public OMTextImpl(OMContainer parent, char[] charArray, int nodeType,
+                      OMFactory factory) {
+        super(parent, factory, true);
+        this.charArray = charArray;
+        this.nodeType = nodeType;
+    }
+
+
+    public OMTextImpl(OMContainer parent, QName text, OMFactory factory) {
+        this(parent, text, TEXT_NODE, factory);
+    }
+
+    public OMTextImpl(OMContainer parent, QName text, int nodeType,
+                      OMFactory factory) {
+        super(parent, factory, true);
+        this.textNS = ((OMElementImpl) parent).handleNamespace(text);
+        this.value = text == null ? EMTPY_STRING : text.getLocalPart();
+        this.nodeType = nodeType;
+    }
+
+    /**
+     * @param s        - base64 encoded String representation of Binary
+     * @param mimeType of the Binary
+     */
+    public OMTextImpl(String s, String mimeType, boolean optimize,
+                      OMFactory factory) {
+        this(null, s, mimeType, optimize, factory);
+    }
+
+    /**
+     * @param parent
+     * @param s        -
+     *                 base64 encoded String representation of Binary
+     * @param mimeType of the Binary
+     */
+    public OMTextImpl(OMContainer parent, String s, String mimeType,
+                      boolean optimize, OMFactory factory) {
+        this(parent, s, factory);
+        this.mimeType = mimeType;
+        this.optimize = optimize;
+        this.isBinary = true;
+        done = true;
+        this.nodeType = TEXT_NODE;
+    }
+
+    /**
+     * @param dataHandler To send binary optimised content Created programatically.
+     */
+    public OMTextImpl(Object dataHandler, OMFactory factory) {
+        this(dataHandler, true, factory);
+    }
+
+    /**
+     * @param dataHandler
+     * @param optimize    To send binary content. Created progrmatically.
+     */
+    public OMTextImpl(Object dataHandler, boolean optimize, OMFactory factory) {
+        super(factory);
+        this.dataHandlerObject = dataHandler;
+        this.isBinary = true;
+        this.optimize = optimize;
+        done = true;
+        this.nodeType = TEXT_NODE;
+    }
+
+    /**
+     * @param contentID
+     * @param parent
+     * @param builder   Used when the builder is encountered with a XOP:Include tag
+     *                  Stores a reference to the builder and the content-id. Supports
+     *                  deferred parsing of MIME messages.
+     */
+    public OMTextImpl(String contentID, OMContainer parent,
+                      OMXMLParserWrapper builder, OMFactory factory) {
+        super(parent, factory, false);
+        this.contentID = contentID;
+        this.optimize = true;
+        this.isBinary = true;
+        this.builder = builder;
+        this.nodeType = TEXT_NODE;
+    }
+
+    /**
+     * @param writer
+     * @throws XMLStreamException
+     */
+    public void internalSerialize(XMLStreamWriter writer) throws XMLStreamException {
+        internalSerializeLocal(writer);
+    }
+
+    /**
+     * Writes the relevant output.
+     *
+     * @param writer
+     * @throws XMLStreamException
+     */
+    private void writeOutput(XMLStreamWriter writer) throws XMLStreamException {
+        int type = getType();
+        if (type == TEXT_NODE || type == SPACE_NODE) {
+            writer.writeCharacters(this.getText());
+        } else if (type == CDATA_SECTION_NODE) {
+            writer.writeCData(this.getText());
+        } else if (type == ENTITY_REFERENCE_NODE) {
+            writer.writeEntityRef(this.getText());
+        }
+    }
+
+    /**
+     * Returns the value.
+     */
+    public String getText() throws OMException {
+        if (textNS != null) {
+            return getTextString();
+        } else if (charArray != null || this.value != null) {
+            return getTextFromProperPlace();
+        } else {
+            try {
+                InputStream inStream;
+                inStream = this.getInputStream();
+                byte[] data;
+                StringBuffer text = new StringBuffer();
+                do {
+                    data = new byte[1024];
+                    int len;
+                    while ((len = inStream.read(data)) > 0) {
+                        byte[] temp = new byte[len];
+                        System.arraycopy(data, 0, temp, 0, len);
+                        text.append(Base64.encode(temp));
+                    }
+
+                } while (inStream.available() > 0);
+
+                return text.toString();
+            } catch (Exception e) {
+                throw new OMException(e);
+            }
+        }
+    }
+
+    public char[] getTextCharacters() {
+        return charArray != null ? charArray : value.toCharArray();
+    }
+
+    public boolean isCharacters() {
+        return charArray != null;
+    }
+
+    /**
+     * This OMText contains two data source:value and charArray. This method will return text from
+     * correct place.
+     */
+    private String getTextFromProperPlace() {
+        return charArray != null ? new String(charArray) : value;
+    }
+
+
+    /**
+     * Returns the value.
+     */
+    public QName getTextAsQName() throws OMException {
+        if (textNS != null) {
+            String prefix = textNS.getPrefix();
+            String name = textNS.getNamespaceURI();
+            if (prefix == null || "".equals(prefix)) {
+                return new QName(name, getTextFromProperPlace());
+            } else {
+                return new QName(textNS.getNamespaceURI(), getTextFromProperPlace(), prefix);
+            }
+        } else if (this.value != null || charArray != null) {
+            return new QName(getTextFromProperPlace());
+        } else {
+            try {
+                InputStream inStream;
+                inStream = this.getInputStream();
+                byte[] data;
+                StringBuffer text = new StringBuffer();
+                do {
+                    data = new byte[1024];
+                    int len;
+                    while ((len = inStream.read(data)) > 0) {
+                        byte[] temp = new byte[len];
+                        System.arraycopy(data, 0, temp, 0, len);
+                        text.append(Base64.encode(temp));
+                    }
+
+                } while (inStream.available() > 0);
+
+                return new QName(text.toString());
+            } catch (Exception e) {
+                throw new OMException(e);
+            }
+        }
+    }
+    
+	/* (non-Javadoc)
+	 * @see org.apache.axiom.om.OMText#getNamespace()
+	 */
+	public OMNamespace getNamespace() {
+		return textNS;
+	}
+
+    public boolean isOptimized() {
+        return optimize;
+    }
+
+    public void setOptimize(boolean value) {
+        this.optimize = value;
+        if (value) {
+            isBinary = true;
+        }
+    }
+
+    /**
+     * Receiving binary can happen as either MTOM attachments or as Base64 Text
+     * In the case of Base64 user has to explicitly specify that the content is 
+     * binary, before calling getDataHandler(), getInputStream()....
+     */
+    public void setBinary(boolean value) {     
+            isBinary = value;
+    }
+    
+    public boolean isBinary()
+    {
+    	return isBinary;
+    }
+
+
+    /**
+     * Gets the datahandler.
+     *
+     * @return Returns javax.activation.DataHandler
+     */
+    public Object getDataHandler() {
+        if ((value != null || charArray != null || textNS != null) & isBinary) {
+            String text = textNS == null ? getTextFromProperPlace() : getTextString();
+            return org.apache.axiom.attachments.utils.DataHandlerUtils.getDataHandlerFromText(text, mimeType);
+        } else {
+
+            if (dataHandlerObject == null) {
+                if (contentID == null) {
+                    throw new RuntimeException("ContentID is null");
+                }
+                dataHandlerObject = ((MTOMStAXSOAPModelBuilder) builder)
+                        .getDataHandler(contentID);
+            }
+            return dataHandlerObject;
+        }
+    }
+
+    private String getTextString() {
+        if (textNS != null) {
+            String prefix = textNS.getPrefix();
+            if (prefix == null || "".equals(prefix)) {
+                return getTextFromProperPlace();
+            } else {
+                return prefix + ":" + getTextFromProperPlace();
+            }
+        }
+
+        return null;
+    }
+
+    public String getLocalName() {
+        return localName;
+    }
+
+    public java.io.InputStream getInputStream() throws OMException {
+        if (isBinary) {
+            if (dataHandlerObject == null) {
+                getDataHandler();
+            }
+            InputStream inStream;
+            javax.activation.DataHandler dataHandler = (javax.activation.DataHandler) dataHandlerObject;
+            try {
+                inStream = dataHandler.getDataSource().getInputStream();
+            } catch (IOException e) {
+                throw new OMException(
+                        "Cannot get InputStream from DataHandler." + e);
+            }
+            return inStream;
+        } else {
+            throw new OMException("Unsupported Operation");
+        }
+    }
+
+    public String getContentID() {
+        if (contentID == null) {
+            contentID = UUIDGenerator.getUUID()
+                    + "@apache.org";
+        }
+        return this.contentID;
+    }
+
+    public void internalSerializeAndConsume(XMLStreamWriter writer)
+            throws XMLStreamException {
+        internalSerializeLocal(writer);
+    }
+
+    private void internalSerializeLocal(XMLStreamWriter writer2) throws XMLStreamException {
+        
+        if (!this.isBinary) {
+            writeOutput(writer2);
+        } else {
+            //check whether we have a MTOMXMLStreamWriter. if so
+            //we can optimize the writing!
+            if (writer2 instanceof MTOMXMLStreamWriter){
+                MTOMXMLStreamWriter writer = (MTOMXMLStreamWriter) writer2;
+                if (writer.isOptimized()) {
+                    if (contentID == null) {
+                        contentID = writer.getNextContentId();
+                    }
+                    // send binary as MTOM optimised
+                    this.attribute = new OMAttributeImpl("href",
+                            new OMNamespaceImpl("", ""), "cid:" + getContentID(), this.factory);
+                    this.serializeStartpart(writer);
+                    writer.writeOptimized(this);
+                    writer.writeEndElement();
+                } else {
+                    //do normal base64
+                    writeOutput(writer);
+                }
+            }else{
+               //we do not have a optimized writer. Just do the normal
+               //base64 writing
+                writeOutput(writer2);
+            }
+
+        }
+    }
+
+    /*
+     * Methods to copy from OMSerialize utils
+     */
+    private void serializeStartpart(XMLStreamWriter writer)
+            throws XMLStreamException {
+        String nameSpaceName = XOP_NS.getNamespaceURI();
+        String writer_prefix = writer.getPrefix(nameSpaceName);
+        String prefix = XOP_NS.getPrefix();
+        if (writer_prefix != null) {
+            writer.writeStartElement(nameSpaceName, this
+                    .getLocalName());
+        } else {
+        	// According to StAX, setPrefix must occur before
+        	// writeStartElement
+        	if (OMSerializerUtil.isSetPrefixBeforeStartElement(writer)) {
+        		writer.setPrefix(prefix, nameSpaceName);
+        		writer.writeStartElement(prefix, this.getLocalName(),
+        				nameSpaceName);
+        	} else {
+        		writer.writeStartElement(prefix, this.getLocalName(),
+        				nameSpaceName);
+        		writer.setPrefix(prefix, nameSpaceName);
+        	}
+        }
+        // add the elements attribute "href"
+        serializeAttribute(this.attribute, writer);
+        // add the namespace
+        serializeNamespace(XOP_NS, writer);
+    }
+
+    /**
+     * Method serializeAttribute.
+     *
+     * @param attr
+     * @throws XMLStreamException
+     */
+    static void serializeAttribute(OMAttribute attr, XMLStreamWriter writer)
+            throws XMLStreamException {
+        // first check whether the attribute is associated with a namespace
+        OMNamespace ns = attr.getNamespace();
+        String prefix;
+        String namespaceName;
+        if (ns != null) {
+            // add the prefix if it's availble
+            prefix = ns.getPrefix();
+            namespaceName = ns.getNamespaceURI();
+            if (prefix != null) {
+                writer.writeAttribute(prefix, namespaceName, attr
+                        .getLocalName(), attr.getAttributeValue());
+            } else {
+                writer.writeAttribute(namespaceName, attr.getLocalName(), attr
+                        .getAttributeValue());
+            }
+        } else {
+            writer.writeAttribute(attr.getLocalName(), attr.getAttributeValue());
+        }
+    }
+
+    /**
+     * Method serializeNamespace.
+     *
+     * @param namespace
+     * @param writer
+     * @throws XMLStreamException
+     */
+    static void serializeNamespace(OMNamespace namespace, XMLStreamWriter writer)
+            throws XMLStreamException {
+        if (namespace != null) {
+            String uri = namespace.getNamespaceURI();
+            String ns_prefix = namespace.getPrefix();
+            writer.writeNamespace(ns_prefix, namespace.getNamespaceURI());
+            writer.setPrefix(ns_prefix, uri);
+        }
+    }
+
+    /**
+     * A slightly different implementation of the discard method.
+     *
+     * @throws OMException
+     */
+    public void discard() throws OMException {
+        if (done) {
+            this.detach();
+        } else {
+            builder.discard((OMElement) this.parent);
+        }
+    }
+
+	/* (non-Javadoc)
+	 * @see org.apache.axiom.om.OMNode#buildAll()
+	 */
+	public void buildWithAttachments() {
+		if (!this.done) {
+			this.build();
+		}
+		if (isOptimized()) {
+			this.getDataHandler();
+		}
+	}
+
+}
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java
new file mode 100644
index 0000000..aa2f53c
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListImplFactory.java
@@ -0,0 +1,272 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.llom.factory;

+

+import org.apache.axiom.om.*;

+import org.apache.axiom.om.impl.OMNamespaceImpl;

+import org.apache.axiom.om.impl.llom.*;

+

+import javax.xml.namespace.QName;

+import java.util.HashMap;

+import java.util.Map;

+

+/**

+ * Class OMLinkedListImplFactory

+ */

+public class OMLinkedListImplFactory implements OMFactory {

+

+    private static final String uriAndPrefixSeparator = ";";

+    /**

+     * This is a map of namespaces with the namespace URI as the key and

+     * Namespace object itself as the value.

+     */

+    protected Map namespaceTable = new HashMap(5);

+

+    /**

+     * Method createOMElement.

+     *

+     * @param localName

+     * @param ns

+     * @return Returns OMElement.

+     */

+    public OMElement createOMElement(String localName, OMNamespace ns) {

+        return new OMElementImpl(localName, ns, this);

+    }

+

+    public OMElement createOMElement(String localName, OMNamespace ns, OMContainer parent) {

+        return new OMElementImpl(localName, ns, parent, this);

+    }

+

+    /**

+     * Method createOMElement.

+     *

+     * @param localName

+     * @param ns

+     * @param parent

+     * @param builder

+     * @return Returns OMElement.

+     */

+    public OMElement createOMElement(String localName, OMNamespace ns,

+                                     OMContainer parent,

+                                     OMXMLParserWrapper builder) {

+        return new OMElementImpl(localName, ns, parent,

+                builder, this);

+    }

+

+    /**

+     * Method createOMElement.

+     *

+     * @param localName

+     * @param namespaceURI

+     * @param namespacePrefix

+     * @return Returns OMElement.

+     */

+    public OMElement createOMElement(String localName, String namespaceURI,

+                                     String namespacePrefix) {

+        return this.createOMElement(localName,

+                this.createOMNamespace(namespaceURI,

+                        namespacePrefix));

+    }

+

+    /**

+     * Method createOMElement.

+     *

+     * @param qname

+     * @param parent

+     * @return Returns OMElement.

+     * @throws OMException

+     */

+    public OMElement createOMElement(QName qname, OMContainer parent)

+            throws OMException {

+        return new OMElementImpl(qname, parent, this);

+    }

+

+    /**

+     * Construct element with arbitrary data source.

+     *

+     * @param source

+     * @param localName

+     * @param ns

+     */

+    public OMElement createOMElement(OMDataSource source, String localName, OMNamespace ns) {

+        return new OMSourcedElementImpl(localName, ns, this, source);

+    }

+

+    /**

+     * Method createOMNamespace.

+     *

+     * @param uri

+     * @param prefix

+     * @return Returns OMNamespace.

+     */

+    public OMNamespace createOMNamespace(String uri, String prefix) {

+        String key = uri + uriAndPrefixSeparator + prefix;

+        OMNamespace existingNamespaceObject = (OMNamespace) namespaceTable.get(key);

+        if (existingNamespaceObject == null) {

+            existingNamespaceObject = new OMNamespaceImpl(uri, prefix);

+            namespaceTable.put(key, existingNamespaceObject);

+        }

+        return existingNamespaceObject;

+    }

+

+    /**

+     * Method createOMText.

+     *

+     * @param parent

+     * @param text

+     * @return Returns OMText.

+     */

+    public OMText createOMText(OMContainer parent, String text) {

+        return new OMTextImpl(parent, text, this);

+    }

+

+    public OMText createOMText(OMContainer parent, QName text) {

+        return new OMTextImpl(parent, text, this);

+    }

+

+    public OMText createOMText(OMContainer parent, String text, int type) {

+        return new OMTextImpl(parent, text, type, this);

+    }

+

+    public OMText createOMText(OMContainer parent, char[] charArary, int type) {

+        return new OMTextImpl(parent, charArary, type, this);

+    }

+

+    public OMText createOMText(OMContainer parent, QName text, int type) {

+        return new OMTextImpl(parent, text, type, this);

+    }

+

+    /**

+     * Method createOMText.

+     *

+     * @param s

+     * @return Returns OMText.

+     */

+    public OMText createOMText(String s) {

+        return new OMTextImpl(s, this);

+    }

+

+    public OMText createOMText(String s, int type) {

+        return new OMTextImpl(s, type, this);

+    }

+

+    /**

+     * Creates text.

+     *

+     * @param s

+     * @param mimeType

+     * @param optimize

+     * @return Returns OMText.

+     */

+    public OMText createOMText(String s, String mimeType, boolean optimize) {

+        return new OMTextImpl(s, mimeType, optimize, this);

+    }

+

+    /**

+     * Creates text.

+     *

+     * @param dataHandler

+     * @param optimize

+     * @return Returns OMText.

+     */

+    public OMText createOMText(Object dataHandler, boolean optimize) {

+        return new OMTextImpl(dataHandler, optimize, this);

+    }

+

+    public OMText createOMText(String contentID, OMContainer parent,

+                               OMXMLParserWrapper builder) {

+        return new OMTextImpl(contentID, parent, builder, this);

+    }

+

+    /**

+     * Creates text.

+     *

+     * @param parent

+     * @param s

+     * @param mimeType

+     * @param optimize

+     * @return Returns OMText.

+     */

+    public OMText createOMText(OMContainer parent,

+                               String s,

+                               String mimeType,

+                               boolean optimize) {

+        return new OMTextImpl(parent, s, mimeType, optimize, this);

+    }

+

+    /**

+     * Creates attribute.

+     *

+     * @param localName

+     * @param ns

+     * @param value

+     * @return Returns OMAttribute.

+     */

+    public OMAttribute createOMAttribute(String localName,

+                                         OMNamespace ns,

+                                         String value) {

+        return new OMAttributeImpl(localName, ns, value, this);

+    }

+

+    /**

+     * Creates DocType/DTD.

+     *

+     * @param parent

+     * @param content

+     * @return Returns doctype.

+     */

+    public OMDocType createOMDocType(OMContainer parent, String content) {

+        return new OMDocTypeImpl(parent, content, this);

+    }

+

+    /**

+     * Creates a PI.

+     *

+     * @param parent

+     * @param piTarget

+     * @param piData

+     * @return Returns OMProcessingInstruction.

+     */

+    public OMProcessingInstruction createOMProcessingInstruction(OMContainer parent, String piTarget, String piData) {

+        return new OMProcessingInstructionImpl(parent, piTarget, piData, this);

+    }

+

+    /**

+     * Creates a comment.

+     *

+     * @param parent

+     * @param content

+     * @return Returns OMComment.

+     */

+    public OMComment createOMComment(OMContainer parent, String content) {

+        return new OMCommentImpl(parent, content, this);

+    }

+

+    /* (non-Javadoc)

+    * @see org.apache.axiom.om.OMFactory#createOMDocument()

+    */

+    public OMDocument createOMDocument() {

+        return new OMDocumentImpl();

+    }

+

+    /* (non-Javadoc)

+      * @see org.apache.axiom.om.OMFactory#createOMDocument(org.apache.axiom.om.OMXMLParserWrapper)

+      */

+    public OMDocument createOMDocument(OMXMLParserWrapper builder) {

+        return new OMDocumentImpl(builder);

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMXMLBuilderFactory.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMXMLBuilderFactory.java
new file mode 100644
index 0000000..c61bb51
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMXMLBuilderFactory.java
@@ -0,0 +1,73 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.llom.factory;

+

+import org.apache.axiom.om.OMFactory;

+import org.apache.axiom.om.impl.builder.StAXOMBuilder;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;

+

+import javax.xml.stream.XMLStreamReader;

+

+/**

+ * Class OMXMLBuilderFactory

+ */

+public class OMXMLBuilderFactory {

+    /**

+     * Field PARSER_XPP

+     */

+    public static final String PARSER_XPP = "XPP";

+

+    /**

+     * Field PARSER_STAX

+     */

+    public static final String PARSER_STAX = "StAX";

+

+    /**

+     * Field MODEL_SOAP_SPECIFIC

+     */

+    public static final String MODEL_SOAP_SPECIFIC = "SOAP_SPECIFIC";

+

+    /**

+     * Field MODEL_OM

+     */

+    public static final String MODEL_OM = "OM_ONLY";

+

+    /**

+     * Method createStAXSOAPModelBuilder.

+     *

+     * @param soapFactory

+     * @param parser

+     * @return Returns StAXSOAPModelBuilder.

+     */

+    public static StAXSOAPModelBuilder createStAXSOAPModelBuilder(

+            SOAPFactory soapFactory, XMLStreamReader parser) {

+        return new StAXSOAPModelBuilder(parser, soapFactory, null);

+    }

+

+    /**

+     * Method createStAXOMBuilder.

+     *

+     * @param ombuilderFactory

+     * @param parser

+     * @return Returns StAXOMBuilder.

+     */

+    public static StAXOMBuilder createStAXOMBuilder(OMFactory ombuilderFactory,

+                                                    XMLStreamReader parser) {

+        return new StAXOMBuilder(ombuilderFactory, parser);

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/util/NamespaceContextImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/util/NamespaceContextImpl.java
new file mode 100644
index 0000000..9f5343e
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/util/NamespaceContextImpl.java
@@ -0,0 +1,120 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.llom.util;

+

+import javax.xml.XMLConstants;

+import javax.xml.namespace.NamespaceContext;

+import java.util.Collections;

+import java.util.HashSet;

+import java.util.Iterator;

+import java.util.Map;

+import java.util.Set;

+

+public class NamespaceContextImpl

+        implements

+        NamespaceContext {

+    protected Map namespaces;

+

+    public NamespaceContextImpl(Map map) {

+        namespaces = map;

+    }

+

+    /**

+     * Get the URI given a prefix

+     *

+     * @param prefix

+     * @return uri string

+     */

+    public String getNamespaceURI(String prefix) {

+        if (prefix == null) {

+            throw new IllegalArgumentException("null prefix argument is invalid");

+        } else if (prefix.equals(XMLConstants.XML_NS_PREFIX)) {

+            return XMLConstants.XML_NS_URI;

+        } else if (prefix.equals(XMLConstants.XMLNS_ATTRIBUTE)) {

+            return XMLConstants.XMLNS_ATTRIBUTE_NS_URI;

+        } else if (namespaces.containsKey(prefix)) {

+            return (String) namespaces.get(prefix);

+        }

+        return null;

+    }

+

+    /**

+     * Get the prefix for a uri

+     *

+     * @param nsURI

+     * @return prefix string

+     */

+    public String getPrefix(String nsURI) {

+        if (nsURI == null) {

+            throw new IllegalArgumentException("invalid null nsURI");

+        } else if (nsURI.length() == 0) {

+            throw new IllegalArgumentException("invalid empty nsURI");

+        } else if (nsURI.equals(XMLConstants.XML_NS_URI)) {

+            return XMLConstants.XML_NS_PREFIX;

+        } else if (nsURI.equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) {

+            return XMLConstants.XMLNS_ATTRIBUTE;

+        }

+        Iterator iter = namespaces.entrySet().iterator();

+        while (iter.hasNext()) {

+            Map.Entry entry = (Map.Entry) iter.next();

+            String uri = (String) entry.getValue();

+            if (uri.equals(nsURI)) {

+                return (String) entry.getKey();

+            }

+        }

+        if (nsURI.length() == 0) {

+            return "";

+        }

+        return null;

+    }

+

+    /**

+     * Get list of prefixes

+     *

+     * @param nsURI

+     * @return iterator (of strings)

+     */

+    public Iterator getPrefixes(String nsURI) {

+        if (nsURI == null) {

+            throw new IllegalArgumentException("invalid null nsURI");

+        } else if (nsURI.equals(XMLConstants.XML_NS_URI)) {

+            return Collections.singleton(XMLConstants.XML_NS_PREFIX).iterator();

+        } else if (nsURI.equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) {

+            return Collections.singleton(XMLConstants.XMLNS_ATTRIBUTE)

+                    .iterator();

+        }

+        Set prefixes = null;

+        Iterator iter = namespaces.entrySet().iterator();

+        while (iter.hasNext()) {

+            Map.Entry entry = (Map.Entry) iter.next();

+            String uri = (String) entry.getValue();

+            if (uri.equals(nsURI)) {

+                if (prefixes == null) {

+                    prefixes = new HashSet();

+                }

+                prefixes.add(entry.getKey());

+            }

+        }

+        if (prefixes != null) {

+            return Collections.unmodifiableSet(prefixes).iterator();

+        } else if (nsURI.length() == 0) {

+            return Collections.singleton("").iterator();

+        } else {

+            return Collections.EMPTY_LIST.iterator();

+        }

+    }

+}
\ No newline at end of file
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/util/XMLComparator.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/util/XMLComparator.java
new file mode 100644
index 0000000..d1eadb9
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/util/XMLComparator.java
@@ -0,0 +1,222 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.llom.util;

+

+import org.apache.axiom.om.OMAttribute;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMNode;

+import org.apache.axiom.om.impl.exception.XMLComparisonException;

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+

+import java.util.Iterator;

+import java.util.Vector;

+

+public class XMLComparator {

+    /**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+    private Log log = LogFactory.getLog(getClass());

+

+    private Vector ignorableNamespaceList = new Vector();

+

+    public void addIgnorableNamespace(String nsURI){

+        ignorableNamespaceList.add(nsURI);

+    }

+

+    public void clearIgnorableNamespaces(){

+        ignorableNamespaceList.clear();

+    }

+

+

+    public boolean compare(OMElement elementOne, OMElement elementTwo) throws XMLComparisonException {

+

+        //ignore if the elements belong to any of the ignorable namespaces list

+        if (isIgnorable(elementOne) ||

+                isIgnorable(elementTwo)){

+            return true;

+        }

+

+        if (elementOne == null && elementTwo == null) {

+            log.info("Both Elements are null.");

+            return true;

+        }

+        if (elementOne == null && elementTwo != null) {

+            throw new XMLComparisonException(

+                    "Element One is null and Element Two is not null");

+        }

+        if (elementOne != null && elementTwo == null) {

+            throw new XMLComparisonException(

+                    "Element Two is null and Element One is not null");

+        }

+

+        log.info(

+                "Now Checking " + elementOne.getLocalName() + " and " +

+                elementTwo.getLocalName() +

+                "=============================");

+

+        log.info("Comparing Element Names .......");

+        compare("Elements names are not equal. ",

+                elementOne.getLocalName(),

+                elementTwo.getLocalName());

+

+        log.info("Comparing Namespaces .........");

+        compare("Element namespaces are not equal",

+                elementOne.getNamespace(),

+                elementTwo.getNamespace());

+

+        log.info("Comparing attributes .....");

+        compareAllAttributes(elementOne, elementTwo);

+

+        log.info("Comparing texts .....");

+

+        /*

+        * Trimming the value of the XMLElement is not correct

+        * since this compare method cannot be used to compare

+        * element contents with trailing and leading whitespaces

+        * BUT for the practicalltiy of tests and to get the current

+        * tests working we have to trim() the contents

+        */

+        compare("Elements texts are not equal ",

+                elementOne.getText().trim(),

+                elementTwo.getText().trim());

+

+        log.info("Comparing Children ......");

+        compareAllChildren(elementOne, elementTwo);

+

+

+        return true;

+    }

+

+    private void compareAllAttributes(OMElement elementOne,

+                                      OMElement elementTwo) throws XMLComparisonException {

+        compareAttibutes(elementOne, elementTwo);

+        compareAttibutes(elementTwo, elementOne);

+    }

+

+    private void compareAllChildren(OMElement elementOne,

+                                    OMElement elementTwo) throws XMLComparisonException {

+        compareChildren(elementOne, elementTwo);

+        compareChildren(elementTwo, elementOne);

+    }

+

+

+    private boolean isIgnorable(OMElement elt){

+        if (elt!=null){

+            OMNamespace namespace = elt.getNamespace();

+            if (namespace!=null){

+            return ignorableNamespaceList.contains(namespace.getNamespaceURI());

+            }else{

+                return false; 

+            }

+        }else{

+            return false;

+        }

+    }

+

+

+    private void compareChildren(OMElement elementOne, OMElement elementTwo) throws XMLComparisonException {

+        //ignore if the elements belong to any of the ignorable namespaces list

+        if (isIgnorable(elementOne) ||

+                isIgnorable(elementTwo)){

+            return ;

+        }

+        Iterator elementOneChildren = elementOne.getChildren();

+        while (elementOneChildren.hasNext()) {

+            OMNode omNode = (OMNode) elementOneChildren.next();

+            if (omNode instanceof OMElement) {

+                OMElement elementOneChild = (OMElement) omNode;

+                OMElement elementTwoChild = null;

+                //Do the comparison only if the element is not ignorable

+                if (!isIgnorable(elementOneChild)){

+                    elementTwoChild = elementTwo.getFirstChildWithName(

+                            elementOneChild.getQName());

+                    //Do the comparison only if the element is not ignorable

+                    if (!isIgnorable(elementTwoChild)){

+                        if (elementTwoChild == null) {

+                            throw new XMLComparisonException(

+                                    " There is no " + elementOneChild.getLocalName() +

+                                    " element under " +

+                                    elementTwo.getLocalName());

+                        }

+                    }

+                }

+                compare(elementOneChild, elementTwoChild);

+            }

+        }

+    }

+

+

+    private void compareAttibutes(OMElement elementOne, OMElement elementTwo) throws XMLComparisonException {

+        int elementOneAtribCount = 0;

+        int elementTwoAtribCount = 0;

+        Iterator attributes = elementOne.getAllAttributes();

+        while (attributes.hasNext()) {

+            OMAttribute omAttribute = (OMAttribute) attributes.next();

+            OMAttribute attr = elementTwo.getAttribute(

+                    omAttribute.getQName());

+            if (attr == null) {

+                throw new XMLComparisonException(

+                        "Attributes are not the same in two elements. Attribute " +

+                        omAttribute.getLocalName() +

+                        " != ");

+            }

+            elementOneAtribCount++;

+        }

+

+        Iterator elementTwoIter = elementTwo.getAllAttributes();

+        while (elementTwoIter.hasNext()) {

+            elementTwoIter.next();

+            elementTwoAtribCount++;

+

+        }

+

+        if (elementOneAtribCount != elementTwoAtribCount) {

+            throw new XMLComparisonException(

+                    "Attributes are not the same in two elements.");

+        }

+    }

+

+    private void compare(String failureNotice, String one, String two) throws XMLComparisonException {

+        if (!one.equals(two)) {

+            throw new XMLComparisonException(

+                    failureNotice + one + " != " + two);

+        }

+    }

+

+    private void compare(String failureNotice,

+                         OMNamespace one,

+                         OMNamespace two) throws XMLComparisonException {

+        if (one == null && two == null) {

+            return;

+        } else if (one != null && two == null) {

+            throw new XMLComparisonException(

+                    "First Namespace is NOT null. But the second is null");

+        } else if (one == null && two != null) {

+            throw new XMLComparisonException(

+                    "First Namespace is null. But the second is NOT null");

+        }

+

+        if (!one.getNamespaceURI().equals(two.getNamespaceURI())) {

+            throw new XMLComparisonException(

+                    failureNotice + one + " != " + two);

+        }

+

+        // Do we need to compare prefixes as well

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPBodyImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPBodyImpl.java
new file mode 100644
index 0000000..ebb5d2a
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPBodyImpl.java
@@ -0,0 +1,166 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom;

+

+import org.apache.axiom.om.OMConstants;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMException;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMNode;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.soap.SOAP11Constants;

+import org.apache.axiom.soap.SOAP12Constants;

+import org.apache.axiom.soap.SOAPBody;

+import org.apache.axiom.soap.SOAPConstants;

+import org.apache.axiom.soap.SOAPEnvelope;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPFault;

+import org.apache.axiom.soap.SOAPProcessingException;

+

+/**

+ * Class SOAPBodyImpl

+ */

+public abstract class SOAPBodyImpl extends SOAPElement

+        implements SOAPBody, OMConstants {

+    /**

+     * Field hasSOAPFault

+     */

+    private boolean hasSOAPFault = false;

+

+    protected SOAPBodyImpl(String localName, OMNamespace ns, 

+            SOAPFactory factory) {

+        super(localName, ns, factory);

+    }

+

+    /**

+     * @param envelope

+     */

+    public SOAPBodyImpl(SOAPEnvelope envelope, SOAPFactory factory) 

+                            throws SOAPProcessingException {

+        super(envelope, SOAPConstants.BODY_LOCAL_NAME, true, factory);

+

+    }

+

+    /**

+     * Constructor SOAPBodyImpl

+     *

+     * @param envelope

+     * @param builder

+     */

+    public SOAPBodyImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder, 

+            SOAPFactory factory) {

+        super(envelope, SOAPConstants.BODY_LOCAL_NAME, builder, factory);

+    }

+

+    /**

+     * Creates a new <code>SOAPFault</code> object and adds it to

+     * this <code>SOAPBody</code> object.

+     *

+     * @param e

+     * @return the new <code>SOAPFault</code> object

+     * @throws org.apache.axiom.om.OMException

+     *                     if there is a SOAP error

+     * @throws OMException

+     */

+    public abstract SOAPFault addFault(Exception e) throws OMException;

+

+    /**

+     * Indicates whether a <code>SOAPFault</code> object exists in

+     * this <code>SOAPBody</code> object.

+     *

+     * @return <code>true</code> if a <code>SOAPFault</code> object exists in

+     *         this <code>SOAPBody</code> object; <code>false</code>

+     *         otherwise

+     */

+    public boolean hasFault() {

+        if (hasSOAPFault) {

+            return true;

+        } else {

+            OMElement element = getFirstElement();

+            if (element != null

+                    &&

+                    SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(

+                            element.getLocalName())

+                    &&

+                    (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(

+                            element.getNamespace().getNamespaceURI())

+                    ||

+                    SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(

+                            element.getNamespace().getNamespaceURI()))) {  //added this line

+                hasSOAPFault = true;

+                return true;

+            } else {

+                return false;

+            }

+        }

+    }

+

+    /**

+     * Returns the <code>SOAPFault</code> object in this <code>SOAPBody</code>

+     * object.

+     *

+     * @return the <code>SOAPFault</code> object in this <code>SOAPBody</code>

+     *         object

+     */

+    public SOAPFault getFault() {

+        OMElement element = getFirstElement();

+        if (hasSOAPFault) {

+            return (SOAPFault) element;

+        } else if (element != null

+                &&

+                SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(

+                        element.getLocalName())

+                &&

+                (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(

+                        element.getNamespace().getNamespaceURI())

+                ||

+                SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(

+                        element.getNamespace().getNamespaceURI()))) {     //added this line

+            hasSOAPFault = true;

+            return (SOAPFault) element;

+        } else {

+            return null;

+        }

+

+    }

+

+    /**

+     * @param soapFault

+     * @throws org.apache.axiom.om.OMException

+     *

+     * @throws OMException

+     */

+    public void addFault(SOAPFault soapFault) throws OMException {

+        if (hasSOAPFault) {

+            throw new OMException(

+                    "SOAP Body already has a SOAP Fault and there can not be more than one SOAP fault");

+        }

+        addChild(soapFault);

+        hasSOAPFault = true;

+    }

+

+    protected void checkParent(OMElement parent) throws SOAPProcessingException {

+        if (!(parent instanceof SOAPEnvelopeImpl)) {

+            throw new SOAPProcessingException(

+                    "Expecting an implementation of SOAP Envelope as the parent. But received some other implementation");

+        }

+    }

+

+    public OMNode detach() throws OMException {

+        throw new SOAPProcessingException("Can not detach SOAP Body, SOAP Envelope must have a Body !!");

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPElement.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPElement.java
new file mode 100644
index 0000000..613b547
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPElement.java
@@ -0,0 +1,82 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom;

+

+import org.apache.axiom.om.OMContainer;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.om.impl.llom.OMElementImpl;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPProcessingException;

+

+public abstract class SOAPElement extends OMElementImpl {

+

+    /**

+     * @param parent

+     * @param localName

+     * @param extractNamespaceFromParent

+     */

+    protected SOAPElement(OMElement parent,

+                          String localName,

+                          boolean extractNamespaceFromParent,

+                          SOAPFactory factory) throws SOAPProcessingException {

+        super(localName, null, parent, factory);

+        if (parent == null) {

+            throw new SOAPProcessingException(

+                    " Can not create " + localName +

+                            " element without a parent !!");

+        }

+        checkParent(parent);

+

+        if (extractNamespaceFromParent) {

+            this.ns = parent.getNamespace();

+        }

+    }

+

+

+    protected SOAPElement(OMElement parent,

+                          String localName,

+                          OMXMLParserWrapper builder,

+                          SOAPFactory factory) {

+        super(localName, null, parent, builder, factory);

+    }

+

+    /**

+     * @param localName

+     * @param ns

+     */

+    protected SOAPElement(String localName, OMNamespace ns, 

+            SOAPFactory factory) {

+        super(localName, ns, factory);

+    }

+

+    /**

+     * This has to be implemented by all the derived classes to check for the correct parent.

+     */

+    protected abstract void checkParent(OMElement parent) throws SOAPProcessingException;

+

+    public void setParent(OMContainer element) {

+        super.setParent(element);

+

+        if (element instanceof OMElement) {

+            checkParent((OMElement) element);

+        }

+    }

+

+

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java
new file mode 100644
index 0000000..aff2f73
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.llom;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMConstants;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPConstants;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * Class SOAPEnvelopeImpl
+ */
+public class SOAPEnvelopeImpl extends SOAPElement
+        implements SOAPEnvelope, OMConstants {
+
+    /**
+     * @param builder
+     */
+    public SOAPEnvelopeImpl(OMXMLParserWrapper builder, SOAPFactory factory) {
+        super(null, SOAPConstants.SOAPENVELOPE_LOCAL_NAME, builder, factory);
+        this.factory = factory;
+    }
+
+    /**
+     * @param ns
+     */
+    public SOAPEnvelopeImpl(OMNamespace ns, SOAPFactory factory) {
+        super(SOAPConstants.SOAPENVELOPE_LOCAL_NAME, ns, factory);
+        this.factory = factory;
+    }
+
+    /**
+     * Returns the <CODE>SOAPHeader</CODE> object for this <CODE>
+     * SOAPEnvelope</CODE> object. <P> This SOAPHeader will just be a container
+     * for all the headers in the <CODE>OMMessage</CODE> </P>
+     *
+     * @return the <CODE>SOAPHeader</CODE> object or <CODE> null</CODE> if there
+     *         is none
+     * @throws org.apache.axiom.om.OMException
+     *                     if there is a problem obtaining
+     *                     the <CODE>SOAPHeader</CODE>
+     *                     object
+     * @throws OMException
+     */
+    public SOAPHeader getHeader() throws OMException {
+        SOAPHeader header =
+                (SOAPHeader) getFirstChildWithName(
+                        new QName(SOAPConstants.HEADER_LOCAL_NAME));
+        if (builder == null && header == null) {
+            inferFactory();
+            header = ((SOAPFactory) factory).createSOAPHeader(this);
+            addChild(header);
+        }
+        return header;
+    }
+
+    private void inferFactory() {
+        if (ns != null) {
+            if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns.getNamespaceURI())) {
+                factory = OMAbstractFactory.getSOAP12Factory();
+            } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns.getNamespaceURI())) {
+                factory = OMAbstractFactory.getSOAP11Factory();
+            }
+        }
+    }
+
+    public void addChild(OMNode child) {
+        if ((child instanceof OMElement) && !(child instanceof SOAPHeader || child instanceof SOAPBody))
+        {
+            throw new SOAPProcessingException("SOAP Envelope can not have children other than SOAP Header and Body", SOAP12Constants.FAULT_CODE_SENDER);
+        } else {
+            if (this.done && (child instanceof SOAPHeader)) {
+                SOAPBody body = getBody();
+                if (body != null) {
+                    body.insertSiblingBefore(child);
+                    return;
+                }
+            }
+            super.addChild(child);
+        }
+    }
+
+    /**
+     * Returns the <CODE>SOAPBody</CODE> object associated with this
+     * <CODE>SOAPEnvelope</CODE> object. <P> This SOAPBody will just be a
+     * container for all the BodyElements in the <CODE>OMMessage</CODE> </P>
+     *
+     * @return the <CODE>SOAPBody</CODE> object for this <CODE>
+     *         SOAPEnvelope</CODE> object or <CODE>null</CODE> if there is none
+     * @throws org.apache.axiom.om.OMException
+     *                     if there is a problem obtaining
+     *                     the <CODE>SOAPBody</CODE> object
+     * @throws OMException
+     */
+    public SOAPBody getBody() throws OMException {
+        //check for the first element
+        OMElement element = getFirstElement();
+        if (element != null) {
+            if (SOAPConstants.BODY_LOCAL_NAME.equals(element.getLocalName())) {
+                return (SOAPBody) element;
+            } else {      // if not second element SHOULD be the body
+                OMNode node = element.getNextOMSibling();
+                while (node != null && node.getType() != OMNode.ELEMENT_NODE) {
+                    node = node.getNextOMSibling();
+                }
+                element = (OMElement) node;
+
+                if (node != null &&
+                        SOAPConstants.BODY_LOCAL_NAME.equals(element.getLocalName())) {
+                    return (SOAPBody) element;
+                } else {
+                    throw new OMException("SOAPEnvelope must contain a body element which is either first or second child element of the SOAPEnvelope.");
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Method detach
+     *
+     * @throws OMException
+     */
+    public OMNode detach() throws OMException {
+//        throw new OMException("Root Element can not be detached");
+        // I'm confused why this threw an exception as above. One should be able to create
+        // a SOAP envelope and be able to detach from the its parent document.
+        // The example is if I want to send a SOAPEnvelope inside another SOAP message, then this will
+        // not allow to do that.
+        // Must be an idea of a DOM guy ;)
+        return this;
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        // here do nothing as SOAPEnvelope doesn't have a parent !!!
+    }
+
+    protected void internalSerialize(XMLStreamWriter writer2, boolean cache) throws XMLStreamException {
+        MTOMXMLStreamWriter writer = (MTOMXMLStreamWriter) writer2;
+        if (!writer.isIgnoreXMLDeclaration()) {
+            String charSetEncoding = writer.getCharSetEncoding();
+            String xmlVersion = writer.getXmlVersion();
+            writer.getXmlStreamWriter().writeStartDocument(charSetEncoding == null ?
+                    OMConstants.DEFAULT_CHAR_SET_ENCODING : charSetEncoding,
+                    xmlVersion == null ? OMConstants.DEFAULT_XML_VERSION : xmlVersion);
+        }
+        super.internalSerialize(writer, cache);
+    }
+}
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultCodeImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultCodeImpl.java
new file mode 100644
index 0000000..faf0ea1
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultCodeImpl.java
@@ -0,0 +1,81 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom;

+

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.om.util.ElementHelper;

+import org.apache.axiom.soap.SOAP12Constants;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPFault;

+import org.apache.axiom.soap.SOAPFaultCode;

+import org.apache.axiom.soap.SOAPFaultSubCode;

+import org.apache.axiom.soap.SOAPFaultValue;

+import org.apache.axiom.soap.SOAPProcessingException;

+

+public abstract class SOAPFaultCodeImpl extends SOAPElement implements SOAPFaultCode {

+

+

+    protected SOAPFaultCodeImpl(OMNamespace ns, SOAPFactory factory) {

+        super(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME, ns, factory);

+    }

+

+    /**

+     * Constructor OMElementImpl

+     *

+     * @param parent

+     * @param builder

+     */

+    public SOAPFaultCodeImpl(SOAPFault parent, OMXMLParserWrapper builder, 

+            SOAPFactory factory) {

+        super(parent, SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME, builder,

+                factory);

+    }

+

+    /**

+     * @param parent

+     */

+    public SOAPFaultCodeImpl(SOAPFault parent,

+                             boolean extractNamespaceFromParent,

+                             SOAPFactory factory) throws SOAPProcessingException {

+        super(parent,

+                SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME,

+                extractNamespaceFromParent, factory);

+    }

+

+    /**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+    public void setValue(SOAPFaultValue value) throws SOAPProcessingException {

+        ElementHelper.setNewElement(this, value, value);

+    }

+

+    public SOAPFaultValue getValue() {

+        return (SOAPFaultValue) ElementHelper.getChildWithName(this,

+                SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME);

+    }

+

+    public void setSubCode(SOAPFaultSubCode value) throws SOAPProcessingException {

+        ElementHelper.setNewElement(this, getSubCode(), value);

+    }

+

+    public SOAPFaultSubCode getSubCode() {

+        return (SOAPFaultSubCode) ElementHelper.getChildWithName(this,

+                SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME);

+    }

+

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultDetailImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultDetailImpl.java
new file mode 100644
index 0000000..a514c37
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultDetailImpl.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.llom;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.llom.OMNodeImpl;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultDetail;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.util.Iterator;
+
+public abstract class SOAPFaultDetailImpl extends SOAPElement implements SOAPFaultDetail {
+
+
+    protected SOAPFaultDetailImpl(OMNamespace ns, SOAPFactory factory) {
+        super(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME, ns, factory);
+    }
+
+    protected SOAPFaultDetailImpl(SOAPFault parent,
+                                  boolean extractNamespaceFromParent, 
+                                  SOAPFactory factory) throws SOAPProcessingException {
+        super(parent,
+                SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME,
+                extractNamespaceFromParent, factory);
+    }
+
+    protected SOAPFaultDetailImpl(SOAPFault parent,
+                                  OMXMLParserWrapper builder,
+                                  SOAPFactory factory) {
+        super(parent, SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME, builder,
+                factory);
+    }
+
+    public void addDetailEntry(OMElement detailElement) {
+        this.addChild(detailElement);
+    }
+
+    public Iterator getAllDetailEntries() {
+        return this.getChildren();
+    }
+
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException {
+        // select the builder
+        short builderType = PULL_TYPE_BUILDER;    // default is pull type
+        if (builder != null) {
+            builderType = this.builder.getBuilderType();
+        }
+        if ((builderType == PUSH_TYPE_BUILDER)
+                && (builder.getRegisteredContentHandler() == null)) {
+            builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(writer));
+        }
+
+        OMSerializerUtil.serializeStartpart(this, 
+        		SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME, 
+        		writer);
+
+        String text = this.getText();
+        writer.writeCharacters(text);
+
+        OMNode child = firstChild;
+        while (child != null && ((!(child instanceof OMElement)) || child.isComplete())) {
+            ((OMNodeImpl) child).internalSerializeAndConsume(writer);
+            child = child.getNextOMSibling();
+        }
+
+        writer.writeEndElement();
+
+
+    }
+
+}
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultImpl.java
new file mode 100644
index 0000000..203431e
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultImpl.java
@@ -0,0 +1,239 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.llom;
+
+import org.apache.axiom.om.OMConstants;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.om.impl.llom.OMElementImpl;
+import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPConstants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAPFaultDetail;
+import org.apache.axiom.soap.SOAPFaultNode;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPFaultRole;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Iterator;
+
+/**
+ * Class SOAPFaultImpl
+ */
+public abstract class SOAPFaultImpl extends SOAPElement
+        implements SOAPFault, OMConstants {
+
+    protected Exception e;
+
+    protected SOAPFaultImpl(OMNamespace ns, SOAPFactory factory) {
+        super(SOAPConstants.SOAPFAULT_LOCAL_NAME, ns, factory);
+    }
+
+    /**
+     * Constructor SOAPFaultImpl
+     *
+     * @param parent
+     * @param e
+     */
+    public SOAPFaultImpl(SOAPBody parent, Exception e, SOAPFactory factory) throws SOAPProcessingException {
+        super(parent, SOAPConstants.SOAPFAULT_LOCAL_NAME, true, factory);
+        setException(e);
+    }
+
+    public void setException(Exception e) {
+        this.e = e;
+        putExceptionToSOAPFault(e);
+    }
+
+    public SOAPFaultImpl(SOAPBody parent, SOAPFactory factory) throws SOAPProcessingException {
+        super(parent, SOAPConstants.SOAPFAULT_LOCAL_NAME, true, factory);
+    }
+
+    /**
+     * Constructor SOAPFaultImpl
+     *
+     * @param parent
+     * @param builder
+     */
+    public SOAPFaultImpl(SOAPBody parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, SOAPConstants.SOAPFAULT_LOCAL_NAME, builder, factory);
+    }
+
+
+    protected abstract SOAPFaultDetail getNewSOAPFaultDetail(SOAPFault fault) throws SOAPProcessingException;
+
+    // --------------- Getters and Settors --------------------------- //
+
+    public void setCode(SOAPFaultCode soapFaultCode) throws SOAPProcessingException {
+        setNewElement(getCode(), soapFaultCode);
+    }
+
+    public SOAPFaultCode getCode() {
+        return (SOAPFaultCode) this.getChildWithName(
+                SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME);
+    }
+
+    public void setReason(SOAPFaultReason reason) throws SOAPProcessingException {
+        setNewElement(getReason(), reason);
+    }
+
+    public SOAPFaultReason getReason() {
+        return (SOAPFaultReason) this.getChildWithName(
+                SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME);
+    }
+
+    public void setNode(SOAPFaultNode node) throws SOAPProcessingException {
+        setNewElement(getNode(), node);
+    }
+
+    public SOAPFaultNode getNode() {
+        return (SOAPFaultNode) this.getChildWithName(
+                SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME);
+    }
+
+    public void setRole(SOAPFaultRole role) throws SOAPProcessingException {
+        setNewElement(getRole(), role);
+    }
+
+    public SOAPFaultRole getRole() {
+        return (SOAPFaultRoleImpl) this.getChildWithName(
+                SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME);
+    }
+
+    public void setDetail(SOAPFaultDetail detail) throws SOAPProcessingException {
+        setNewElement(getDetail(), detail);
+    }
+
+    public SOAPFaultDetail getDetail() {
+        return (SOAPFaultDetail) this.getChildWithName(
+                SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME);
+    }
+
+    /**
+     * If exception detailElement is not there we will return null
+     */
+    public Exception getException() throws OMException {
+        SOAPFaultDetail detail = getDetail();
+        if (detail == null) {
+            return null;
+        }
+
+        OMElement exceptionElement = getDetail().getFirstChildWithName(
+                new QName(SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY));
+        if (exceptionElement != null && exceptionElement.getText() != null) {
+            return new Exception(exceptionElement.getText());
+        }
+        return null;
+    }
+
+    protected void putExceptionToSOAPFault(Exception e) throws SOAPProcessingException {
+        StringWriter sw = new StringWriter();
+        e.printStackTrace(new PrintWriter(sw));
+        sw.flush();
+        SOAPFaultDetail detail = getDetail();
+        if (getDetail() == null) {
+            detail = getNewSOAPFaultDetail(this);
+            setDetail(detail);
+        }
+        OMElement faultDetailEnty = new OMElementImpl(
+                SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY, null, detail,
+                factory);
+        faultDetailEnty.setText(sw.getBuffer().toString());
+    }
+
+    protected void setNewElement(OMElement myElement, OMElement newElement) {
+        if (myElement != null) {
+            myElement.discard();
+        }
+        if (newElement != null && newElement.getParent() != null) {
+            newElement.discard();
+        }
+        this.addChild(newElement);
+        myElement = newElement;
+    }
+
+    protected OMElement getChildWithName(String childName) {
+        Iterator childrenIter = getChildren();
+        while (childrenIter.hasNext()) {
+            OMNode node = (OMNode) childrenIter.next();
+            if (node.getType() == OMNode.ELEMENT_NODE &&
+                    childName.equals(((OMElement) node).getLocalName())) {
+                return (OMElement) node;
+            }
+        }
+        return null;
+    }
+
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException {
+        // select the builder
+        short builderType = PULL_TYPE_BUILDER;    // default is pull type
+        if (builder != null) {
+            builderType = this.builder.getBuilderType();
+        }
+        if ((builderType == PUSH_TYPE_BUILDER)
+                && (builder.getRegisteredContentHandler() == null)) {
+            builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(writer));
+        }
+
+        // this is a special case. This fault element may contain its children in any order. But spec mandates a specific order
+        // the overriding of the method will facilitate that. Not sure this is the best method to do this :(
+        build();
+
+        OMSerializerUtil.serializeStartpart(this, writer);
+        SOAPFaultCode faultCode = getCode();
+        if (faultCode != null) {
+            ((OMNodeEx) faultCode).internalSerialize(writer);
+        }
+        SOAPFaultReason faultReason = getReason();
+        if (faultReason != null) {
+            ((OMNodeEx) faultReason).internalSerialize(writer);
+        }
+
+        serializeFaultNode(writer);
+
+        SOAPFaultRole faultRole = getRole();
+        if (faultRole != null && faultRole.getText() != null && !"".equals(faultRole.getText())) {
+            ((OMNodeEx) faultRole).internalSerialize(writer);
+        }
+
+        SOAPFaultDetail faultDetail = getDetail();
+        if (faultDetail != null) {
+            ((OMNodeEx) faultDetail).internalSerialize(writer);
+        }
+
+        OMSerializerUtil.serializeEndpart(writer);
+    }
+
+    protected abstract void serializeFaultNode(XMLStreamWriter writer) throws XMLStreamException;
+
+
+}
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultNodeImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultNodeImpl.java
new file mode 100644
index 0000000..46c2a15
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultNodeImpl.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.llom;
+
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultNode;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public abstract class SOAPFaultNodeImpl extends SOAPElement implements SOAPFaultNode {
+
+    protected SOAPFaultNodeImpl(OMNamespace ns, SOAPFactory factory) {
+        super(SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME, ns, factory);
+    }
+
+    public SOAPFaultNodeImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException {
+        super(parent, SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME, true, factory);
+    }
+
+    public SOAPFaultNodeImpl(SOAPFault parent, OMXMLParserWrapper builder,
+                             SOAPFactory factory) {
+        super(parent, SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME, builder, factory);
+    }
+
+    public void setNodeValue(String uri) {
+        this.setText(uri);
+    }
+
+    public String getNodeValue() {
+        return this.getText();
+    }
+
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException {
+            // select the builder
+            short builderType = PULL_TYPE_BUILDER;    // default is pull type
+            if (builder != null) {
+                builderType = this.builder.getBuilderType();
+            }
+            if ((builderType == PUSH_TYPE_BUILDER)
+                    && (builder.getRegisteredContentHandler() == null)) {
+                builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(writer));
+            }
+
+
+            if (!cache) {
+                //No caching
+                if (this.firstChild != null) {
+                    OMSerializerUtil.serializeStartpart(this, writer);
+                    ((OMNodeEx)firstChild).internalSerializeAndConsume(writer);
+                    OMSerializerUtil.serializeEndpart(writer);
+                } else if (!this.done) {
+                    if (builderType == PULL_TYPE_BUILDER) {
+                        OMSerializerUtil.serializeByPullStream(this, writer);
+                    } else {
+                        OMSerializerUtil.serializeStartpart(this, writer);
+                        builder.setCache(cache);
+                        builder.next();
+                        OMSerializerUtil.serializeEndpart(writer);
+                    }
+                } else {
+                    OMSerializerUtil.serializeNormal(this, writer, cache);
+                }
+                // do not serialise the siblings
+
+
+            } else {
+                //Cached
+                OMSerializerUtil.serializeNormal(this, writer, cache);
+
+                // do not serialise the siblings
+            }
+
+
+        }
+
+}
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultReasonImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultReasonImpl.java
new file mode 100644
index 0000000..f674d44
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultReasonImpl.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.llom;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.util.ElementHelper;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPFaultText;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+public abstract class SOAPFaultReasonImpl extends SOAPElement implements SOAPFaultReason {
+
+    protected SOAPFaultReasonImpl(OMNamespace ns, SOAPFactory factory) {
+        super(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME, ns, factory);
+    }
+
+    /**
+     * Constructor OMElementImpl
+     *
+     * @param parent
+     * @param builder
+     */
+    public SOAPFaultReasonImpl(SOAPFault parent, OMXMLParserWrapper builder,
+                               SOAPFactory factory) {
+        super(parent, SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME, builder,
+                factory);
+    }
+
+    /**
+     * @param parent
+     */
+    public SOAPFaultReasonImpl(OMElement parent,
+                               boolean extractNamespaceFromParent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent,
+                SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME,
+                extractNamespaceFromParent,
+                factory);
+    }
+
+    public void addSOAPText(SOAPFaultText soapFaultText) throws SOAPProcessingException {
+        this.addChild(soapFaultText);
+    }
+
+    public SOAPFaultText getFirstSOAPText() {
+        return (SOAPFaultText) ElementHelper.getChildWithName(this,
+                SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME);
+    }
+
+    public List getAllSoapTexts() {
+        List faultTexts = new ArrayList(1);
+        Iterator childrenIter = this.getChildren();
+        while (childrenIter.hasNext()) {
+            OMNode node = (OMNode) childrenIter.next();
+            if (node.getType() == OMNode.ELEMENT_NODE && (node instanceof SOAPFaultTextImpl)) {
+                faultTexts.add(((SOAPFaultTextImpl) node));
+            }
+        }
+        return faultTexts;
+    }
+
+    public SOAPFaultText getSOAPFaultText(String language) {
+        Iterator childrenIter = this.getChildren();
+        while (childrenIter.hasNext()) {
+            OMNode node = (OMNode) childrenIter.next();
+            if (node.getType() == OMNode.ELEMENT_NODE && (node instanceof SOAPFaultTextImpl) && language.equals(((SOAPFaultTextImpl) node).getLang()))
+            {
+                return (SOAPFaultText) node;
+            }
+        }
+
+        return null;
+    }
+
+}
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultRoleImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultRoleImpl.java
new file mode 100644
index 0000000..9101557
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultRoleImpl.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.llom;
+
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public abstract class SOAPFaultRoleImpl extends SOAPElement implements org.apache.axiom.soap.SOAPFaultRole {
+
+    protected SOAPFaultRoleImpl(OMNamespace ns, SOAPFactory factory) {
+        super(SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME, ns, factory);
+    }
+
+    public SOAPFaultRoleImpl(SOAPFault parent,
+                             boolean extractNamespaceFromParent,
+                             SOAPFactory factory) throws SOAPProcessingException {
+        super(parent,
+                SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME,
+                extractNamespaceFromParent,
+                factory);
+    }
+
+    public SOAPFaultRoleImpl(SOAPFault parent, OMXMLParserWrapper builder,
+                             SOAPFactory factory) {
+        super(parent, SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME, builder, factory);
+    }
+
+    public void setRoleValue(String uri) {
+        this.setText(uri);
+    }
+
+    public String getRoleValue() {
+        return this.getText();
+    }
+
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException {
+        // select the builder
+        short builderType = PULL_TYPE_BUILDER;    // default is pull type
+        if (builder != null) {
+            builderType = this.builder.getBuilderType();
+        }
+        if ((builderType == PUSH_TYPE_BUILDER)
+                && (builder.getRegisteredContentHandler() == null)) {
+            builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(writer));
+        }
+
+        if (!cache) {
+            //No caching
+            if (this.firstChild != null) {
+                OMSerializerUtil.serializeStartpart(this, writer);
+                ((OMNodeEx)firstChild).internalSerializeAndConsume(writer);
+                OMSerializerUtil.serializeEndpart(writer);
+            } else if (!this.done) {
+                if (builderType == PULL_TYPE_BUILDER) {
+                    OMSerializerUtil.serializeByPullStream(this, writer);
+                } else {
+                    OMSerializerUtil.serializeStartpart(this, writer);
+                    builder.setCache(cache);
+                    builder.next();
+                    OMSerializerUtil.serializeEndpart(writer);
+                }
+            } else {
+                OMSerializerUtil.serializeNormal(this, writer, cache);
+            }
+            // do not serialise the siblings
+
+
+        } else {
+            //Cached
+            OMSerializerUtil.serializeNormal(this, writer, cache);
+
+            // do not serialise the siblings
+        }
+
+
+    }
+
+}
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultSubCodeImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultSubCodeImpl.java
new file mode 100644
index 0000000..78fc3e9
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultSubCodeImpl.java
@@ -0,0 +1,77 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.om.util.ElementHelper;

+import org.apache.axiom.soap.SOAP12Constants;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPFaultSubCode;

+import org.apache.axiom.soap.SOAPFaultValue;

+import org.apache.axiom.soap.SOAPProcessingException;

+

+public abstract class SOAPFaultSubCodeImpl extends SOAPElement implements SOAPFaultSubCode {

+

+    protected SOAPFaultValue value;

+    protected SOAPFaultSubCode subCode;

+

+    protected SOAPFaultSubCodeImpl(OMNamespace ns, SOAPFactory factory) {

+        super(SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME, ns, factory);

+    }

+

+

+    protected SOAPFaultSubCodeImpl(OMElement parent, String localName,

+            SOAPFactory factory) throws SOAPProcessingException {

+        super(parent, localName, true, factory);

+    }

+

+    protected SOAPFaultSubCodeImpl(OMElement parent,

+                                   String localName,

+                                   OMXMLParserWrapper builder,

+                                   SOAPFactory factory) {

+        super(parent, localName, builder, factory);

+    }

+

+    public void setValue(SOAPFaultValue soapFaultSubCodeValue) throws SOAPProcessingException {

+        ElementHelper.setNewElement(this, value, soapFaultSubCodeValue);

+    }

+

+    public SOAPFaultValue getValue() {

+        if (value == null) {

+            value =

+                    (SOAPFaultValue) ElementHelper.getChildWithName(this,

+                            SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME);

+        }

+        return value;

+    }

+

+    public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException {

+        ElementHelper.setNewElement(this, this.subCode, subCode);

+

+    }

+

+    public SOAPFaultSubCode getSubCode() {

+        if (subCode == null) {

+            subCode =

+                    (SOAPFaultSubCode) ElementHelper.getChildWithName(this,

+                            SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME);

+        }

+        return subCode;

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultTextImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultTextImpl.java
new file mode 100644
index 0000000..f60b183
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultTextImpl.java
@@ -0,0 +1,85 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom;

+

+import org.apache.axiom.om.OMAttribute;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.om.impl.llom.OMAttributeImpl;

+import org.apache.axiom.soap.SOAP12Constants;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPFaultReason;

+import org.apache.axiom.soap.SOAPFaultText;

+import org.apache.axiom.soap.SOAPProcessingException;

+

+import javax.xml.namespace.QName;

+

+public abstract class SOAPFaultTextImpl extends SOAPElement implements SOAPFaultText {

+    protected OMAttribute langAttr;

+    protected OMNamespace langNamespace = null;

+

+

+    protected SOAPFaultTextImpl(OMNamespace ns, SOAPFactory factory) {

+        super(SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, ns, factory);

+        this.langNamespace = factory.createOMNamespace(

+                SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI,

+                SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX);

+    }

+

+    protected SOAPFaultTextImpl(SOAPFaultReason parent, SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(parent, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, true, factory);

+        this.langNamespace = factory.createOMNamespace(

+                SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI,

+                SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX);

+    }

+

+    protected SOAPFaultTextImpl(SOAPFaultReason parent,

+                                OMXMLParserWrapper builder,

+                                SOAPFactory factory) {

+        super(parent, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, builder,

+                factory);

+        this.langNamespace = factory.createOMNamespace(

+                SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI,

+                SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX);

+    }

+

+

+    public void setLang(String lang) {

+        //langAttr = new OMAttributeImpl(SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME, parent.getNamespace(), lang);

+        langAttr =

+                new OMAttributeImpl(

+                        SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME,

+                        langNamespace,

+                        lang,

+                        this.factory);

+        this.addAttribute(langAttr);

+    }

+

+    public String getLang() {

+        if (langAttr == null) {

+            //langAttr = this.getFirstAttribute(new QName(SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME, parent.getNamespace().getName()));

+            langAttr =

+                    this.getAttribute(

+                            new QName(langNamespace.getNamespaceURI(),

+                                    SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME,

+                                    SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX));

+        }

+

+        return langAttr == null ? null : langAttr.getAttributeValue();

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultValueImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultValueImpl.java
new file mode 100644
index 0000000..da50664
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPFaultValueImpl.java
@@ -0,0 +1,44 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.soap.SOAP12Constants;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPFaultValue;

+import org.apache.axiom.soap.SOAPProcessingException;

+

+public abstract class SOAPFaultValueImpl extends SOAPElement implements SOAPFaultValue {

+

+    protected SOAPFaultValueImpl(OMElement parent, SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(parent, SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME, true,

+                factory);

+    }

+

+    protected SOAPFaultValueImpl(OMNamespace ns, SOAPFactory factory) {

+        super(SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME, ns, factory);

+    }

+

+    protected SOAPFaultValueImpl(OMElement parent, OMXMLParserWrapper builder,

+            SOAPFactory factory) {

+        super(parent, SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME, builder,

+                factory);

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderBlockImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderBlockImpl.java
new file mode 100644
index 0000000..1f392a8
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderBlockImpl.java
@@ -0,0 +1,119 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom;

+

+import org.apache.axiom.om.OMAttribute;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.om.impl.OMNamespaceImpl;

+import org.apache.axiom.om.impl.llom.OMAttributeImpl;

+import org.apache.axiom.om.impl.llom.OMElementImpl;

+import org.apache.axiom.soap.SOAPConstants;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPHeader;

+import org.apache.axiom.soap.SOAPHeaderBlock;

+import org.apache.axiom.soap.SOAPProcessingException;

+

+import javax.xml.namespace.QName;

+

+/**

+ * Class SOAPHeaderBlockImpl

+ */

+public abstract class SOAPHeaderBlockImpl extends OMElementImpl

+        implements SOAPHeaderBlock {

+

+    private boolean processed = false;

+

+

+    public SOAPHeaderBlockImpl(String localName, OMNamespace ns, SOAPFactory factory) {

+        super(localName, ns, factory);

+    }

+

+    /**

+     * @param localName

+     * @param ns

+     * @param parent     

+     */

+    public SOAPHeaderBlockImpl(String localName,

+                               OMNamespace ns,

+                               SOAPHeader parent,

+                               SOAPFactory factory) throws SOAPProcessingException {

+        super(localName, ns, parent, factory);

+        this.setNamespace(ns);

+    }

+

+    /**

+     * Constructor SOAPHeaderBlockImpl.

+     *

+     * @param localName

+     * @param ns

+     * @param parent

+     * @param builder

+     */

+    public SOAPHeaderBlockImpl(String localName, OMNamespace ns,

+                               OMElement parent, OMXMLParserWrapper builder,

+                               SOAPFactory factory) {

+        super(localName, ns, parent, builder, factory);

+        this.setNamespace(ns);

+    }

+

+    /**

+     * @param attributeName

+     * @param attrValue

+     * @param soapEnvelopeNamespaceURI     

+     */

+    protected void setAttribute(String attributeName,

+                                String attrValue,

+                                String soapEnvelopeNamespaceURI) {

+        OMAttribute omAttribute = this.getAttribute(

+                new QName(soapEnvelopeNamespaceURI, attributeName));

+        if (omAttribute != null) {

+            omAttribute.setAttributeValue(attrValue);

+        } else {

+            OMAttribute attribute = new OMAttributeImpl(attributeName,

+                    new OMNamespaceImpl(soapEnvelopeNamespaceURI,

+                            SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX),

+                    attrValue, this.factory);

+            this.addAttribute(attribute);

+        }

+    }

+

+    /**

+     * Method getAttribute.

+     *

+     * @param attrName

+     * @param soapEnvelopeNamespaceURI     

+     * @return Returns String.

+     */

+    protected String getAttribute(String attrName,

+                                  String soapEnvelopeNamespaceURI) {

+        OMAttribute omAttribute = this.getAttribute(

+                new QName(soapEnvelopeNamespaceURI, attrName));

+        return (omAttribute != null)

+                ? omAttribute.getAttributeValue()

+                : null;

+    }

+

+    public boolean isProcessed() {

+        return processed;

+    }

+

+    public void setProcessed() {

+        processed = true;

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java
new file mode 100644
index 0000000..cef751d
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java
@@ -0,0 +1,235 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMException;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMNode;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.soap.SOAPConstants;

+import org.apache.axiom.soap.SOAPEnvelope;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPHeader;

+import org.apache.axiom.soap.SOAPHeaderBlock;

+import org.apache.axiom.soap.SOAPProcessingException;

+

+import java.util.ArrayList;

+import java.util.Iterator;

+

+/**

+ * Class SOAPHeaderImpl

+ */

+public abstract class SOAPHeaderImpl extends SOAPElement implements SOAPHeader {

+

+

+    protected SOAPHeaderImpl(OMNamespace ns, SOAPFactory factory) {

+        super(SOAPConstants.HEADER_LOCAL_NAME, ns, factory);

+    }

+

+    /**

+     * @param envelope

+     */

+    public SOAPHeaderImpl(SOAPEnvelope envelope, SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(envelope, SOAPConstants.HEADER_LOCAL_NAME, true, factory);

+

+    }

+

+    /**

+     * Constructor SOAPHeaderImpl

+     *

+     * @param envelope

+     * @param builder

+     */

+    public SOAPHeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder,

+            SOAPFactory factory) {

+        super(envelope, SOAPConstants.HEADER_LOCAL_NAME, builder, factory);

+    }

+

+    /**

+     * Creates a new <CODE>SOAPHeaderBlock</CODE> object initialized with the

+     * specified name and adds it to this <CODE>SOAPHeader</CODE> object.

+     *

+     * @param localName

+     * @param ns

+     * @return the new <CODE>SOAPHeaderBlock</CODE> object that was inserted

+     *         into this <CODE>SOAPHeader</CODE> object

+     * @throws org.apache.axiom.om.OMException

+     *                     if a SOAP error occurs

+     * @throws OMException

+     */

+    public abstract SOAPHeaderBlock addHeaderBlock(String localName,

+                                                   OMNamespace ns)

+            throws OMException;

+

+    /**

+     * Returns a list of all the <CODE>SOAPHeaderBlock</CODE> objects in this

+     * <CODE>SOAPHeader</CODE> object that have the the specified actor. An

+     * actor is a global attribute that indicates the intermediate parties to

+     * whom the message should be sent. An actor receives the message and then

+     * sends it to the next actor. The default actor is the ultimate intended

+     * recipient for the message, so if no actor attribute is included in a

+     * <CODE>SOAPHeader</CODE> object, the message is sent to its ultimate

+     * destination.

+     *

+     * @param paramRole a <CODE>String</CODE> giving the URI of the actor for

+     *                  which to search

+     * @return an <CODE>Iterator</CODE> object over all the <CODE>

+     *         SOAPHeaderBlock</CODE> objects that contain the specified actor

+     * @see #extractHeaderBlocks(String) extractHeaderBlocks(java.lang.String)

+     */

+    public Iterator examineHeaderBlocks(String paramRole) {

+        Iterator headerBlocksIter = this.getChildren();

+        ArrayList headersWithGivenActor = new ArrayList();

+        

+        if(paramRole == null || "".equals(paramRole)){

+    		return returnAllSOAPHeaders(this.getChildren());

+    	}

+        

+        while (headerBlocksIter.hasNext()) {

+            Object o = headerBlocksIter.next();

+            if (o instanceof SOAPHeaderBlock) {

+                SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) o;

+                String role = soapHeaderBlock.getRole();

+                if ((role != null) && role.equalsIgnoreCase(paramRole)) {

+                    headersWithGivenActor.add(soapHeaderBlock);

+                }

+            }

+        }

+        return headersWithGivenActor.iterator();

+    }

+

+    private Iterator returnAllSOAPHeaders(Iterator children) {

+    	ArrayList headers = new ArrayList();

+    	while (children.hasNext()) {

+            Object o = children.next();

+            if (o instanceof SOAPHeaderBlock) {

+                headers.add(o);

+            }

+        }

+    	

+    	return headers.iterator();

+		

+	}

+

+	/**

+     * Returns a list of all the <CODE>SOAPHeaderBlock</CODE> objects in this

+     * <CODE>SOAPHeader</CODE> object that have the the specified role and

+     * detaches them from this <CODE> SOAPHeader</CODE> object. <P>This method

+     * allows an role to process only the parts of the <CODE>SOAPHeader</CODE>

+     * object that apply to it and to remove them before passing the message on

+     * to the next role.

+     *

+     * @param role a <CODE>String</CODE> giving the URI of the role for which to

+     *             search

+     * @return an <CODE>Iterator</CODE> object over all the <CODE>

+     *         SOAPHeaderBlock</CODE> objects that contain the specified role

+     * @see #examineHeaderBlocks(String) examineHeaderBlocks(java.lang.String)

+     */

+    public abstract Iterator extractHeaderBlocks(String role);

+

+    /**

+     * Returns an <code>Iterator</code> over all the <code>SOAPHeaderBlock</code>

+     * objects in this <code>SOAPHeader</code> object that have the specified

+     * actor and that have a MustUnderstand attribute whose value is equivalent

+     * to <code>true</code>.

+     *

+     * @param actor a <code>String</code> giving the URI of the actor for which

+     *              to search

+     * @return an <code>Iterator</code> object over all the

+     *         <code>SOAPHeaderBlock</code> objects that contain the specified

+     *         actor and are marked as MustUnderstand

+     */

+    public Iterator examineMustUnderstandHeaderBlocks(String actor) {

+        Iterator headerBlocksIter = this.getChildren();

+        ArrayList mustUnderstandHeadersWithGivenActor = new ArrayList();

+        while (headerBlocksIter.hasNext()) {

+            Object o = headerBlocksIter.next();

+            if (o instanceof SOAPHeaderBlock) {

+                SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) o;

+                String role = soapHeaderBlock.getRole();

+                boolean mustUnderstand = soapHeaderBlock.getMustUnderstand();

+                if ((role != null) && role.equalsIgnoreCase(actor) &&

+                        mustUnderstand) {

+                    mustUnderstandHeadersWithGivenActor.add(soapHeaderBlock);

+                }

+            }

+        }

+        return mustUnderstandHeadersWithGivenActor.iterator();

+    }

+

+    /**

+     * Returns an <code>Iterator</code> over all the <code>SOAPHeaderBlock</code>

+     * objects in this <code>SOAPHeader</code> object. Not that this will return

+     * elements containing the QName (http://schemas.xmlsoap.org/soap/envelope/,

+     * Header)

+     *

+     * @return an <code>Iterator</code> object over all the

+     *         <code>SOAPHeaderBlock</code> objects contained by this

+     *         <code>SOAPHeader</code>

+     */

+    public Iterator examineAllHeaderBlocks() {

+        return this.getChildrenWithName(null);

+    }

+

+    /**

+     * Returns an <code>Iterator</code> over all the <code>SOAPHeaderBlock</code>

+     * objects in this <code>SOAPHeader </code> object and detaches them from

+     * this <code>SOAPHeader</code> object.

+     *

+     * @return an <code>Iterator</code> object over all the

+     *         <code>SOAPHeaderBlock</code> objects contained by this

+     *         <code>SOAPHeader</code>

+     */

+    public Iterator extractAllHeaderBlocks() {

+        throw new UnsupportedOperationException(); // TODO implement this

+    }

+

+    public ArrayList getHeaderBlocksWithNSURI(String nsURI) {

+        ArrayList headers = null;

+        OMNode node = null;

+        OMElement header = this.getFirstElement();

+

+        if (header != null) {

+            headers = new ArrayList();

+        }

+

+        node = header;

+

+        while (node != null) {

+            if (node.getType() == OMNode.ELEMENT_NODE) {

+                header = (OMElement) node;

+                if (nsURI.equals(header.getNamespace().getNamespaceURI())) {

+                    headers.add(header);

+                }

+            }

+            node = node.getNextOMSibling();

+

+        }

+        return headers;

+

+    }

+

+    protected void checkParent(OMElement parent) throws SOAPProcessingException {

+        if (!(parent instanceof SOAPEnvelopeImpl)) {

+            throw new SOAPProcessingException(

+                    "Expecting an implementation of SOAP Envelope as the parent. But received some other implementation");

+        }

+    }

+

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPMessageImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPMessageImpl.java
new file mode 100644
index 0000000..105ff31
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPMessageImpl.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.llom;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.om.impl.llom.OMDocumentImpl;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPMessage;
+import org.apache.axiom.soap.SOAPProcessingException;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class SOAPMessageImpl extends OMDocumentImpl implements SOAPMessage {
+
+
+    public SOAPMessageImpl() {
+    }
+
+    public SOAPMessageImpl(SOAPEnvelope envelope, OMXMLParserWrapper parserWrapper) {
+        super(envelope, parserWrapper);
+    }
+
+    public SOAPMessageImpl(OMXMLParserWrapper parserWrapper) {
+        super(parserWrapper);
+    }
+
+
+    public SOAPEnvelope getSOAPEnvelope() throws SOAPProcessingException {
+        return (SOAPEnvelope) getOMDocumentElement();
+    }
+
+    public void setSOAPEnvelope(SOAPEnvelope envelope) throws SOAPProcessingException {
+        super.addChild(envelope);
+        this.documentElement = envelope;
+    }
+
+    public void setOMDocumentElement(OMElement rootElement) {
+        throw new UnsupportedOperationException("This is not allowed. Use set SOAPEnvelope instead");
+    }
+
+    public void setFirstChild(OMNode firstChild) {
+        throw new UnsupportedOperationException("This is not allowed. Use set SOAPEnvelope instead");
+    }
+
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache, boolean includeXMLDeclaration) throws XMLStreamException {
+        if (cache) {
+            ((OMNodeEx)this.documentElement).internalSerialize(writer);
+        } else {
+            ((OMNodeEx)this.documentElement).internalSerializeAndConsume(writer);
+        }
+    }
+}
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPTextImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPTextImpl.java
new file mode 100644
index 0000000..dceac58
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPTextImpl.java
@@ -0,0 +1,50 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.soap.SOAP12Constants;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPProcessingException;

+

+public class SOAPTextImpl extends SOAPElement {

+

+    protected SOAPTextImpl(OMElement parent, SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(parent, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, true, factory);

+    }

+

+    protected SOAPTextImpl(OMElement parent, OMXMLParserWrapper builder,

+            SOAPFactory factory) {

+        super(parent, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, builder,

+                factory);

+    }

+

+    public void setLang(String lang) {

+        // TODO : Chinthaka fix me

+    }

+

+    public String getLang() {

+        // TODO Chinthaka fix me

+        return null;

+    }

+

+    protected void checkParent(OMElement parent) throws SOAPProcessingException {

+        // do nothing

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11BodyImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11BodyImpl.java
new file mode 100644
index 0000000..3318338
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11BodyImpl.java
@@ -0,0 +1,56 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom.soap11;

+

+import org.apache.axiom.om.OMException;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.soap.SOAPConstants;

+import org.apache.axiom.soap.SOAPEnvelope;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPFault;

+import org.apache.axiom.soap.SOAPProcessingException;

+import org.apache.axiom.soap.impl.llom.SOAPBodyImpl;

+

+public class SOAP11BodyImpl extends SOAPBodyImpl {

+    /**

+     * @param envelope

+     */

+    public SOAP11BodyImpl(SOAPEnvelope envelope, SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(envelope, factory);

+    }

+

+    public SOAP11BodyImpl(SOAPFactory factory) throws SOAPProcessingException {

+        super(SOAPConstants.BODY_LOCAL_NAME, factory.getNamespace(),

+                factory);

+    }

+

+    /**

+     * Constructor SOAPBodyImpl

+     *

+     * @param envelope

+     * @param builder

+     */

+    public SOAP11BodyImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder,

+            SOAPFactory factory) {

+        super(envelope, builder, factory);

+    }

+

+    public SOAPFault addFault(Exception e) throws OMException {

+        return ((SOAP11Factory)this.factory).createSOAPFault(this, e);

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11Factory.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11Factory.java
new file mode 100644
index 0000000..0a43cf5
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11Factory.java
@@ -0,0 +1,313 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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 KINgetD, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ */

+

+package org.apache.axiom.soap.impl.llom.soap11;

+

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.om.impl.OMNamespaceImpl;

+import org.apache.axiom.om.impl.llom.factory.OMLinkedListImplFactory;

+import org.apache.axiom.soap.SOAP11Constants;

+import org.apache.axiom.soap.SOAPBody;

+import org.apache.axiom.soap.SOAPEnvelope;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPFault;

+import org.apache.axiom.soap.SOAPFaultCode;

+import org.apache.axiom.soap.SOAPFaultDetail;

+import org.apache.axiom.soap.SOAPFaultNode;

+import org.apache.axiom.soap.SOAPFaultReason;

+import org.apache.axiom.soap.SOAPFaultRole;

+import org.apache.axiom.soap.SOAPFaultSubCode;

+import org.apache.axiom.soap.SOAPFaultText;

+import org.apache.axiom.soap.SOAPFaultValue;

+import org.apache.axiom.soap.SOAPHeader;

+import org.apache.axiom.soap.SOAPHeaderBlock;

+import org.apache.axiom.soap.SOAPMessage;

+import org.apache.axiom.soap.SOAPProcessingException;

+import org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl;

+import org.apache.axiom.soap.impl.llom.SOAPMessageImpl;

+

+public class SOAP11Factory extends OMLinkedListImplFactory implements SOAPFactory  {

+    /**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+

+

+    public OMNamespace getNamespace() {

+        return new OMNamespaceImpl(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,

+                SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX);

+    }

+

+    public String getSoapVersionURI() {

+        return SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;

+    }

+

+    public SOAPEnvelope createSOAPEnvelope() {

+        return new SOAPEnvelopeImpl(

+                new OMNamespaceImpl(

+                        SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,

+                        SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX),

+                this);

+    }

+

+    public SOAPHeader createSOAPHeader(SOAPEnvelope envelope)

+            throws SOAPProcessingException {

+        return new SOAP11HeaderImpl(envelope, this);

+    }

+

+    public SOAPHeader createSOAPHeader() throws SOAPProcessingException {

+        return new SOAP11HeaderImpl(this);

+    }

+

+    public SOAPHeader createSOAPHeader(SOAPEnvelope envelope,

+                                       OMXMLParserWrapper builder) {

+        return new SOAP11HeaderImpl(envelope, builder, this);

+    }

+

+    public SOAPHeaderBlock createSOAPHeaderBlock(String localName,

+            OMNamespace ns, SOAPHeader parent) throws SOAPProcessingException {

+        return new SOAP11HeaderBlockImpl(localName, ns, parent, this);

+    }

+

+    public SOAPHeaderBlock createSOAPHeaderBlock(String localName,

+            OMNamespace ns) throws SOAPProcessingException {

+        return new SOAP11HeaderBlockImpl(localName, ns, this);

+    }

+

+    public SOAPHeaderBlock createSOAPHeaderBlock(String localName,

+                                                 OMNamespace ns,

+                                                 SOAPHeader parent,

+                                                 OMXMLParserWrapper builder)

+            throws SOAPProcessingException {

+        return new SOAP11HeaderBlockImpl(localName, ns, parent, builder, this);

+    }

+

+    public SOAPFault createSOAPFault(SOAPBody parent, Exception e)

+            throws SOAPProcessingException {

+        return new SOAP11FaultImpl(parent, e, this);

+    }

+

+    public SOAPFault createSOAPFault() throws SOAPProcessingException {

+        return new SOAP11FaultImpl(this);

+    }

+

+    public SOAPFault createSOAPFault(SOAPBody parent)

+            throws SOAPProcessingException {

+        return new SOAP11FaultImpl(parent, this);

+    }

+

+    public SOAPFault createSOAPFault(SOAPBody parent,

+                                     OMXMLParserWrapper builder) {

+        return new SOAP11FaultImpl(parent, builder, this);

+    }

+

+    public SOAPBody createSOAPBody(SOAPEnvelope envelope)

+            throws SOAPProcessingException {

+        return new SOAP11BodyImpl(envelope, this);

+    }

+

+    public SOAPBody createSOAPBody(SOAPEnvelope envelope,

+                                   OMXMLParserWrapper builder) {

+        return new SOAP11BodyImpl(envelope, builder, this);

+    }

+

+    public SOAPBody createSOAPBody() throws SOAPProcessingException {

+        return new SOAP11BodyImpl(this);

+    }

+

+    public SOAPFaultCode createSOAPFaultCode(SOAPFault parent)

+            throws SOAPProcessingException {

+        return new SOAP11FaultCodeImpl(parent, this);

+    }

+

+    public SOAPFaultCode createSOAPFaultCode() throws SOAPProcessingException {

+        return new SOAP11FaultCodeImpl(this);

+    }

+

+    public SOAPFaultCode createSOAPFaultCode(SOAPFault parent,

+                                             OMXMLParserWrapper builder) {

+        return new SOAP11FaultCodeImpl(parent, builder, this);

+    }

+

+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent)

+            throws SOAPProcessingException {

+        return new SOAP11FaultValueImpl(parent, this);

+    }

+

+    public SOAPFaultValue createSOAPFaultValue() throws SOAPProcessingException {

+        return new SOAP11FaultValueImpl(this);

+    }

+

+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent,

+                                               OMXMLParserWrapper builder) {

+        return new SOAP11FaultValueImpl(parent, builder, this);

+    }

+

+    //added

+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent)

+            throws SOAPProcessingException {

+        return new SOAP11FaultValueImpl(parent, this);

+    }

+

+    //added

+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent,

+                                               OMXMLParserWrapper builder) {

+        return new SOAP11FaultValueImpl(parent, builder, this);

+    }

+

+    //changed

+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent)

+            throws SOAPProcessingException {

+        return new SOAP11FaultSubCodeImpl(parent, this);

+    }

+

+    public SOAPFaultSubCode createSOAPFaultSubCode() throws SOAPProcessingException {

+        return new SOAP11FaultSubCodeImpl(this);

+    }

+

+    //changed

+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent,

+                                                   OMXMLParserWrapper builder) {

+        return new SOAP11FaultSubCodeImpl(parent, builder, this);

+    }

+

+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent)

+            throws SOAPProcessingException {

+        return new SOAP11FaultSubCodeImpl(parent, this);

+    }

+

+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent,

+                                                   OMXMLParserWrapper builder) {

+        return new SOAP11FaultSubCodeImpl(parent, builder, this);

+    }

+

+    public SOAPFaultReason createSOAPFaultReason(SOAPFault parent)

+            throws SOAPProcessingException {

+        return new SOAP11FaultReasonImpl(parent, this);

+    }

+

+    public SOAPFaultReason createSOAPFaultReason() throws SOAPProcessingException {

+        return new SOAP11FaultReasonImpl(this);

+    }

+

+    public SOAPFaultReason createSOAPFaultReason(SOAPFault parent,

+                                                 OMXMLParserWrapper builder) {

+        return new SOAP11FaultReasonImpl(parent, builder, this);

+    }

+

+    public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent)

+            throws SOAPProcessingException {

+        return new SOAP11FaultTextImpl(parent, this);

+    }

+

+    public SOAPFaultText createSOAPFaultText() throws SOAPProcessingException {

+        return new SOAP11FaultTextImpl(this);

+    }

+

+    public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent,

+                                             OMXMLParserWrapper builder) {

+        return new SOAP11FaultTextImpl(parent, builder, this);

+    }

+

+    public SOAPFaultNode createSOAPFaultNode(SOAPFault parent)

+            throws SOAPProcessingException {

+        return new SOAP11FaultNodeImpl(parent, this);

+    }

+

+    public SOAPFaultNode createSOAPFaultNode() throws SOAPProcessingException {

+        return new SOAP11FaultNodeImpl(this);

+    }

+

+    public SOAPFaultNode createSOAPFaultNode(SOAPFault parent,

+                                             OMXMLParserWrapper builder) {

+        return new SOAP11FaultNodeImpl(parent, builder, this);

+    }

+

+    public SOAPFaultRole createSOAPFaultRole(SOAPFault parent)

+            throws SOAPProcessingException {

+        return new SOAP11FaultRoleImpl(parent, this);

+    }

+

+    public SOAPFaultRole createSOAPFaultRole() throws SOAPProcessingException {

+        return new SOAP11FaultRoleImpl(this);

+    }

+

+    public SOAPFaultRole createSOAPFaultRole(SOAPFault parent,

+                                             OMXMLParserWrapper builder) {

+        return new SOAP11FaultRoleImpl(parent, builder, this);

+    }

+

+    public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent)

+            throws SOAPProcessingException {

+        return new SOAP11FaultDetailImpl(parent, this);

+    }

+

+    public SOAPFaultDetail createSOAPFaultDetail() throws SOAPProcessingException {

+        return new SOAP11FaultDetailImpl(this);

+    }

+

+    public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent,

+                                                 OMXMLParserWrapper builder) {

+        return new SOAP11FaultDetailImpl(parent, builder, this);

+    }

+

+    public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException {

+        OMNamespace ns =

+                new OMNamespaceImpl(

+                        SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,

+                        SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX);

+        SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns, this);

+        createSOAPHeader(env);

+        createSOAPBody(env);

+        return env;

+    }

+

+    public SOAPEnvelope getDefaultFaultEnvelope() throws SOAPProcessingException {

+        SOAPEnvelope defaultEnvelope = getDefaultEnvelope();

+        SOAPFault fault = createSOAPFault(defaultEnvelope.getBody());

+

+        SOAPFaultCode faultCode = createSOAPFaultCode(fault);

+        createSOAPFaultValue(faultCode);

+

+        SOAPFaultReason reason = createSOAPFaultReason(fault);

+        createSOAPFaultText(reason);

+

+        createSOAPFaultDetail(fault);

+

+        return defaultEnvelope;

+    }

+

+    public SOAPMessage createSOAPMessage() {

+        return new SOAPMessageImpl();

+    }

+

+    public SOAPMessage createSOAPMessage(OMXMLParserWrapper builder) {

+        return new SOAPMessageImpl(builder);

+    }

+

+

+    public SOAPMessage createSOAPMessage(SOAPEnvelope envelope, OMXMLParserWrapper parserWrapper) {

+        return new SOAPMessageImpl(envelope, parserWrapper);

+    }

+

+

+

+    public SOAPEnvelope createSOAPEnvelope(OMXMLParserWrapper builder) {

+        return new SOAPEnvelopeImpl(builder, this);

+    }

+

+

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultCodeImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultCodeImpl.java
new file mode 100644
index 0000000..eeaf14e
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultCodeImpl.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.llom.soap11;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultSubCode;
+import org.apache.axiom.soap.SOAPFaultValue;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.llom.SOAPFaultCodeImpl;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class SOAP11FaultCodeImpl extends SOAPFaultCodeImpl {
+
+    public SOAP11FaultCodeImpl(SOAPFactory factory) {
+        super(null, factory);
+    }
+
+    /**
+     * Constructor OMElementImpl
+     *
+     * @param parent
+     * @param builder
+     */
+    public SOAP11FaultCodeImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    /**
+     * @param parent
+     */
+    public SOAP11FaultCodeImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException {
+        super(parent, false, factory);
+    }
+
+
+    public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException {
+        if (!(subCode instanceof SOAP11FaultSubCodeImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault Sub Code. But received some other implementation");
+        }
+        super.setSubCode(subCode);
+    }
+
+    public void setValue(SOAPFaultValue value) throws SOAPProcessingException {
+        if (!(value instanceof SOAP11FaultValueImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault Value. But received some other implementation");
+        }
+        super.setValue(value);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP11FaultImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault as the parent. But received some other implementation");
+        }
+    }
+
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException {
+
+        // select the builder
+        short builderType = PULL_TYPE_BUILDER;    // default is pull type
+        if (builder != null) {
+            builderType = this.builder.getBuilderType();
+        }
+        if ((builderType == PUSH_TYPE_BUILDER)
+                && (builder.getRegisteredContentHandler() == null)) {
+            builder.registerExternalContentHandler(
+                    new StreamWriterToContentHandlerConverter(writer));
+        }
+
+        OMSerializerUtil.serializeStartpart(this, 
+        		SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME, 
+        		writer);
+        
+        String text = this.getValue().getText();
+        writer.writeCharacters(text);
+        writer.writeEndElement();
+    }
+
+
+}
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultDetailImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultDetailImpl.java
new file mode 100644
index 0000000..3198cd5
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultDetailImpl.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.llom.soap11;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.llom.OMNodeImpl;
+import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.llom.SOAPFaultDetailImpl;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class SOAP11FaultDetailImpl extends SOAPFaultDetailImpl {
+
+    public SOAP11FaultDetailImpl(SOAPFactory factory) {
+        super(null, factory);
+    }
+
+    public SOAP11FaultDetailImpl(SOAPFault parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, false, factory);
+    }
+
+    public SOAP11FaultDetailImpl(SOAPFault parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP11FaultImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault as the " +
+                    "parent. But received some other implementation");
+        }
+    }
+
+    public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException {
+
+        // select the builder
+        short builderType = PULL_TYPE_BUILDER;    // default is pull type
+        if (builder != null) {
+            builderType = this.builder.getBuilderType();
+        }
+        if ((builderType == PUSH_TYPE_BUILDER)
+                && (builder.getRegisteredContentHandler() == null)) {
+            builder.registerExternalContentHandler(
+                    new StreamWriterToContentHandlerConverter(writer));
+        }
+
+        OMSerializerUtil.serializeStartpart(this, 
+        		SOAP11Constants.SOAP_FAULT_DETAIL_LOCAL_NAME, 
+        		writer);
+        
+        OMNode child = firstChild;
+        while (child != null && ((!(child instanceof OMElement)) || child.isComplete())) {
+           ((OMNodeImpl) child).internalSerializeAndConsume(writer);
+            child = child.getNextOMSibling();
+        }
+
+        writer.writeEndElement();
+    }
+
+
+}
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultImpl.java
new file mode 100644
index 0000000..8b56d02
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultImpl.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.llom.soap11;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAPFaultDetail;
+import org.apache.axiom.soap.SOAPFaultNode;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPFaultRole;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.llom.SOAPFaultImpl;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+
+public class SOAP11FaultImpl extends SOAPFaultImpl {
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+
+
+    public SOAP11FaultImpl(SOAPFactory factory) {
+        super(factory.getNamespace(), factory);
+    }
+
+    public SOAP11FaultImpl(SOAPBody parent, Exception e, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, e, factory);
+    }
+
+    public SOAP11FaultImpl(SOAPBody parent, OMXMLParserWrapper builder,
+                           SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    /**
+     * This is a convenience method for the SOAP Fault Impl.
+     *
+     * @param parent
+     */
+    public SOAP11FaultImpl(SOAPBody parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, factory);
+
+    }
+
+    protected SOAPFaultDetail getNewSOAPFaultDetail(SOAPFault fault)
+            throws SOAPProcessingException {
+        return new SOAP11FaultDetailImpl(fault, (SOAPFactory)this.factory);
+    }
+
+
+    public void internalSerializeAndConsume(XMLStreamWriter writer)
+            throws XMLStreamException {
+        super.internalSerializeAndConsume(writer);
+    }
+
+    public void setCode(SOAPFaultCode soapFaultCode)
+            throws SOAPProcessingException {
+        if (!(soapFaultCode instanceof SOAP11FaultCodeImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault Code. " +
+                    "But received some other implementation");
+        }
+        super.setCode(soapFaultCode);
+    }
+
+    public void setReason(SOAPFaultReason reason) throws SOAPProcessingException {
+        if (!(reason instanceof SOAP11FaultReasonImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault Reason. " +
+                    "But received some other implementation");
+        }
+        super.setReason(reason);
+    }
+
+    public void setNode(SOAPFaultNode node) throws SOAPProcessingException {
+        if (!(node instanceof SOAP11FaultNodeImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault Node. " +
+                    "But received some other implementation");
+        }
+        super.setNode(node);
+    }
+
+    public void setRole(SOAPFaultRole role) throws SOAPProcessingException {
+        if (!(role instanceof SOAP11FaultRoleImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault Role. " +
+                    "But received some other implementation");
+        }
+        super.setRole(role);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP11BodyImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Body as the " +
+                    "parent. But received some other implementation");
+        }
+    }
+
+    public void setDetail(SOAPFaultDetail detail) throws SOAPProcessingException {
+        if (!(detail instanceof SOAP11FaultDetailImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault Detail. " +
+                    "But received some other implementation");
+        }
+        super.setDetail(detail);
+    }
+
+    protected void serializeFaultNode(XMLStreamWriter writer)
+            throws XMLStreamException {
+
+    }
+
+}
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultNodeImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultNodeImpl.java
new file mode 100644
index 0000000..f83b07a
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultNodeImpl.java
@@ -0,0 +1,51 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom.soap11;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPFault;

+import org.apache.axiom.soap.SOAPProcessingException;

+import org.apache.axiom.soap.impl.llom.SOAPFaultNodeImpl;

+

+

+public class SOAP11FaultNodeImpl extends SOAPFaultNodeImpl {

+

+    public SOAP11FaultNodeImpl(SOAPFactory factory) {

+        super((OMNamespace) null, factory);

+    }

+

+    public SOAP11FaultNodeImpl(SOAPFault parent, SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(parent, factory);

+    }

+

+    public SOAP11FaultNodeImpl(SOAPFault parent, OMXMLParserWrapper builder,

+            SOAPFactory factory) {

+        super(parent, builder, factory);

+    }

+

+    protected void checkParent(OMElement parent) throws SOAPProcessingException {

+        if (!(parent instanceof SOAP11FaultImpl)) {

+            throw new SOAPProcessingException(

+                    "Expecting SOAP 1.1 implementation of SOAP Fault as the " +

+                    "parent. But received some other implementation");

+        }

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultReasonImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultReasonImpl.java
new file mode 100644
index 0000000..744dd79
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultReasonImpl.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.llom.soap11;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultText;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.llom.SOAPFaultReasonImpl;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class SOAP11FaultReasonImpl extends SOAPFaultReasonImpl {
+
+
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+
+     public SOAP11FaultReasonImpl(SOAPFactory factory) {
+        super(null, factory);
+    }
+
+    public SOAP11FaultReasonImpl(SOAPFault parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    /**
+     * @param parent
+     */
+    public SOAP11FaultReasonImpl(SOAPFault parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, false, factory);
+    }
+
+    public void addSOAPText(SOAPFaultText soapFaultText)
+            throws SOAPProcessingException {
+        if (!(soapFaultText instanceof SOAP11FaultTextImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault Text. " +
+                    "But received some other implementation");
+        }
+        super.addSOAPText(soapFaultText);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP11FaultImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault as the " +
+                    "parent. But received some other implementation");
+        }
+    }
+
+    protected void internalSerialize(XMLStreamWriter writer, boolean cache)
+            throws XMLStreamException {
+
+        // select the builder
+        short builderType = PULL_TYPE_BUILDER;    // default is pull type
+        if (builder != null) {
+            builderType = this.builder.getBuilderType();
+        }
+        if ((builderType == PUSH_TYPE_BUILDER)
+                && (builder.getRegisteredContentHandler() == null)) {
+            builder.registerExternalContentHandler(
+                    new StreamWriterToContentHandlerConverter(writer));
+        }
+
+        OMSerializerUtil.serializeStartpart(this, 
+        		SOAP11Constants.SOAP_FAULT_STRING_LOCAL_NAME, 
+        		writer);
+
+        String text = this.getFirstSOAPText().getText();
+        writer.writeCharacters(text);
+        writer.writeEndElement();
+    }
+
+
+}
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultRoleImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultRoleImpl.java
new file mode 100644
index 0000000..7055aa6
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultRoleImpl.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.llom.soap11;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.llom.SOAPFaultRoleImpl;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class SOAP11FaultRoleImpl extends SOAPFaultRoleImpl {
+    
+    public SOAP11FaultRoleImpl(SOAPFault parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, false, factory);
+    }
+
+    public SOAP11FaultRoleImpl(SOAPFactory factory) {
+        super(null, factory);
+    }
+
+    public SOAP11FaultRoleImpl(SOAPFault parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP11FaultImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.1 implementation of SOAP Fault as the " +
+                    "parent. But received some other implementation");
+        }
+    }
+
+    protected void internalSerialize(
+            XMLStreamWriter writer, boolean cache)
+            throws XMLStreamException {
+
+        // select the builder
+        short builderType = PULL_TYPE_BUILDER;    // default is pull type
+        if (builder != null) {
+            builderType = this.builder.getBuilderType();
+        }
+        if ((builderType == PUSH_TYPE_BUILDER)
+                && (builder.getRegisteredContentHandler() == null)) {
+            builder.registerExternalContentHandler(
+                    new StreamWriterToContentHandlerConverter(writer));
+        }
+
+        OMSerializerUtil.serializeStartpart(this, 
+        		SOAP11Constants.SOAP_FAULT_ACTOR_LOCAL_NAME, 
+        		writer);
+        
+        String text = this.getText();
+        writer.writeCharacters(text);
+        writer.writeEndElement();
+    }
+
+
+}
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultSubCodeImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultSubCodeImpl.java
new file mode 100644
index 0000000..978c9f3
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultSubCodeImpl.java
@@ -0,0 +1,83 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom.soap11;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.soap.SOAP12Constants;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPFaultCode;

+import org.apache.axiom.soap.SOAPFaultSubCode;

+import org.apache.axiom.soap.SOAPFaultValue;

+import org.apache.axiom.soap.SOAPProcessingException;

+import org.apache.axiom.soap.impl.llom.SOAPFaultSubCodeImpl;

+

+public class SOAP11FaultSubCodeImpl extends SOAPFaultSubCodeImpl {

+

+

+    public SOAP11FaultSubCodeImpl(SOAPFactory factory) {

+        super(null, factory);

+    }

+

+    //changed

+    public SOAP11FaultSubCodeImpl(SOAPFaultCode parent, SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, factory);

+    }

+

+    //changed

+    public SOAP11FaultSubCodeImpl(SOAPFaultCode parent,

+                                  OMXMLParserWrapper builder,

+                                  SOAPFactory factory) {

+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder,

+                factory);

+    }

+

+    public SOAP11FaultSubCodeImpl(SOAPFaultSubCode parent, SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, factory);

+    }

+

+    public SOAP11FaultSubCodeImpl(SOAPFaultSubCode parent,

+                                  OMXMLParserWrapper builder,

+                                  SOAPFactory factory) {

+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder,

+                factory);

+    }

+

+    protected void checkParent(OMElement parent) throws SOAPProcessingException {

+        if (!((parent instanceof SOAP11FaultSubCodeImpl) ||  (parent instanceof SOAP11FaultCodeImpl))) {

+            throw new SOAPProcessingException("Expecting SOAP 1.1 implementation of SOAP FaultSubCode or SOAP FaultCode as the parent. But received some other implementation");

+        }

+    }

+

+    public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException {

+        if (!((parent instanceof SOAP11FaultSubCodeImpl) || (parent instanceof SOAP11FaultCodeImpl))) {

+            throw new SOAPProcessingException("Expecting SOAP 1.1 implementation of SOAP Fault Sub Code. But received some other implementation");

+        }

+        super.setSubCode(subCode);

+    }

+

+    public void setValue(SOAPFaultValue soapFaultSubCodeValue) throws SOAPProcessingException {

+        if (!(soapFaultSubCodeValue instanceof SOAP11FaultValueImpl)) {

+            throw new SOAPProcessingException("Expecting SOAP 1.1 implementation of SOAP Fault Value. But received some other implementation");

+        }

+        super.setValue(soapFaultSubCodeValue);

+    }

+

+

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultTextImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultTextImpl.java
new file mode 100644
index 0000000..a8bbe82
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultTextImpl.java
@@ -0,0 +1,52 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom.soap11;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPFaultReason;

+import org.apache.axiom.soap.SOAPProcessingException;

+import org.apache.axiom.soap.impl.llom.SOAPFaultTextImpl;

+

+public class SOAP11FaultTextImpl extends SOAPFaultTextImpl {

+    

+    public SOAP11FaultTextImpl(SOAPFaultReason parent, SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(parent, factory);

+    }

+

+    public SOAP11FaultTextImpl(SOAPFactory factory)

+            throws SOAPProcessingException {

+        super((OMNamespace) null, factory);

+    }

+

+    public SOAP11FaultTextImpl(SOAPFaultReason parent,

+                               OMXMLParserWrapper builder, 

+                               SOAPFactory factory) {

+        super(parent, builder, factory);

+    }

+

+    protected void checkParent(OMElement parent) throws SOAPProcessingException {

+        if (!(parent instanceof SOAP11FaultReasonImpl)) {

+            throw new SOAPProcessingException(

+                    "Expecting SOAP 1.1 implementation of SOAP FaultReason as " +

+                    "the parent. But received some other implementation");

+        }

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultValueImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultValueImpl.java
new file mode 100644
index 0000000..4a0f869
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11FaultValueImpl.java
@@ -0,0 +1,49 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom.soap11;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPProcessingException;

+import org.apache.axiom.soap.impl.llom.SOAPFaultValueImpl;

+

+public class SOAP11FaultValueImpl extends SOAPFaultValueImpl {

+    

+    public SOAP11FaultValueImpl(OMElement parent, SOAPFactory factory) throws SOAPProcessingException {

+        super(parent, factory);

+    }

+

+    public SOAP11FaultValueImpl(SOAPFactory factory) throws SOAPProcessingException {

+        super((OMNamespace) null, factory);

+    }

+

+    public SOAP11FaultValueImpl(OMElement parent, OMXMLParserWrapper builder, SOAPFactory factory) {

+        super(parent, builder, factory);

+    }

+

+

+    protected void checkParent(OMElement parent) throws SOAPProcessingException {

+        if (!((parent instanceof SOAP11FaultSubCodeImpl) ||

+                (parent instanceof SOAP11FaultCodeImpl))) {

+            throw new SOAPProcessingException(

+                    "Expecting SOAP 1.1 implementation of SOAP FaultSubCode or SOAP FaultCode as the parent. But received some other implementation." +

+                            parent.getClass());

+        }

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11HeaderBlockImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11HeaderBlockImpl.java
new file mode 100644
index 0000000..6844617
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11HeaderBlockImpl.java
@@ -0,0 +1,139 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom.soap11;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.soap.SOAP11Constants;

+import org.apache.axiom.soap.SOAPConstants;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPHeader;

+import org.apache.axiom.soap.SOAPProcessingException;

+import org.apache.axiom.soap.impl.llom.SOAPHeaderBlockImpl;

+

+public class SOAP11HeaderBlockImpl extends SOAPHeaderBlockImpl {

+

+    public SOAP11HeaderBlockImpl(String localName, OMNamespace ns,

+            SOAPFactory factory) {

+        super(localName, ns, factory);

+    }

+

+    /**

+     * @param localName

+     * @param ns

+     */

+    public SOAP11HeaderBlockImpl(String localName,

+                                 OMNamespace ns,

+                                 SOAPHeader parent,

+                                 SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(localName, ns, parent, factory);

+        checkParent(parent);

+    }

+

+    /**

+     * Constructor SOAPHeaderBlockImpl

+     *

+     * @param localName

+     * @param ns

+     * @param parent

+     * @param builder

+     */

+    public SOAP11HeaderBlockImpl(String localName,

+                                 OMNamespace ns,

+                                 OMElement parent,

+                                 OMXMLParserWrapper builder, 

+                                 SOAPFactory factory) {

+        super(localName, ns, parent, builder, factory);

+    }

+

+

+    protected void checkParent(OMElement parent) throws SOAPProcessingException {

+        if (!(parent instanceof SOAP11HeaderImpl)) {

+            throw new SOAPProcessingException(

+                    "Expecting SOAP 1.1 implementation of SOAP Body as the parent. But received some other implementation");

+        }

+    }

+

+    public void setRole(String roleURI) {

+        setAttribute(SOAP11Constants.ATTR_ACTOR,

+                roleURI,

+                SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);

+

+    }

+

+    public String getRole() {

+        return getAttribute(SOAP11Constants.ATTR_ACTOR,

+                SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);

+    }

+

+    public void setMustUnderstand(boolean mustUnderstand) {

+        setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,

+                mustUnderstand ? "1" : "0",

+                SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);

+    }

+

+    public void setMustUnderstand(String mustUnderstand) throws SOAPProcessingException {

+        if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equals(mustUnderstand) ||

+                SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equals(mustUnderstand) ||

+                SOAPConstants.ATTR_MUSTUNDERSTAND_0.equals(mustUnderstand) ||

+                SOAPConstants.ATTR_MUSTUNDERSTAND_1.equals(mustUnderstand)) {

+            setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,

+                    mustUnderstand,

+                    SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);

+        } else {

+            throw new SOAPProcessingException(

+                    "mustUndertand should be one of \"true\", \"false\", \"0\" or \"1\" ");

+        }

+    }

+

+    /**

+     * Returns whether the mustUnderstand attribute for this

+     * <CODE>SOAPHeaderBlock</CODE> object is turned on.

+     *

+     * @return <CODE>true</CODE> if the mustUnderstand attribute of

+     *         this <CODE>SOAPHeaderBlock</CODE> object is turned on;

+     *         <CODE>false</CODE> otherwise

+     */

+    public boolean getMustUnderstand() throws SOAPProcessingException {

+        String mustUnderstand = "";

+        if ((mustUnderstand =

+                getAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,

+                        SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI))

+                != null) {

+            if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equalsIgnoreCase(

+                    mustUnderstand) ||

+                    SOAPConstants.ATTR_MUSTUNDERSTAND_1.equalsIgnoreCase(

+                            mustUnderstand)) {

+                return true;

+            } else if (SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equalsIgnoreCase(

+                    mustUnderstand) ||

+                    SOAPConstants.ATTR_MUSTUNDERSTAND_0.equalsIgnoreCase(

+                            mustUnderstand)) {

+                return false;

+            } else {

+                throw new SOAPProcessingException(

+                        "Invalid value found in mustUnderstand value of " +

+                        this.getLocalName() +

+                        " header block");

+            }

+        }

+        return false;

+

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11HeaderImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11HeaderImpl.java
new file mode 100644
index 0000000..b462360
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11HeaderImpl.java
@@ -0,0 +1,93 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom.soap11;

+

+import org.apache.axiom.om.OMException;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.om.impl.OMNodeEx;

+import org.apache.axiom.om.impl.traverse.OMChildrenWithSpecificAttributeIterator;

+import org.apache.axiom.soap.SOAP11Constants;

+import org.apache.axiom.soap.SOAPEnvelope;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPHeaderBlock;

+import org.apache.axiom.soap.SOAPProcessingException;

+import org.apache.axiom.soap.impl.llom.SOAPHeaderImpl;

+

+import javax.xml.namespace.QName;

+import java.util.Iterator;

+

+public class SOAP11HeaderImpl extends SOAPHeaderImpl {

+

+    public SOAP11HeaderImpl(SOAPFactory factory)

+        throws SOAPProcessingException {

+        super(factory.getNamespace(), factory);

+    }

+    

+    /**

+     * @param envelope

+     */

+    public SOAP11HeaderImpl(SOAPEnvelope envelope, SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(envelope, factory);

+    }

+

+    /**

+     * Constructor SOAPHeaderImpl

+     *

+     * @param envelope

+     * @param builder

+     */

+    public SOAP11HeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder,

+            SOAPFactory factory) {

+        super(envelope, builder, factory);

+    }

+

+    public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns)

+            throws OMException {

+        

+        if (ns == null || ns.getNamespaceURI() == null || "".equals(ns.getNamespaceURI())) {

+            throw new OMException(

+                    "All the SOAP Header blocks should be namespace qualified");

+        }

+

+        OMNamespace namespace = findNamespace(ns.getNamespaceURI(), ns.getPrefix());

+        if (namespace != null) {

+            ns = namespace;

+        }

+

+        SOAPHeaderBlock soapHeaderBlock = null;

+        try {

+            soapHeaderBlock = new SOAP11HeaderBlockImpl(localName, ns, this,

+                    (SOAPFactory)this.factory);

+        } catch (SOAPProcessingException e) {

+            throw new OMException(e);

+        }

+        ((OMNodeEx)soapHeaderBlock).setComplete(true);

+        return soapHeaderBlock;

+    }

+

+    public Iterator extractHeaderBlocks(String role) {

+        return new OMChildrenWithSpecificAttributeIterator(getFirstOMChild(),

+                new QName(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,

+                        SOAP11Constants.ATTR_ACTOR),

+                role,

+                true);

+

+    }

+

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12BodyImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12BodyImpl.java
new file mode 100644
index 0000000..e26a029
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12BodyImpl.java
@@ -0,0 +1,54 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom.soap12;

+

+import org.apache.axiom.om.OMException;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.soap.*;

+import org.apache.axiom.soap.impl.llom.SOAPBodyImpl;

+

+public class SOAP12BodyImpl extends SOAPBodyImpl {

+

+    public SOAP12BodyImpl(SOAPFactory factory) {

+         super(SOAPConstants.BODY_LOCAL_NAME, factory.getNamespace(),

+                factory);

+    }

+

+    /**

+     * @param envelope

+     */

+    public SOAP12BodyImpl(SOAPEnvelope envelope, SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(envelope, factory);

+    }

+

+    /**

+     * Constructor SOAPBodyImpl

+     *

+     * @param envelope

+     * @param builder

+     */

+    public SOAP12BodyImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder,

+            SOAPFactory factory) {

+        super(envelope, builder, factory);

+    }

+

+    public SOAPFault addFault(Exception e) throws OMException {

+        return new SOAP12FaultImpl(this, e,

+                (SOAPFactory) this.factory);

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12Factory.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12Factory.java
new file mode 100644
index 0000000..011e052
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12Factory.java
@@ -0,0 +1,313 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom.soap12;

+

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.om.impl.OMNamespaceImpl;

+import org.apache.axiom.om.impl.llom.factory.OMLinkedListImplFactory;

+import org.apache.axiom.soap.SOAP12Constants;

+import org.apache.axiom.soap.SOAPBody;

+import org.apache.axiom.soap.SOAPEnvelope;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPFault;

+import org.apache.axiom.soap.SOAPFaultCode;

+import org.apache.axiom.soap.SOAPFaultDetail;

+import org.apache.axiom.soap.SOAPFaultNode;

+import org.apache.axiom.soap.SOAPFaultReason;

+import org.apache.axiom.soap.SOAPFaultRole;

+import org.apache.axiom.soap.SOAPFaultSubCode;

+import org.apache.axiom.soap.SOAPFaultText;

+import org.apache.axiom.soap.SOAPFaultValue;

+import org.apache.axiom.soap.SOAPHeader;

+import org.apache.axiom.soap.SOAPHeaderBlock;

+import org.apache.axiom.soap.SOAPMessage;

+import org.apache.axiom.soap.SOAPProcessingException;

+import org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl;

+import org.apache.axiom.soap.impl.llom.SOAPMessageImpl;

+

+public class SOAP12Factory extends OMLinkedListImplFactory implements SOAPFactory {

+    /**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+

+    public String getSoapVersionURI() {

+        return SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;

+    }

+

+    public OMNamespace getNamespace() {

+        return new OMNamespaceImpl(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,

+                SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX);

+    }

+

+    public SOAPEnvelope createSOAPEnvelope() {

+        return new SOAPEnvelopeImpl(

+                new OMNamespaceImpl(

+                        SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,

+                        SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX),

+                this);

+    }

+

+    public SOAPHeader createSOAPHeader(SOAPEnvelope envelope) throws SOAPProcessingException {

+        return new SOAP12HeaderImpl(envelope, this);

+    }

+

+    public SOAPHeader createSOAPHeader() throws SOAPProcessingException {

+        return new SOAP12HeaderImpl(this);

+    }

+

+    public SOAPHeader createSOAPHeader(SOAPEnvelope envelope,

+                                       OMXMLParserWrapper builder) {

+        return new SOAP12HeaderImpl(envelope, builder, this);

+    }

+

+    public SOAPHeaderBlock createSOAPHeaderBlock(String localName,

+            OMNamespace ns, SOAPHeader parent) throws SOAPProcessingException {

+        return new SOAP12HeaderBlockImpl(localName, ns, parent, this);

+    }

+

+    public SOAPHeaderBlock createSOAPHeaderBlock(String localName,

+            OMNamespace ns, SOAPHeader parent, OMXMLParserWrapper builder)

+            throws SOAPProcessingException {

+        return new SOAP12HeaderBlockImpl(localName, ns, parent, builder, this);

+    }

+

+    public SOAPFault createSOAPFault(SOAPBody parent, Exception e)

+            throws SOAPProcessingException {

+        return new SOAP12FaultImpl(parent, e, this);

+    }

+

+    public SOAPFault createSOAPFault(SOAPBody parent)

+            throws SOAPProcessingException {

+        return new SOAP12FaultImpl(parent, this);

+    }

+

+    public SOAPFault createSOAPFault() throws SOAPProcessingException {

+        return new SOAP12FaultImpl(this);

+    }

+

+    public SOAPFault createSOAPFault(SOAPBody parent,

+                                     OMXMLParserWrapper builder) {

+        return new SOAP12FaultImpl(parent, builder, this);

+    }

+

+    public SOAPBody createSOAPBody(SOAPEnvelope envelope)

+            throws SOAPProcessingException {

+        return new SOAP12BodyImpl(envelope, this);

+    }

+

+    public SOAPBody createSOAPBody() throws SOAPProcessingException {

+        return new SOAP12BodyImpl(this);

+    }

+

+    public SOAPBody createSOAPBody(SOAPEnvelope envelope,

+                                   OMXMLParserWrapper builder) {

+        return new SOAP12BodyImpl(envelope, builder, this);

+    }

+

+    public SOAPFaultCode createSOAPFaultCode(SOAPFault parent)

+            throws SOAPProcessingException {

+        return new SOAP12FaultCodeImpl(parent, this);

+    }

+

+    public SOAPFaultCode createSOAPFaultCode() throws SOAPProcessingException {

+        return new SOAP12FaultCodeImpl(this);

+    }

+

+    public SOAPFaultCode createSOAPFaultCode(SOAPFault parent,

+                                             OMXMLParserWrapper builder) {

+        return new SOAP12FaultCodeImpl(parent, builder, this);

+    }

+

+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent)

+            throws SOAPProcessingException {

+        return new SOAP12FaultValueImpl(parent, this);

+    }

+

+    public SOAPFaultValue createSOAPFaultValue() throws SOAPProcessingException {

+        return new SOAP12FaultValueImpl(this);

+    }

+

+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent,

+                                               OMXMLParserWrapper builder) {

+        return new SOAP12FaultValueImpl(parent, builder, this);

+    }

+

+    public SOAPHeaderBlock createSOAPHeaderBlock(String localName,

+            OMNamespace ns) throws SOAPProcessingException {

+        return new SOAP12HeaderBlockImpl(localName, ns, this);

+    }

+

+    //added

+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent)

+            throws SOAPProcessingException {

+        return new SOAP12FaultValueImpl(parent, this);

+    }

+

+    //added

+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent,

+                                               OMXMLParserWrapper builder) {

+        return new SOAP12FaultValueImpl(parent, builder, this);

+    }

+

+    //changed

+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent)

+            throws SOAPProcessingException {

+        return new SOAP12FaultSubCodeImpl(parent, this);

+    }

+

+    public SOAPFaultSubCode createSOAPFaultSubCode()

+            throws SOAPProcessingException {

+        return new SOAP12FaultSubCodeImpl(this);

+    }

+

+    //changed

+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent,

+                                                   OMXMLParserWrapper builder) {

+        return new SOAP12FaultSubCodeImpl(parent, builder, this);

+    }

+

+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent)

+            throws SOAPProcessingException {

+        return new SOAP12FaultSubCodeImpl(parent, this);

+    }

+

+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent,

+                                                   OMXMLParserWrapper builder) {

+        return new SOAP12FaultSubCodeImpl(parent, builder, this);

+    }

+

+    public SOAPFaultReason createSOAPFaultReason(SOAPFault parent)

+            throws SOAPProcessingException {

+        return new SOAP12FaultReasonImpl(parent, this);

+    }

+

+    public SOAPFaultReason createSOAPFaultReason() throws SOAPProcessingException {

+        return new SOAP12FaultReasonImpl(this);

+    }

+

+    public SOAPFaultReason createSOAPFaultReason(SOAPFault parent,

+                                                 OMXMLParserWrapper builder) {

+        return new SOAP12FaultReasonImpl(parent, builder, this);

+    }

+

+    public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent)

+            throws SOAPProcessingException {

+        return new SOAP12FaultTextImpl(parent, this);

+    }

+

+    public SOAPFaultText createSOAPFaultText() throws SOAPProcessingException {

+        return new SOAP12FaultTextImpl(this);

+    }

+

+    public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent,

+                                             OMXMLParserWrapper builder) {

+        return new SOAP12FaultTextImpl(parent, builder, this);

+    }

+

+    public SOAPFaultNode createSOAPFaultNode(SOAPFault parent)

+            throws SOAPProcessingException {

+        return new SOAP12FaultNodeImpl(parent, this);

+    }

+

+    public SOAPFaultNode createSOAPFaultNode() throws SOAPProcessingException {

+        return new SOAP12FaultNodeImpl(this);

+    }

+

+    public SOAPFaultNode createSOAPFaultNode(SOAPFault parent,

+                                             OMXMLParserWrapper builder) {

+        return new SOAP12FaultNodeImpl(parent, builder, this);

+    }

+

+    public SOAPFaultRole createSOAPFaultRole(SOAPFault parent)

+            throws SOAPProcessingException {

+        return new SOAP12FaultRoleImpl(parent, this);

+    }

+

+    public SOAPFaultRole createSOAPFaultRole() throws SOAPProcessingException {

+        return new SOAP12FaultRoleImpl(this);

+    }

+

+    public SOAPFaultRole createSOAPFaultRole(SOAPFault parent,

+                                             OMXMLParserWrapper builder) {

+        return new SOAP12FaultRoleImpl(parent, builder, this);

+    }

+

+    public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent)

+            throws SOAPProcessingException {

+        return new SOAP12FaultDetailImpl(parent, this);

+    }

+

+    public SOAPFaultDetail createSOAPFaultDetail()

+            throws SOAPProcessingException {

+        return new SOAP12FaultDetailImpl(this);

+    }

+

+    public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent,

+                                                 OMXMLParserWrapper builder) {

+        return new SOAP12FaultDetailImpl(parent, builder, this);

+    }

+

+    public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException {

+        OMNamespace ns =

+                new OMNamespaceImpl(

+                        SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,

+                        SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX);

+        SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns, this);

+        createSOAPHeader(env);

+        createSOAPBody(env);

+

+        return env;

+    }

+

+    public SOAPEnvelope getDefaultFaultEnvelope() throws SOAPProcessingException {

+        SOAPEnvelope defaultEnvelope = getDefaultEnvelope();

+        SOAPFault fault = createSOAPFault(defaultEnvelope.getBody());

+

+        SOAPFaultCode faultCode = createSOAPFaultCode(fault);

+        createSOAPFaultValue(faultCode);

+

+        SOAPFaultReason reason = createSOAPFaultReason(fault);

+        createSOAPFaultText(reason);

+

+        createSOAPFaultDetail(fault);

+

+        return defaultEnvelope;

+    }

+

+    public SOAPMessage createSOAPMessage() {

+        return new SOAPMessageImpl();

+    }

+

+    public SOAPMessage createSOAPMessage(OMXMLParserWrapper builder) {

+        return new SOAPMessageImpl(builder);

+    }

+

+

+    public SOAPMessage createSOAPMessage(SOAPEnvelope envelope, OMXMLParserWrapper parserWrapper) {

+        return new SOAPMessageImpl(envelope, parserWrapper);

+    }

+

+

+

+    public SOAPEnvelope createSOAPEnvelope(OMXMLParserWrapper builder) {

+        return new SOAPEnvelopeImpl(builder, this);

+    }

+

+

+

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java
new file mode 100644
index 0000000..b266b95
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java
@@ -0,0 +1,77 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom.soap12;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPFault;

+import org.apache.axiom.soap.SOAPFaultSubCode;

+import org.apache.axiom.soap.SOAPFaultValue;

+import org.apache.axiom.soap.SOAPProcessingException;

+import org.apache.axiom.soap.impl.llom.SOAPFaultCodeImpl;

+

+public class SOAP12FaultCodeImpl extends SOAPFaultCodeImpl {

+    /**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+

+    public SOAP12FaultCodeImpl(SOAPFactory factory) {

+        super(factory.getNamespace(), factory);

+    }

+

+    /**

+     * Constructor OMElementImpl

+     *

+     * @param parent

+     * @param builder

+     */

+    public SOAP12FaultCodeImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) {

+        super(parent, builder, factory);

+    }

+

+    /**

+     * @param parent

+     */

+    public SOAP12FaultCodeImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException {

+        super(parent, true, factory);

+    }

+

+

+    public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException {

+        if (!(subCode instanceof SOAP12FaultSubCodeImpl)) {

+            throw new SOAPProcessingException(

+                    "Expecting SOAP 1.2 implementation of SOAP Fault Sub Code. But received some other implementation");

+        }

+        super.setSubCode(subCode);

+    }

+

+    public void setValue(SOAPFaultValue value) throws SOAPProcessingException {

+        if (!(value instanceof SOAP12FaultValueImpl)) {

+            throw new SOAPProcessingException(

+                    "Expecting SOAP 1.2 implementation of SOAP Fault Value. But received some other implementation");

+        }

+        super.setValue(value);

+    }

+

+    protected void checkParent(OMElement parent) throws SOAPProcessingException {

+        if (!(parent instanceof SOAP12FaultImpl)) {

+            throw new SOAPProcessingException(

+                    "Expecting SOAP 1.2 implementation of SOAP Fault as the parent. But received some other implementation");

+        }

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultDetailImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultDetailImpl.java
new file mode 100644
index 0000000..91653df
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultDetailImpl.java
@@ -0,0 +1,50 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom.soap12;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPFault;

+import org.apache.axiom.soap.SOAPProcessingException;

+import org.apache.axiom.soap.impl.llom.SOAPFaultDetailImpl;

+

+

+public class SOAP12FaultDetailImpl extends SOAPFaultDetailImpl {

+

+    public SOAP12FaultDetailImpl(SOAPFactory factory) {

+        super(factory.getNamespace(), factory);

+    }

+

+    public SOAP12FaultDetailImpl(SOAPFault parent, SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(parent, true, factory);

+    }

+

+    public SOAP12FaultDetailImpl(SOAPFault parent, OMXMLParserWrapper builder,

+            SOAPFactory factory) {

+        super(parent, builder, factory);

+    }

+

+    protected void checkParent(OMElement parent) throws SOAPProcessingException {

+        if (!(parent instanceof SOAP12FaultImpl)) {

+            throw new SOAPProcessingException(

+                    "Expecting SOAP 1.2 implementation of SOAP Fault as the " +

+                    "parent. But received some other implementation");

+        }

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultImpl.java
new file mode 100644
index 0000000..efdbc3d
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultImpl.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.soap.impl.llom.soap12;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAPFaultDetail;
+import org.apache.axiom.soap.SOAPFaultNode;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPFaultRole;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.llom.SOAPFaultImpl;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+
+public class SOAP12FaultImpl extends SOAPFaultImpl {
+
+
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+
+
+    public SOAP12FaultImpl(SOAPFactory factory) {
+        super(factory.getNamespace(), factory);
+    }
+
+    public SOAP12FaultImpl(SOAPBody parent, Exception e, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, e, factory);
+    }
+
+    public SOAP12FaultImpl(SOAPBody parent, OMXMLParserWrapper builder,
+                           SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    /**
+     * This is a convenience method for the SOAP Fault Impl.
+     *
+     * @param parent
+     */
+    public SOAP12FaultImpl(SOAPBody parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, factory);
+    }
+
+    protected SOAPFaultDetail getNewSOAPFaultDetail(SOAPFault fault) {
+        return new SOAP12FaultDetailImpl(fault, (SOAPFactory)this.factory);
+
+    }
+
+    public void setCode(SOAPFaultCode soapFaultCode)
+            throws SOAPProcessingException {
+        if (!(soapFaultCode instanceof SOAP12FaultCodeImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault Code. " +
+                    "But received some other implementation");
+        }
+        super.setCode(soapFaultCode);
+    }
+
+
+    public void setReason(SOAPFaultReason reason) throws SOAPProcessingException {
+        if (!(reason instanceof SOAP12FaultReasonImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault Reason. " +
+                    "But received some other implementation");
+        }
+        super.setReason(reason);
+    }
+
+    public void setNode(SOAPFaultNode node) throws SOAPProcessingException {
+        if (!(node instanceof SOAP12FaultNodeImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault Node. " +
+                    "But received some other implementation");
+        }
+        super.setNode(node);
+    }
+
+    public void setRole(SOAPFaultRole role) throws SOAPProcessingException {
+        if (!(role instanceof SOAP12FaultRoleImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault Role. " +
+                    "But received some other implementation");
+        }
+        super.setRole(role);
+    }
+
+    public void setDetail(SOAPFaultDetail detail) throws SOAPProcessingException {
+        if (!(detail instanceof SOAP12FaultDetailImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault Detail. " +
+                    "But received some other implementation");
+        }
+        super.setDetail(detail);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12BodyImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Body as the " +
+                    "parent. But received some other implementation");
+        }
+    }
+
+    protected void serializeFaultNode(
+            XMLStreamWriter writer)
+            throws XMLStreamException {
+        SOAPFaultNode faultNode = getNode();
+        if (faultNode != null && faultNode.getText() != null
+                && !"".equals(faultNode.getText())) {
+            faultNode.serialize(writer);
+        }
+    }
+
+}
diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultNodeImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultNodeImpl.java
new file mode 100644
index 0000000..86aed27
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultNodeImpl.java
@@ -0,0 +1,47 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom.soap12;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPFault;

+import org.apache.axiom.soap.SOAPProcessingException;

+import org.apache.axiom.soap.impl.llom.SOAPFaultNodeImpl;

+

+

+public class SOAP12FaultNodeImpl extends SOAPFaultNodeImpl {

+

+    public SOAP12FaultNodeImpl(SOAPFactory factory) {

+        super(factory.getNamespace(), factory);

+    }

+

+    public SOAP12FaultNodeImpl(SOAPFault parent, SOAPFactory factory) throws SOAPProcessingException {

+        super(parent, factory);

+    }

+

+    public SOAP12FaultNodeImpl(SOAPFault parent, OMXMLParserWrapper builder, SOAPFactory factory) {

+        super(parent, builder, factory);

+    }

+

+    protected void checkParent(OMElement parent) throws SOAPProcessingException {

+        if (!(parent instanceof SOAP12FaultImpl)) {

+            throw new SOAPProcessingException(

+                    "Expecting SOAP 1.2 implementation of SOAP Fault as the parent. But received some other implementation");

+        }

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultReasonImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultReasonImpl.java
new file mode 100644
index 0000000..9d61ae5
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultReasonImpl.java
@@ -0,0 +1,65 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom.soap12;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPFault;

+import org.apache.axiom.soap.SOAPFaultText;

+import org.apache.axiom.soap.SOAPProcessingException;

+import org.apache.axiom.soap.impl.llom.SOAPFaultReasonImpl;

+

+public class SOAP12FaultReasonImpl extends SOAPFaultReasonImpl {

+    /**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+    public SOAP12FaultReasonImpl(SOAPFault parent, OMXMLParserWrapper builder,

+            SOAPFactory factory) {

+        super(parent, builder, factory);

+    }

+

+    public SOAP12FaultReasonImpl(SOAPFactory factory) {

+        super(factory.getNamespace(), factory);

+    }

+

+    /**

+     * @param parent

+     */

+    public SOAP12FaultReasonImpl(SOAPFault parent, SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(parent, true, factory);

+    }

+

+    public void addSOAPText(SOAPFaultText soapFaultText)

+            throws SOAPProcessingException {

+        if (!(soapFaultText instanceof SOAP12FaultTextImpl)) {

+            throw new SOAPProcessingException(

+                    "Expecting SOAP 1.2 implementation of SOAP Fault Text. " +

+                    "But received some other implementation");

+        }

+        super.addSOAPText(soapFaultText);

+    }

+

+    protected void checkParent(OMElement parent) throws SOAPProcessingException {

+        if (!(parent instanceof SOAP12FaultImpl)) {

+            throw new SOAPProcessingException(

+                    "Expecting SOAP 1.2 implementation of SOAP Fault as the " +

+                    "parent. But received some other implementation");

+        }

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultRoleImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultRoleImpl.java
new file mode 100644
index 0000000..9b35c52
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultRoleImpl.java
@@ -0,0 +1,49 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom.soap12;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPFault;

+import org.apache.axiom.soap.SOAPProcessingException;

+import org.apache.axiom.soap.impl.llom.SOAPFaultRoleImpl;

+

+public class SOAP12FaultRoleImpl extends SOAPFaultRoleImpl {

+    

+    public SOAP12FaultRoleImpl(SOAPFault parent, SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(parent, true, factory);

+    }

+

+    public SOAP12FaultRoleImpl(SOAPFactory factory) {

+        super(factory.getNamespace(), factory);

+    }

+

+    public SOAP12FaultRoleImpl(SOAPFault parent, OMXMLParserWrapper builder,

+            SOAPFactory factory) {

+        super(parent, builder, factory);

+    }

+

+    protected void checkParent(OMElement parent) throws SOAPProcessingException {

+        if (!(parent instanceof SOAP12FaultImpl)) {

+            throw new SOAPProcessingException(

+                    "Expecting SOAP 1.2 implementation of SOAP Fault as the " +

+                    "parent. But received some other implementation");

+        }

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java
new file mode 100644
index 0000000..698a6f6
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java
@@ -0,0 +1,88 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom.soap12;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.soap.SOAP12Constants;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPFaultCode;

+import org.apache.axiom.soap.SOAPFaultSubCode;

+import org.apache.axiom.soap.SOAPFaultValue;

+import org.apache.axiom.soap.SOAPProcessingException;

+import org.apache.axiom.soap.impl.llom.SOAPFaultSubCodeImpl;

+

+public class SOAP12FaultSubCodeImpl extends SOAPFaultSubCodeImpl {

+    //changed

+    public SOAP12FaultSubCodeImpl(SOAPFaultCode parent, SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, factory);

+    }

+

+     public SOAP12FaultSubCodeImpl(SOAPFactory factory) {

+        super(factory.getNamespace(), factory);

+    }

+

+    //changed

+    public SOAP12FaultSubCodeImpl(SOAPFaultCode parent,

+                                  OMXMLParserWrapper builder,

+                                  SOAPFactory factory) {

+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder,

+                factory);

+    }

+

+    public SOAP12FaultSubCodeImpl(SOAPFaultSubCode parent, SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, factory);

+    }

+

+    public SOAP12FaultSubCodeImpl(SOAPFaultSubCode parent,

+            OMXMLParserWrapper builder, SOAPFactory factory) {

+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder,

+                factory);

+    }

+

+    protected void checkParent(OMElement parent) throws SOAPProcessingException {

+        if (!((parent instanceof SOAP12FaultSubCodeImpl) ||

+                (parent instanceof SOAP12FaultCodeImpl))) {

+            throw new SOAPProcessingException(

+                    "Expecting SOAP 1.2 implementation of SOAP FaultSubCode " +

+                    "or SOAP FaultCodeValue as the parent. But received some " +

+                    "other implementation");

+        }

+    }

+

+    public void setSubCode(SOAPFaultSubCode subCode)

+            throws SOAPProcessingException {

+        if (!(subCode instanceof SOAP12FaultSubCodeImpl)) {

+            throw new SOAPProcessingException(

+                    "Expecting SOAP 1.2 implementation of SOAP Fault Sub " +

+                    "Code. But received some other implementation");

+        }

+        super.setSubCode(subCode);

+    }

+

+    public void setValue(SOAPFaultValue soapFaultSubCodeValue)

+            throws SOAPProcessingException {

+        if (!(soapFaultSubCodeValue instanceof SOAP12FaultValueImpl)) {

+            throw new SOAPProcessingException(

+                    "Expecting SOAP 1.2 implementation of SOAP Fault Value. " +

+                    "But received some other implementation");

+        }

+        super.setValue(soapFaultSubCodeValue);

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultTextImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultTextImpl.java
new file mode 100644
index 0000000..ca2e922
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultTextImpl.java
@@ -0,0 +1,49 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom.soap12;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPFaultReason;

+import org.apache.axiom.soap.SOAPProcessingException;

+import org.apache.axiom.soap.impl.llom.SOAPFaultTextImpl;

+

+public class SOAP12FaultTextImpl extends SOAPFaultTextImpl {

+    

+    public SOAP12FaultTextImpl(SOAPFaultReason parent, SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(parent, factory);

+    }

+

+    public SOAP12FaultTextImpl(SOAPFactory factory) throws SOAPProcessingException {

+        super(factory.getNamespace(), factory);

+    }

+

+    public SOAP12FaultTextImpl(SOAPFaultReason parent,

+                               OMXMLParserWrapper builder,

+                               SOAPFactory factory) {

+        super(parent, builder, factory);

+    }

+

+    protected void checkParent(OMElement parent) throws SOAPProcessingException {

+        if (!(parent instanceof SOAP12FaultReasonImpl)) {

+            throw new SOAPProcessingException(

+                    "Expecting SOAP 1.2 implementation of SOAP FaultReason as the parent. But received some other implementation");

+        }

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultValueImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultValueImpl.java
new file mode 100644
index 0000000..c2dbe87
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultValueImpl.java
@@ -0,0 +1,50 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom.soap12;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPProcessingException;

+import org.apache.axiom.soap.impl.llom.SOAPFaultValueImpl;

+

+

+public class SOAP12FaultValueImpl extends SOAPFaultValueImpl {

+    

+    public SOAP12FaultValueImpl(OMElement parent, SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(parent, factory);

+    }

+

+    public SOAP12FaultValueImpl(SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(factory.getNamespace(), factory);

+    }

+

+    public SOAP12FaultValueImpl(OMElement parent, OMXMLParserWrapper builder,

+            SOAPFactory factory) {

+        super(parent, builder, factory);

+    }

+

+    protected void checkParent(OMElement parent) throws SOAPProcessingException {

+        if (!((parent instanceof SOAP12FaultSubCodeImpl) ||

+                (parent instanceof SOAP12FaultCodeImpl))) {

+            throw new SOAPProcessingException(

+                    "Expecting SOAP 1.2 implementation of SOAP FaultSubCode or SOAP FaultCode as the parent. But received some other implementation");

+        }

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12HeaderBlockImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12HeaderBlockImpl.java
new file mode 100644
index 0000000..7fad33c
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12HeaderBlockImpl.java
@@ -0,0 +1,137 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom.soap12;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.soap.SOAP12Constants;

+import org.apache.axiom.soap.SOAPConstants;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPHeader;

+import org.apache.axiom.soap.SOAPProcessingException;

+import org.apache.axiom.soap.impl.llom.SOAPHeaderBlockImpl;

+

+public class SOAP12HeaderBlockImpl extends SOAPHeaderBlockImpl {

+

+    public SOAP12HeaderBlockImpl(String localName, OMNamespace ns,

+            SOAPFactory factory) {

+        super(localName, ns, factory);

+    }

+    /**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+    /**

+     * @param localName

+     * @param ns

+     */

+    public SOAP12HeaderBlockImpl(String localName,

+                                 OMNamespace ns,

+                                 SOAPHeader parent,

+                                 SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(localName, ns, parent, factory);

+        checkParent(parent);

+    }

+

+    /**

+     * Constructor SOAPHeaderBlockImpl

+     *

+     * @param localName

+     * @param ns

+     * @param parent

+     * @param builder

+     */

+    public SOAP12HeaderBlockImpl(String localName,

+                                 OMNamespace ns,

+                                 SOAPHeader parent,

+                                 OMXMLParserWrapper builder,

+                                 SOAPFactory factory) {

+        super(localName, ns, parent, builder, factory);

+

+    }

+

+    protected void checkParent(OMElement parent) throws SOAPProcessingException {

+        if (!(parent instanceof SOAP12HeaderImpl)) {

+            throw new SOAPProcessingException(

+                    "Expecting SOAP 1.2 implementation of SOAP Body as " +

+                    "the parent. But received some other implementation");

+        }

+    }

+

+    public void setRole(String roleURI) {

+        setAttribute(SOAP12Constants.SOAP_ROLE,

+                roleURI,

+                SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);

+    }

+

+    public String getRole() {

+        return getAttribute(SOAP12Constants.SOAP_ROLE,

+                SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);

+

+    }

+

+    public void setMustUnderstand(boolean mustUnderstand) {

+        setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,

+                mustUnderstand ? "1" : "0",

+                SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);

+

+    }

+

+    public void setMustUnderstand(String mustUnderstand)

+            throws SOAPProcessingException {

+        if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equals(mustUnderstand) ||

+                SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equals(mustUnderstand) ||

+                SOAPConstants.ATTR_MUSTUNDERSTAND_0.equals(mustUnderstand) ||

+                SOAPConstants.ATTR_MUSTUNDERSTAND_1.equals(mustUnderstand)) {

+            setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,

+                    mustUnderstand,

+                    SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);

+        } else {

+            throw new SOAPProcessingException(

+                    "mustUndertand should be one of \"true\", " +

+                    "\"false\", \"0\" or \"1\" ");

+        }

+    }

+

+    public boolean getMustUnderstand() throws SOAPProcessingException {

+        String mustUnderstand = "";

+        if ((mustUnderstand =

+                getAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,

+                        SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI))

+                != null) {

+            if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equalsIgnoreCase(

+                    mustUnderstand) ||

+                    SOAPConstants.ATTR_MUSTUNDERSTAND_1.equalsIgnoreCase(

+                            mustUnderstand)) {

+                return true;

+            } else if (SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equalsIgnoreCase(

+                    mustUnderstand) ||

+                    SOAPConstants.ATTR_MUSTUNDERSTAND_0.equalsIgnoreCase(

+                            mustUnderstand)) {

+                return false;

+            } else {

+                throw new SOAPProcessingException(

+                        "Invalid value found in mustUnderstand value of " +

+                        this.getLocalName() +

+                        " header block");

+            }

+        }

+        return false;

+

+    }

+}

diff --git a/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12HeaderImpl.java b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12HeaderImpl.java
new file mode 100644
index 0000000..40ad8cd
--- /dev/null
+++ b/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12HeaderImpl.java
@@ -0,0 +1,93 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom.soap12;

+

+import org.apache.axiom.om.OMException;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.om.impl.OMNodeEx;

+import org.apache.axiom.om.impl.traverse.OMChildrenWithSpecificAttributeIterator;

+import org.apache.axiom.soap.SOAP12Constants;

+import org.apache.axiom.soap.SOAPEnvelope;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.SOAPHeaderBlock;

+import org.apache.axiom.soap.SOAPProcessingException;

+import org.apache.axiom.soap.impl.llom.SOAPHeaderImpl;

+

+import javax.xml.namespace.QName;

+import java.util.Iterator;

+

+public class SOAP12HeaderImpl extends SOAPHeaderImpl {

+    /**

+     * Eran Chinthaka (chinthaka@apache.org)

+     */

+

+    public SOAP12HeaderImpl(SOAPFactory factory) {

+        super(factory.getNamespace(), factory);

+    }

+

+    /**

+     * @param envelope

+     */

+    public SOAP12HeaderImpl(SOAPEnvelope envelope, SOAPFactory factory)

+            throws SOAPProcessingException {

+        super(envelope, factory);

+    }

+

+    /**

+     * Constructor SOAPHeaderImpl

+     *

+     * @param envelope

+     * @param builder

+     */

+    public SOAP12HeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder,

+            SOAPFactory factory) {

+        super(envelope, builder, factory);

+    }

+

+    public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns) throws OMException {

+        if (ns == null || ns.getNamespaceURI() == null || "".equals(ns.getNamespaceURI())) {

+            throw new OMException(

+                    "All the SOAP Header blocks should be namespace qualified");

+        }

+

+        OMNamespace namespace = findNamespace(ns.getNamespaceURI(), ns.getPrefix());

+        if (namespace != null) {

+            ns = namespace;

+        }

+

+        SOAPHeaderBlock soapHeaderBlock = null;

+        try {

+            soapHeaderBlock = new SOAP12HeaderBlockImpl(localName, ns, this,

+                    (SOAPFactory) this.factory);

+        } catch (SOAPProcessingException e) {

+            throw new OMException(e);

+        }

+        ((OMNodeEx) soapHeaderBlock).setComplete(true);

+        return soapHeaderBlock;

+    }

+

+

+    public Iterator extractHeaderBlocks(String role) {

+        return new OMChildrenWithSpecificAttributeIterator(getFirstOMChild(),

+                new QName(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,

+                        SOAP12Constants.SOAP_ROLE),

+                role,

+                true);

+    }

+

+}

diff --git a/axiom/modules/axiom-tests/pom.xml b/axiom/modules/axiom-tests/pom.xml
new file mode 100644
index 0000000..2393efc
--- /dev/null
+++ b/axiom/modules/axiom-tests/pom.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+    xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.ws.commons.axiom</groupId>
+    <artifactId>axiom-parent</artifactId>
+    <version>SNAPSHOT</version> <!-- Should better be ${axiom.version} -->
+  </parent>
+  <artifactId>axiom-tests</artifactId>
+  <name>Axiom Test Suite</name>
+  <description>
+    The Axiom test suite. This ought to be split into several parts and be made
+    a part of axiom-api, axiom-impl and axiom-dom. However, that's not as easy
+    as it seems. The intention is to start with axiom-test and continuosly move
+    parts to the actual projects.
+  </description>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.ws.commons.axiom</groupId>
+      <artifactId>axiom-impl</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.ws.commons.axiom</groupId>
+      <artifactId>axiom-dom</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>xmlunit</groupId>
+      <artifactId>xmlunit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>stax</groupId>
+      <artifactId>stax-api</artifactId>
+      <version>1.0.1</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>woodstox</groupId>
+      <artifactId>wstx-asl</artifactId>
+      <version>2.9.3</version>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <includes>
+            <include>**/*Test.java</include>
+          </includes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java
new file mode 100644
index 0000000..5415102
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/AttachmentsTest.java
@@ -0,0 +1,228 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.attachments;
+
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.activation.DataHandler;
+import javax.activation.FileDataSource;
+
+import org.apache.axiom.om.AbstractTestCase;
+
+public class AttachmentsTest extends AbstractTestCase {
+
+    public AttachmentsTest(String testName) {
+        super(testName);
+    }
+
+    String inMimeFileName = "mtom/MTOMAttachmentStream.bin";
+    String img1FileName = "mtom/img/test.jpg";
+    String img2FileName = "mtom/img/test2.jpg";
+
+    String contentTypeString = "multipart/related; boundary=\"MIMEBoundaryurn:uuid:A3ADBAEE51A1A87B2A11443668160701\"; type=\"application/xop+xml\"; start=\"<0.urn:uuid:A3ADBAEE51A1A87B2A11443668160702@apache.org>\"; start-info=\"application/soap+xml\"; charset=UTF-8;action=\"mtomSample\"";
+
+    public void testMIMEHelper() {
+    }
+
+    public void testGetAttachmentSpecType() {
+    }
+
+    public void testSimultaneousStreamAccess() throws Exception {
+        InputStream inStream;
+        Attachments attachments;
+
+        inStream = new FileInputStream(getTestResourceFile(inMimeFileName));
+        attachments = new Attachments(inStream, contentTypeString);
+
+        attachments.getDataHandler("2.urn:uuid:A3ADBAEE51A1A87B2A11443668160994@apache.org");
+
+        // This should throw an error
+        try {
+        	attachments.getIncomingAttachmentStreams();
+        	fail("No exception caught when attempting to access datahandler and stream at the same time");
+        } catch (IllegalStateException ise) {
+        	// Nothing
+        }
+
+        inStream.close();
+
+        // Try the other way around.
+        inStream = new FileInputStream(getTestResourceFile(inMimeFileName));
+        attachments = new Attachments(inStream, contentTypeString);
+
+        attachments.getIncomingAttachmentStreams();
+
+        // These should NOT throw error even though they are using part based access
+        try {
+            assertEquals("application/xop+xml; charset=UTF-8; type=\"application/soap+xml\";", attachments.getSOAPPartContentType());
+        } catch (IllegalStateException ise) {
+        	fail("No exception expected when requesting SOAP part data");
+        	ise.printStackTrace();
+        }
+
+        try {
+            attachments.getSOAPPartInputStream();
+        } catch (IllegalStateException ise) {
+        	fail("No exception expected when requesting SOAP part data");
+        }
+
+        // These should throw an error
+        try {
+            attachments.getDataHandler("2.urn:uuid:A3ADBAEE51A1A87B2A11443668160994@apache.org");
+        	fail("No exception caught when attempting to access stream and datahandler at the same time");
+        } catch (IllegalStateException ise) {
+        	// Nothing
+        }
+
+        // Additionally, we also need to ensure mutual exclusion if someone
+        // tries to access part data directly
+
+        try {
+            attachments.getAllContentIDs();
+        	fail("No exception caught when attempting to access stream and contentids list at the same time");
+        } catch (IllegalStateException ise) {
+        	// Nothing
+        }
+
+        try {
+            attachments.getDataHandler("2.urn:uuid:A3ADBAEE51A1A87B2A11443668160994@apache.org");
+        	fail("No exception caught when attempting to access stream and part at the same time");
+        } catch (IllegalStateException ise) {
+        	// Nothing
+        }
+    }
+
+    public void testGetInputAttachhmentStreams() throws Exception {
+
+        IncomingAttachmentInputStream dataIs;
+        FileDataSource dataSource;
+        InputStream expectedDataIs;
+
+        InputStream inStream = new FileInputStream(getTestResourceFile(inMimeFileName));
+        Attachments attachments = new Attachments(inStream, contentTypeString);
+
+        // Since SOAP part operated independently of other streams, access it
+        // directly, and then get to the streams. If this sequence throws an
+        // error, something is wrong with the stream handling code.
+        InputStream is = attachments.getSOAPPartInputStream();
+        while (is.read() != -1);
+
+        // Get the inputstream container
+        IncomingAttachmentStreams ias = attachments.getIncomingAttachmentStreams();
+
+        dataIs = ias.getNextStream();
+        dataSource = new FileDataSource(getTestResourceFile(img1FileName));
+        expectedDataIs = dataSource.getInputStream();
+        compareStreams(dataIs, expectedDataIs);
+
+        dataIs = ias.getNextStream();
+        dataSource = new FileDataSource(getTestResourceFile(img2FileName));
+        expectedDataIs = dataSource.getInputStream();
+        compareStreams(dataIs, expectedDataIs);
+
+        // Confirm that no more streams are left
+        assertEquals(null, ias.getNextStream());
+
+        // After all is done, we should *still* be able to access and
+        // re-consume the SOAP part stream, as it should be cached.. can we?
+        is = attachments.getSOAPPartInputStream();
+        while (is.read() != -1);
+    }
+
+    private void compareStreams(InputStream data, InputStream expected) throws Exception {
+        byte[] dataArray = this.getStreamAsByteArray(data,-1);
+        byte[] expectedArray = this.getStreamAsByteArray(expected,-1);
+        if(dataArray.length == expectedArray.length) {
+            assertTrue(Arrays.equals(dataArray, expectedArray));
+        } else {
+            System.out.println("Skipping compare because of lossy image i/o ["+dataArray.length+"]["+expectedArray.length+"]");
+        }
+    }
+
+    public void testGetDataHandler() throws Exception {
+
+        InputStream inStream = new FileInputStream(getTestResourceFile(inMimeFileName));
+        Attachments attachments = new Attachments(inStream, contentTypeString);
+
+        DataHandler dh = attachments.getDataHandler("2.urn:uuid:A3ADBAEE51A1A87B2A11443668160994@apache.org");
+        InputStream dataIs = dh.getDataSource().getInputStream();
+
+        FileDataSource dataSource = new FileDataSource(getTestResourceFile(img2FileName));
+        InputStream expectedDataIs = dataSource.getInputStream();
+
+        // Compare data across streams
+        compareStreams(dataIs, expectedDataIs);
+    }
+    
+    public void testNonExistingMIMEPart() throws Exception {
+
+        InputStream inStream = new FileInputStream(getTestResourceFile(inMimeFileName));
+        Attachments attachments = new Attachments(inStream, contentTypeString);
+
+        DataHandler dh = attachments.getDataHandler("ThisShouldReturnNull");
+        assertNull(dh);
+    }
+    
+    public void testGetAllContentIDs() throws Exception {
+
+        InputStream inStream = new FileInputStream(getTestResourceFile(inMimeFileName));
+        Attachments attachments = new Attachments(inStream, contentTypeString);
+
+        String[] contentIDs = attachments.getAllContentIDs();
+        assertEquals(contentIDs.length,3);
+        assertEquals(contentIDs[0],"0.urn:uuid:A3ADBAEE51A1A87B2A11443668160702@apache.org");
+        assertEquals(contentIDs[1],"1.urn:uuid:A3ADBAEE51A1A87B2A11443668160943@apache.org");
+        assertEquals(contentIDs[2],"2.urn:uuid:A3ADBAEE51A1A87B2A11443668160994@apache.org");
+        
+        Set idSet = attachments.getContentIDSet();
+        assertTrue(idSet.contains("0.urn:uuid:A3ADBAEE51A1A87B2A11443668160702@apache.org"));
+        assertTrue(idSet.contains("2.urn:uuid:A3ADBAEE51A1A87B2A11443668160994@apache.org"));
+        assertTrue(idSet.contains("1.urn:uuid:A3ADBAEE51A1A87B2A11443668160943@apache.org"));
+    }
+    
+    /**
+     * Returns the contents of the input stream as byte array.
+     *
+     * @param stream the <code>InputStream</code>
+     * @param length the number of bytes to copy, if length < 0,
+     *               the number is unlimited
+     * @return the stream content as byte array
+     */
+    private byte[] getStreamAsByteArray(InputStream stream, int length) throws IOException {
+        if (length == 0) return new byte[0];
+        boolean checkLength = true;
+        if (length < 0) {
+            length = Integer.MAX_VALUE;
+            checkLength = false;
+        }
+        ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
+        int nextValue = stream.read();
+        if (checkLength) length--;
+        while (-1 != nextValue && length >= 0) {
+            byteStream.write(nextValue);
+            nextValue = stream.read();
+            if (checkLength) length--;
+        }
+        return byteStream.toByteArray();
+    }
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/Base64Test.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/Base64Test.java
new file mode 100644
index 0000000..dd4d466
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/Base64Test.java
@@ -0,0 +1,51 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.attachments;

+

+import junit.framework.TestCase;

+import org.apache.axiom.om.util.Base64;

+

+import java.io.ByteArrayInputStream;

+import java.io.ByteArrayOutputStream;

+import java.io.ObjectInputStream;

+import java.io.ObjectOutputStream;

+

+public class Base64Test extends TestCase {

+

+    Object expectedObject;

+

+    ByteArrayInputStream byteStream;

+

+    /*

+     * Class under test for String encode(byte[])

+     */

+

+    public void testEncodebyteArray() throws Exception {

+        Object actualObject;

+        String expectedBase64;

+        expectedObject = new String("Lanka Software Foundation");

+        ByteArrayOutputStream byteStream = new ByteArrayOutputStream();

+        ObjectOutputStream objectOutStream = new ObjectOutputStream(byteStream);

+        objectOutStream.writeObject(expectedObject);

+        expectedBase64 = Base64.encode(byteStream.toByteArray());

+        byte[] tempa = Base64.decode(expectedBase64);

+        ObjectInputStream objectInStream = new ObjectInputStream(

+                new ByteArrayInputStream(tempa));

+        actualObject = objectInStream.readObject();

+        assertEquals("Base64 Encoding Check", expectedObject, actualObject);

+    }

+}
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/ImageSampleTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/ImageSampleTest.java
new file mode 100644
index 0000000..e317336
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/ImageSampleTest.java
@@ -0,0 +1,165 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.attachments;

+

+import java.awt.Image;

+import java.awt.image.BufferedImage;

+import java.io.BufferedReader;

+import java.io.File;

+import java.io.FileInputStream;

+import java.io.FileOutputStream;

+import java.io.InputStream;

+import java.io.InputStreamReader;

+import java.io.OutputStream;

+import java.util.Iterator;

+

+import javax.activation.DataHandler;

+import javax.activation.FileDataSource;

+import javax.imageio.IIOImage;

+import javax.imageio.ImageIO;

+import javax.imageio.ImageWriter;

+import javax.imageio.stream.ImageOutputStream;

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLStreamReader;

+

+import org.apache.axiom.om.AbstractTestCase;

+import org.apache.axiom.om.OMAbstractFactory;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMFactory;

+import org.apache.axiom.om.OMOutputFormat;

+import org.apache.axiom.om.OMText;

+import org.apache.axiom.om.impl.OMNamespaceImpl;

+import org.apache.axiom.om.impl.llom.OMElementImpl;

+import org.apache.axiom.om.impl.llom.OMTextImpl;

+import org.apache.axiom.om.impl.mtom.MTOMStAXSOAPModelBuilder;

+

+public class ImageSampleTest extends AbstractTestCase {

+

+    public ImageSampleTest(String testName) {

+        super(testName);

+    }

+

+    /*

+     * @see TestCase#setUp()

+     */

+    Image expectedImage;

+

+    MTOMStAXSOAPModelBuilder builder;

+

+    DataHandler expectedDH;

+

+    File outMTOMFile;

+

+    File outBase64File;

+

+    String outFileName = "target/ActualImageMTOMOut.bin";

+

+    String outBase64FileName = "target/OMSerializeBase64Out.xml";

+

+    String imageInFileName = "mtom/img/test.jpg";

+

+    String imageOutFileName = "target/testOut.jpg";

+

+    String inMimeFileName = "mtom/ImageMTOMOut.bin";

+

+    String contentTypeString = "multipart/Related; type=\"application/xop+xml\";start=\"<SOAPPart>\"; boundary=\"----=_AxIs2_Def_boundary_=42214532\"";

+

+

+

+    public void testImageSampleSerialize() throws Exception {

+

+        outMTOMFile = new File(outFileName);

+        outBase64File = new File(outBase64FileName);

+        OMOutputFormat mtomOutputFormat = new OMOutputFormat();

+        mtomOutputFormat.setDoOptimize(true); 

+        OMOutputFormat baseOutputFormat = new OMOutputFormat();

+        baseOutputFormat.setDoOptimize(false);

+

+        OMFactory fac = OMAbstractFactory.getOMFactory();

+        OMNamespaceImpl soap = new OMNamespaceImpl(

+                "http://schemas.xmlsoap.org/soap/envelope/", "soap");

+        OMElement envelope = new OMElementImpl("Envelope", soap, fac);

+        OMElement body = new OMElementImpl("Body", soap, fac);

+

+        OMNamespaceImpl dataName = new OMNamespaceImpl(

+                "http://www.example.org/stuff", "m");

+        OMElement data = new OMElementImpl("data", dataName, fac);

+

+        FileDataSource dataSource = new FileDataSource(getTestResourceFile(imageInFileName));

+        expectedDH = new DataHandler(dataSource);

+        OMText binaryNode = new OMTextImpl(expectedDH, true, fac);

+

+        envelope.addChild(body);

+        body.addChild(data);

+        data.addChild(binaryNode);

+

+        envelope.serializeAndConsume(new FileOutputStream(outBase64File), baseOutputFormat);

+        envelope.serializeAndConsume(new FileOutputStream(outMTOMFile), mtomOutputFormat);

+    }

+

+    public void testImageSampleDeserialize() throws Exception {

+        InputStream inStream = new FileInputStream(

+                getTestResourceFile(inMimeFileName));

+        Attachments attachments = new Attachments(inStream, contentTypeString);

+        XMLStreamReader reader = XMLInputFactory.newInstance()

+                .createXMLStreamReader(

+                        new BufferedReader(

+                                new InputStreamReader(

+                                        attachments

+                .getSOAPPartInputStream())));

+        builder = new MTOMStAXSOAPModelBuilder(reader, attachments, null);

+        OMElement root = builder.getDocumentElement();

+        OMElement body = (OMElement) root.getFirstOMChild();

+        OMElement data = (OMElement) body.getFirstOMChild();

+        OMText blob = (OMText) data.getFirstOMChild();

+        /*

+         * Following is the procedure the user has to follow to read objects in

+         * OBBlob User has to know the object type & whether it is serializable.

+         * If it is not he has to use a Custom Defined DataSource to get the

+         * Object.

+         */

+

+        DataHandler actualDH;

+        actualDH = (DataHandler)blob.getDataHandler();

+        BufferedImage bufferedImage = ImageIO.read(actualDH.getDataSource().getInputStream());

+        this.saveImage("image/jpeg",bufferedImage, new FileOutputStream(imageOutFileName) );

+    }

+	/**

+     * Saves an image.

+     *

+     * @param mimeType the mime-type of the format to save the image

+     * @param image    the image to save

+     * @param os       the stream to write to

+     * @throws Exception if an error prevents image encoding

+     */

+    public void saveImage(String mimeType, BufferedImage image, OutputStream os)

+            throws Exception {

+

+        ImageWriter writer = null;

+        Iterator iter = javax.imageio.ImageIO.getImageWritersByMIMEType(mimeType);

+        if (iter.hasNext()) {

+            writer = (ImageWriter) iter.next();

+        }

+        ImageOutputStream ios = javax.imageio.ImageIO.createImageOutputStream(os);

+        writer.setOutput(ios);

+        

+        writer.write(new IIOImage(image, null, null));

+        ios.flush();

+        writer.dispose();

+    } // saveImage

+

+}
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/IncomingAttachmentInputTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/IncomingAttachmentInputTest.java
new file mode 100644
index 0000000..c2b00eb
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/IncomingAttachmentInputTest.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.attachments;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+import org.apache.axiom.om.AbstractTestCase;
+
+
+/**
+ * Test the PartOnFile class
+ */
+
+public class IncomingAttachmentInputTest extends AbstractTestCase {
+	
+	public IncomingAttachmentInputTest(String testName) {
+        super(testName);
+    }
+
+    String inMimeFileName = "mtom/MTOMAttachmentStream.bin";
+    String contentTypeString = "multipart/related; boundary=\"MIMEBoundaryurn:uuid:A3ADBAEE51A1A87B2A11443668160701\"; type=\"application/xop+xml\"; start=\"<0.urn:uuid:A3ADBAEE51A1A87B2A11443668160702@apache.org>\"; start-info=\"application/soap+xml\"; charset=UTF-8;action=\"mtomSample\"";
+    File temp;
+
+	public void testIncomingAttachmentInputStreamFunctions() throws Exception {
+        InputStream inStream = new FileInputStream(getTestResourceFile(inMimeFileName));
+        Attachments attachments = new Attachments(inStream, contentTypeString);
+
+        // Get the inputstream container
+        IncomingAttachmentStreams ias = attachments.getIncomingAttachmentStreams();
+        
+        IncomingAttachmentInputStream dataIs;
+
+        // Img1 stream
+        dataIs = ias.getNextStream();
+        
+        // Make sure it was the first attachment
+        assertEquals("<1.urn:uuid:A3ADBAEE51A1A87B2A11443668160943@apache.org>", dataIs.getContentId());
+        
+        // Consume the stream
+        while (dataIs.read() != -1);
+        
+        // Img2 stream
+        dataIs = ias.getNextStream();
+        assertEquals("<2.urn:uuid:A3ADBAEE51A1A87B2A11443668160994@apache.org>", dataIs.getContentId());
+
+        // Test if getContentType() works..
+        assertEquals("image/jpeg", dataIs.getContentType());
+
+        // Test if a adding/getting a header works
+        dataIs.addHeader("new-header", "test-value");
+        assertEquals("test-value", dataIs.getHeader("new-header"));
+	}
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/PartOnFileTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/PartOnFileTest.java
new file mode 100644
index 0000000..91c34e4
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/attachments/PartOnFileTest.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.attachments;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Enumeration;
+
+import javax.activation.DataHandler;
+import javax.activation.FileDataSource;
+import javax.mail.Header;
+
+import org.apache.axiom.om.AbstractTestCase;
+
+
+/**
+ * Test the PartOnFile class
+ */
+
+public class PartOnFileTest extends AbstractTestCase {
+	
+	public PartOnFileTest(String testName) {
+        super(testName);
+    }
+
+    String inMimeFileName = "mtom/MTOMAttachmentStream.bin";
+    String contentTypeString = "multipart/related; boundary=\"MIMEBoundaryurn:uuid:A3ADBAEE51A1A87B2A11443668160701\"; type=\"application/xop+xml\"; start=\"<0.urn:uuid:A3ADBAEE51A1A87B2A11443668160702@apache.org>\"; start-info=\"application/soap+xml\"; charset=UTF-8;action=\"mtomSample\"";
+
+    File temp;
+
+    public void setUp() throws Exception {
+		createTemporaryDirectory();
+    }
+    
+    public void tearDown() throws Exception {
+		deleteTemporaryDirectory();
+    }
+
+	public void testHeaderGetSet() throws Exception {
+
+        InputStream inStream = new FileInputStream(getTestResourceFile(inMimeFileName));
+		Attachments attachments = new Attachments(inStream, contentTypeString, true, temp.getPath(), "1");
+
+		DataHandler p = attachments.getDataHandler("1.urn:uuid:A3ADBAEE51A1A87B2A11443668160943@apache.org");
+		
+		if (!(p.getDataSource() instanceof FileDataSource)) {
+			fail("Expected PartOnFile");
+		}
+
+//		assertEquals("<1.urn:uuid:A3ADBAEE51A1A87B2A11443668160943@apache.org>", p.getContentID());
+		assertEquals("image/jpeg", p.getContentType());
+
+//		p.addHeader("Some-New-Header", "TestNH");
+//		assertEquals(p.getHeader("Some-New-Header"), "TestNH");
+	}
+
+	public void testGetAllheaders() throws Exception {
+
+//        InputStream inStream = new FileInputStream(getTestResourceFile(inMimeFileName));
+//		Attachments attachments = new Attachments(inStream, contentTypeString, true, temp.getPath(), "1");
+//
+//		Part p = attachments.getDataHandler("1.urn:uuid:A3ADBAEE51A1A87B2A11443668160943@apache.org");
+//		
+//		if (!(p instanceof PartOnFile)) {
+//			fail("Expected PartOnFile");
+//		}
+//		
+//		assertEquals("<1.urn:uuid:A3ADBAEE51A1A87B2A11443668160943@apache.org>", p.getContentID());
+//
+//		// Check if the enumeration works
+//		p.addHeader("Some-New-Header", "TestNH");
+//		
+//		Enumeration e = p.getAllHeaders();
+//		boolean cTypeFound = false;
+//		boolean cTransferEncFound = false;
+//		boolean cIdFound = false;
+//		boolean snhFound = false;
+//
+//		while (e.hasMoreElements()) {
+//			Header h = (Header) e.nextElement();
+//			if (h.getName().toLowerCase().equals("content-type")) {
+//				cTypeFound = true;
+//			}
+//			
+//			if (h.getName().toLowerCase().equals("content-transfer-encoding")) {
+//				cTransferEncFound = true;
+//			}
+//			
+//			if (h.getName().toLowerCase().equals("content-id")) {
+//				cIdFound = true;
+//			}
+//			
+//			if (h.getName().toLowerCase().equals("some-new-header")) {
+//				snhFound = true;
+//			}
+//		}
+//		
+//		if (!cTypeFound || !cTransferEncFound || !cIdFound || !snhFound) {
+//			fail("Header enumeration failed");
+//		}
+
+	}
+
+	private void createTemporaryDirectory() throws Exception {
+		temp = File.createTempFile("partOnFileTest", ".tmp");
+
+		if (!temp.delete()) {
+			fail("Cannot delete from temporary directory. File: " + temp.toURL());
+		}
+		
+		if (!temp.mkdir()) {
+			fail("Cannot create a temporary location for part files");
+		}
+	}
+
+	private void deleteTemporaryDirectory() throws Exception {
+
+		String[] fileList = temp.list();
+		for (int i=0; i < fileList.length; i++) {
+            if (!(new File(temp, fileList[i])).delete()) {
+            	System.err.println("WARNING: temporary directory removal failed.");
+            }
+        }
+
+		if (!temp.delete()) {
+			System.err.println("WARNING: temporary directory removal failed.");
+		}
+	}
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AbstractOMSerializationTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AbstractOMSerializationTest.java
new file mode 100644
index 0000000..f234905
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AbstractOMSerializationTest.java
@@ -0,0 +1,178 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import org.apache.axiom.om.impl.builder.StAXOMBuilder;

+import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+import org.custommonkey.xmlunit.Diff;

+import org.custommonkey.xmlunit.XMLTestCase;

+import org.w3c.dom.Document;

+import org.xml.sax.InputSource;

+import org.xml.sax.SAXException;

+

+import javax.xml.parsers.DocumentBuilder;

+import javax.xml.parsers.DocumentBuilderFactory;

+import javax.xml.parsers.ParserConfigurationException;

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLStreamException;

+import javax.xml.transform.Result;

+import javax.xml.transform.Source;

+import javax.xml.transform.Transformer;

+import javax.xml.transform.TransformerConfigurationException;

+import javax.xml.transform.TransformerException;

+import javax.xml.transform.TransformerFactory;

+import javax.xml.transform.dom.DOMSource;

+import javax.xml.transform.stream.StreamResult;

+import java.io.ByteArrayInputStream;

+import java.io.ByteArrayOutputStream;

+import java.io.File;

+import java.io.FileInputStream;

+import java.io.IOException;

+import java.io.InputStream;

+import java.io.InputStreamReader;

+

+public class AbstractOMSerializationTest extends XMLTestCase {

+

+    protected boolean ignoreXMLDeclaration = true;

+    protected boolean ignoreDocument = false;

+    protected Log log = LogFactory.getLog(getClass());

+

+

+    /**

+     * @param xmlString - remember this is not the file path. this is the xml string

+     */

+    public Diff getDiffForComparison(String xmlString) throws Exception {

+        return getDiffForComparison(new ByteArrayInputStream(xmlString.getBytes()));

+    }

+

+    public Diff getDiffForComparison(File xmlFile) throws Exception {

+        return getDiffForComparison(new FileInputStream(xmlFile));

+    }

+

+    public String getSerializedOM(String xmlString) throws Exception {

+        try {

+            XMLInputFactory factory = XMLInputFactory.newInstance();

+

+            ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(xmlString.getBytes());

+            StAXOMBuilder staxOMBuilder = OMXMLBuilderFactory.

+                    createStAXOMBuilder(OMAbstractFactory.getOMFactory(),

+                            factory.createXMLStreamReader(byteArrayInputStream));

+            staxOMBuilder.setDoDebug(true);

+            OMElement rootElement = staxOMBuilder.getDocumentElement();

+

+            ByteArrayOutputStream baos = new ByteArrayOutputStream();

+

+            OMOutputFormat format = new OMOutputFormat();

+            format.setIgnoreXMLDeclaration(ignoreXMLDeclaration);

+

+            ((OMDocument) rootElement.getParent()).serialize(baos, format);

+

+            return new String(baos.toByteArray());

+        } catch (Exception e) {

+            throw e;

+        }

+    }

+

+    public Diff getDiffForComparison(InputStream inStream) throws Exception {

+

+        try {

+            XMLInputFactory factory = XMLInputFactory.newInstance();

+

+            StAXOMBuilder staxOMBuilder = OMXMLBuilderFactory.

+                    createStAXOMBuilder(OMAbstractFactory.getOMFactory(),

+                            factory.createXMLStreamReader(inStream));

+            staxOMBuilder.setDoDebug(true);

+            OMElement rootElement = staxOMBuilder.getDocumentElement();

+

+            ByteArrayOutputStream baos = new ByteArrayOutputStream();

+

+            if (ignoreDocument) {

+                rootElement.serialize(baos);

+            } else {

+                ((OMDocument) rootElement.getParent()).serialize(baos);

+            }

+

+            InputSource resultXML = new InputSource(new InputStreamReader(

+                    new ByteArrayInputStream(baos.toByteArray())));

+

+            Document dom2 = newDocument(resultXML);

+            Document dom1 = newDocument(inStream);

+

+            return compareXML(dom1, dom2);

+        } catch (XMLStreamException e) {

+            fail(e.getMessage());

+            throw new Exception(e);

+        } catch (ParserConfigurationException e) {

+            fail(e.getMessage());

+            throw new Exception(e);

+        } catch (SAXException e) {

+            fail(e.getMessage());

+            throw new Exception(e);

+        } catch (IOException e) {

+            fail(e.getMessage());

+            throw new Exception(e);

+        }

+    }

+

+    public Document newDocument(InputSource in)

+            throws ParserConfigurationException, SAXException, IOException {

+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

+        dbf.setNamespaceAware(true);

+        DocumentBuilder db = dbf.newDocumentBuilder();

+        return db.parse(in);

+    }

+

+    public Document newDocument(InputStream in)

+            throws ParserConfigurationException, SAXException, IOException {

+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

+        dbf.setNamespaceAware(true);

+        DocumentBuilder db = dbf.newDocumentBuilder();

+        return db.parse(in);

+    }

+

+    public Document newDocument(String xml)

+            throws ParserConfigurationException, SAXException, IOException {

+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

+        dbf.setNamespaceAware(true);

+        DocumentBuilder db = dbf.newDocumentBuilder();

+        return db.parse(new ByteArrayInputStream(xml.getBytes()));

+    }

+

+    public String writeXmlFile(Document doc) {

+        try {

+            // Prepare the DOM document for writing

+            Source source = new DOMSource(doc);

+

+            ByteArrayOutputStream baos = new ByteArrayOutputStream();

+            Result result = new StreamResult(baos);

+

+            // Write the DOM document to the file

+            Transformer xformer = TransformerFactory.newInstance().newTransformer();

+            xformer.transform(source, result);

+            return new String(baos.toByteArray());

+        } catch (TransformerConfigurationException e) {

+            log.error(e.getMessage(), e);

+        } catch (TransformerException e) {

+            log.error(e.getMessage(), e);

+        }

+        return null;

+

+    }

+

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AbstractTestCase.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AbstractTestCase.java
new file mode 100644
index 0000000..b617e4b
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AbstractTestCase.java
@@ -0,0 +1,71 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import junit.framework.TestCase;

+

+import java.io.File;

+

+/**

+ * Abstract base class for test cases.

+ */

+public abstract class AbstractTestCase

+        extends TestCase {

+    protected String testDir = "test" + File.separator;

+    protected String sampleDir = "samples" + File.separator;

+    protected String outDir = "target" + File.separator + "generated" +

+            File.separator +

+            "samples" +

+            File.separator;

+    protected String tempDir = "target" + File.separator + "generated" +

+            File.separator +

+            "temp";

+    protected String testResourceDir = "test-resources";

+

+    /**

+     * Basedir for all file I/O. Important when running tests from

+     * the reactor.

+     */

+    public String basedir = System.getProperty("basedir");

+

+    /**

+     * @param testName

+     */

+    public AbstractTestCase(String testName) {

+        super(testName);

+        if (basedir == null) {

+            basedir = new File(".").getAbsolutePath();

+        }

+        testDir = new File(basedir, testDir).getAbsolutePath();

+        sampleDir = new File(basedir, sampleDir).getAbsolutePath();

+        outDir = new File(basedir, outDir).getAbsolutePath();

+        tempDir = new File(basedir, tempDir).getAbsolutePath();

+    }

+

+    public File getTestResourceFile(String relativePath) {

+        return new File(testResourceDir, relativePath);

+    }

+

+    public File getTempOutputFile(String filename) {

+        File f = new File(tempDir);

+        if(!f.exists()) {

+            f.mkdirs();

+        }

+        return new File(f, filename);

+    }

+}

+

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AttrNsTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AttrNsTest.java
new file mode 100644
index 0000000..8ed1123
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/AttrNsTest.java
@@ -0,0 +1,128 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import org.apache.axiom.om.impl.builder.StAXOMBuilder;

+import org.custommonkey.xmlunit.Diff;

+import org.w3c.dom.Document;

+import org.xml.sax.SAXException;

+

+import javax.xml.namespace.QName;

+import javax.xml.parsers.ParserConfigurationException;

+import java.io.ByteArrayInputStream;

+import java.io.IOException;

+import java.util.Iterator;

+

+public class AttrNsTest extends AbstractOMSerializationTest {

+

+    private String attrNamespaceTestXML = "<?xml version='1.0' encoding='UTF-8'?>\n" +

+            "<foo xmlns:e=\"http://opensource.lk\">" +

+            "    <bar1 b:attr=\"test attr value1\" xmlns:b=\"http://opensource.lk/ns1\">test1</bar1>" +

+            "    <bar2 b:attr=\"test attr value2\" xmlns:b=\"http://opensource.lk/ns1\">test2</bar2>" +

+            "</foo>";

+

+    public void testAttributeNamespaces() throws Exception {

+        ignoreXMLDeclaration = true;

+        ignoreDocument = true;

+

+        Document document1 = newDocument(attrNamespaceTestXML);

+        String serializedOM = getSerializedOM(attrNamespaceTestXML);

+        Document document2 = newDocument(serializedOM);

+

+        Diff diff = compareXML(document1, document2);

+        assertXMLEqual(diff, true);

+    }

+

+

+    /**

+     * Test method to test the XML namespace

+     *

+     * @throws Exception

+     */

+    public void testAttr() throws Exception {

+        String xml = "<wsp:Policy xml:base=\"uri:thisBase\" " +

+                "xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\">" +

+                "</wsp:Policy>";

+

+        ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());

+        StAXOMBuilder builder = new StAXOMBuilder(bais);

+        OMElement elem = builder.getDocumentElement();

+        elem.build();

+        assertEquals("Attribute value mismatch", "uri:thisBase", elem.getAttributeValue(new QName(OMConstants.XMLNS_URI, "base")));

+

+        OMAttribute attr = elem.getAttribute(new QName(OMConstants.XMLNS_URI, "base"));

+

+        assertEquals("Attribute namespace mismatch", OMConstants.XMLNS_URI, attr.getNamespace().getNamespaceURI());

+    }

+

+    /**

+     * Test method to test the XML namespace of an attr without

+     * any other ns declarations in the element

+     *

+     * @throws Exception

+     */

+    public void testAttrWithoutElementNS() throws Exception {

+        String xml = "<Policy xml:base=\"uri:thisBase\"></Policy>";

+

+        ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());

+        StAXOMBuilder builder = new StAXOMBuilder(bais);

+        OMElement elem = builder.getDocumentElement();

+        elem.build();

+        assertEquals("Attribute value mismatch", "uri:thisBase", elem.getAttributeValue(new QName(OMConstants.XMLNS_URI, "base")));

+

+        OMAttribute attr = elem.getAttribute(new QName(OMConstants.XMLNS_URI, "base"));

+

+        assertEquals("Attribute namespace mismatch", OMConstants.XMLNS_URI, attr.getNamespace().getNamespaceURI());

+    }

+

+    public void testAttributesWithProgrammaticalCreation() {

+

+        try {

+            String expectedXML = "<AttributeTester xmlns=\"\" xmlns:myAttr2NS=\"http://test-attributes-2.org\" " +

+                    "xmlns:myAttr1NS=\"http://test-attributes-1.org\" myAttr2NS:attrNumber=\"2\" myAttr1NS:attrNumber=\"1\" />";

+

+            OMFactory omFactory = OMAbstractFactory.getOMFactory();

+

+            OMNamespace attrNS1 = omFactory.createOMNamespace("http://test-attributes-1.org", "myAttr1NS");

+            OMNamespace attrNS2 = omFactory.createOMNamespace("http://test-attributes-2.org", "myAttr2NS");

+            OMElement omElement = omFactory.createOMElement("AttributeTester", null);

+            omElement.addAttribute(omFactory.createOMAttribute("attrNumber", attrNS1, "1"));

+            omElement.addAttribute(omFactory.createOMAttribute("attrNumber", attrNS2, "2"));

+

+            int nsCount = 0;

+            for (Iterator iterator = omElement.getAllDeclaredNamespaces(); iterator.hasNext();) {

+                iterator.next();

+                nsCount++;

+            }

+            assertTrue(nsCount == 2);

+

+            Document document1 = newDocument(expectedXML);

+            Document document2 = newDocument(omElement.toString());

+

+            Diff diff = compareXML(document1, document2);

+            assertXMLEqual(diff, true);

+        } catch (ParserConfigurationException e) {

+            fail(e.getMessage());

+        } catch (SAXException e) {

+            fail(e.getMessage());

+        } catch (IOException e) {

+            fail(e.getMessage());

+        }

+

+

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/BadInputTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/BadInputTest.java
new file mode 100644
index 0000000..89798cb
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/BadInputTest.java
@@ -0,0 +1,136 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import org.apache.axiom.soap.SOAPEnvelope;

+

+public class BadInputTest extends OMTestCase {

+

+    public BadInputTest(String testName) {

+        super(testName);

+    }

+

+

+    //done

+    public void testEnvelopeMissing() throws Exception {

+        try {

+            SOAPEnvelope soapEnvelope =

+                    (SOAPEnvelope) OMTestUtils.getOMBuilder(

+                            getTestResourceFile(TestConstants.BAD_ENVELOPE_MISSING))

+                    .getDocumentElement();

+            OMTestUtils.walkThrough(soapEnvelope);

+            fail("this must failed gracefully with OMException or AxisFault");

+        } catch (OMException e) {

+            return;

+        }

+

+    }

+

+    //done

+    public void testHeaderBodyWrongOrder() throws Exception {

+        try {

+            SOAPEnvelope soapEnvelope =

+                    (SOAPEnvelope) OMTestUtils.getOMBuilder(

+                            getTestResourceFile(TestConstants.BAD_HEADER_BODY_WRONG_ORDER))

+                    .getDocumentElement();

+            soapEnvelope.build();

+            fail("this must failed gracefully with OMException or AxisFault");

+        } catch (OMException e) {

+            return;

+        }

+    }

+

+    //done

+    //    public void testNotnamespaceQualified() throws Exception {

+    //        try {

+    //            SOAPEnvelope soapEnvelope =

+    //                    (SOAPEnvelope) OMTestUtils.getOMBuilder(new File(dir, "notnamespaceQualified.xml")).getDocumentElement();

+    //            OMTestUtils.walkThrough(soapEnvelope);

+    //            fail("this must failed gracefully with OMException or AxisFault");

+    //        } catch (OMException e) {

+    //            return;

+    //        } catch (AxisFault e) {

+    //            return;

+    //        }

+    //

+    //    }

+    //done

+    //    public void testBodyNotQualified() throws Exception {

+    //        try {

+    //            SOAPEnvelope soapEnvelope =

+    //                    (SOAPEnvelope) OMTestUtils.getOMBuilder(new File(dir, "bodyNotQualified.xml")).getDocumentElement();

+    //            OMTestUtils.walkThrough(soapEnvelope);

+    //            fail("this must failed gracefully with OMException or AxisFault");

+    //        } catch (OMException e) {

+    //            //we are OK!

+    //            return;

+    //        } catch (AxisFault e) {

+    //            //we are OK here too!

+    //            return;

+    //        }

+    //

+    //    }

+

+    //done

+    public void testTwoBodymessage() throws Exception {

+        try {

+            SOAPEnvelope soapEnvelope =

+                    (SOAPEnvelope) OMTestUtils.getOMBuilder(

+                            getTestResourceFile(TestConstants.BAD_TWO_BODY))

+                    .getDocumentElement();

+            soapEnvelope.build();

+            fail("this must failed gracefully with OMException or AxisFault");

+        } catch (OMException e) {

+            return;

+        }

+

+    }

+

+    //done

+    public void testTwoheaders() throws Exception {

+        try {

+            SOAPEnvelope soapEnvelope =

+                    (SOAPEnvelope) OMTestUtils.getOMBuilder(

+                            getTestResourceFile(TestConstants.BAD_TWO_HEADERS))

+                    .getDocumentElement();

+            soapEnvelope.build();

+            fail("this must failed gracefully with OMException or AxisFault");

+        } catch (OMException e) {

+            return;

+        }

+

+    }

+

+    //done

+    public void testWrongSoapNs() throws Exception {

+        try {

+            SOAPEnvelope soapEnvelope =

+                    (SOAPEnvelope) OMTestUtils.getOMBuilder(

+                            getTestResourceFile(TestConstants.BAD_WRONG_SOAP_NS))

+                    .getDocumentElement();

+            OMTestUtils.walkThrough(soapEnvelope);

+            fail("this must failed gracefully with OMException or AxisFault");

+        } catch (OMException e) {

+            return;

+        }

+

+    }

+

+

+

+

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/CompareOMWithDOMTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/CompareOMWithDOMTest.java
new file mode 100644
index 0000000..c8c9edd
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/CompareOMWithDOMTest.java
@@ -0,0 +1,57 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import org.apache.axiom.soap.SOAPEnvelope;

+import org.w3c.dom.Document;

+

+import javax.xml.parsers.DocumentBuilder;

+import javax.xml.parsers.DocumentBuilderFactory;

+import java.io.File;

+

+/**

+ * @version $Rev: $ $Date: $

+ */

+public class CompareOMWithDOMTest extends AbstractTestCase {

+    /**

+     * @param testName

+     */

+    public CompareOMWithDOMTest(String testName) {

+        super(testName);

+    }

+

+    public void testAllMessagesInSOAP() throws OMException, Exception {

+        File dir = new File(testResourceDir, "soap");

+        File[] files = dir.listFiles();

+        if (files != null) {

+            for (int i = 0; i < files.length; i++) {

+                if (files[i].isFile() && files[i].getName().endsWith(".xml") && !files[i].getName().startsWith("wrong")) {

+                    SOAPEnvelope soapEnvelope = (SOAPEnvelope) OMTestUtils.getOMBuilder(

+                            files[i])

+                            .getDocumentElement();

+                    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

+                    dbf.setNamespaceAware(true);

+                    DocumentBuilder builder = dbf.newDocumentBuilder();

+                    Document doc = builder.parse(files[i].getAbsolutePath());

+                    OMTestUtils.compare(doc.getDocumentElement(),

+                            soapEnvelope);

+                }

+            }

+

+        }

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/DefaultNSHandlingTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/DefaultNSHandlingTest.java
new file mode 100644
index 0000000..8c0dc93
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/DefaultNSHandlingTest.java
@@ -0,0 +1,147 @@
+package org.apache.axiom.om;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.*;
+import java.io.ByteArrayInputStream;
+import java.util.Iterator;
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class DefaultNSHandlingTest extends TestCase {
+
+    public void testDefaultNamespaceWithSameDefaultNSForAll() {
+        String testXML = "<html xmlns='http://www.w3.org/TR/REC-html40'>" +
+                "<head><title>Frobnostication</title></head>" +
+                   "<body><p>Moved to <a href='http://frob.com'>here</a>.</p></body>" +
+                "</html>";
+        try {
+            StAXOMBuilder stAXOMBuilder = new StAXOMBuilder(new ByteArrayInputStream(testXML.getBytes()));
+            OMElement documentElement = stAXOMBuilder.getDocumentElement();
+
+            checkNS(documentElement);
+
+            checkNSWithChildren(documentElement);
+
+        } catch (XMLStreamException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+    }
+
+    private void checkNSWithChildren(OMElement documentElement) {
+        Iterator childElementsIter = documentElement.getChildElements();
+        while (childElementsIter.hasNext()) {
+            OMElement omElement = (OMElement) childElementsIter.next();
+            checkNS(omElement);
+            checkNSWithChildren(omElement);
+        }
+    }
+
+    private void checkNS(OMElement element) {
+        assertTrue("http://www.w3.org/TR/REC-html40".equals(element.getNamespace().getNamespaceURI()));
+    }
+
+    public void testMultipleDefaultNS() {
+        OMFactory omFactory = OMAbstractFactory.getOMFactory();
+        OMNamespace defaultNS1 = omFactory.createOMNamespace("http://defaultNS1.org", null);
+        OMNamespace defaultNS2 = omFactory.createOMNamespace("http://defaultNS2.org", null);
+
+        OMElement omElementOne = omFactory.createOMElement("DocumentElement", null);
+        omElementOne.declareDefaultNamespace("http://defaultNS1.org");
+        OMElement omElementOneChild = omFactory.createOMElement("ChildOne", null, omElementOne);
+
+
+        OMElement omElementTwo = omFactory.createOMElement("Foo", defaultNS2, omElementOne);
+        omElementTwo.declareDefaultNamespace("http://defaultNS2.org");
+        OMElement omElementTwoChild = omFactory.createOMElement("ChildOne", null, omElementTwo);
+
+        OMElement omElementThree = omFactory.createOMElement("Bar", defaultNS1, omElementTwo);
+        omElementThree.declareDefaultNamespace("http://defaultNS1.org");
+
+        assertTrue("".equals(omElementOneChild.getNamespace().getNamespaceURI()));
+        assertTrue("".equals(omElementTwoChild.getNamespace().getNamespaceURI()));
+    }
+    
+    public void testChildReDeclaringParentsDefaultNSWithPrefix() {
+        try {
+            OMFactory fac = OMAbstractFactory.getOMFactory();
+            OMElement elem = fac.createOMElement("RequestSecurityToken", null);
+            elem.declareDefaultNamespace("http://schemas.xmlsoap.org/ws/2005/02/trust");
+            fac.createOMElement(new QName("TokenType"), elem).setText("test");
+            fac.createOMElement(new QName("RequestType"), elem).setText("test1");
+
+            fac.createOMElement(new QName("http://schemas.xmlsoap.org/ws/2005/02/trust","Entropy", "wst"), elem);
+            String xml = elem.toString();
+
+            XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(xml.getBytes()));
+
+            StAXOMBuilder builder = new StAXOMBuilder(reader);
+            builder.getDocumentElement().build();
+
+            // The StAX implementation may or may not have a trailing blank in the tag
+            String assertText1 = "<wst:Entropy xmlns:wst=\"http://schemas.xmlsoap.org/ws/2005/02/trust\" />";
+            String assertText2 = "<wst:Entropy xmlns:wst=\"http://schemas.xmlsoap.org/ws/2005/02/trust\"/>";
+            String assertText3 = "<wst:Entropy xmlns:wst=\"http://schemas.xmlsoap.org/ws/2005/02/trust\"></wst:Entropy>";
+            
+            assertTrue((xml.indexOf(assertText1) != -1) ||
+            		   (xml.indexOf(assertText2) != -1) ||
+            		   (xml.indexOf(assertText3) != -1));
+        }catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+   
+    public void testChildReDeclaringGrandParentsDefaultNSWithPrefix() {
+        try {
+            OMFactory fac = OMAbstractFactory.getOMFactory();
+            OMElement elem = fac.createOMElement("RequestSecurityToken", null);
+            elem.declareDefaultNamespace("http://schemas.xmlsoap.org/ws/2005/02/trust");
+            fac.createOMElement(new QName("TokenType"), elem).setText("test");
+            fac.createOMElement(new QName("RequestType"), elem).setText("test1");
+
+            OMElement entElem = fac.createOMElement(new QName("http://schemas.xmlsoap.org/ws/2005/02/trust","Entropy", "wst"), elem);
+            OMElement binSecElem = fac.createOMElement(new QName("http://schemas.xmlsoap.org/ws/2005/02/trust","Binarysecret", "wst"), entElem);
+            binSecElem.setText("secret value");
+            String xml = elem.toString();
+            assertTrue("Binarysecret element should have \'wst\' ns prefix", xml.indexOf("<wst:Binarysecret") != -1);
+        }catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+    
+    public static void main(String[] args) {
+        try {
+            XMLStreamWriter xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
+
+            xmlStreamWriter.writeStartElement("Foo");
+            xmlStreamWriter.writeDefaultNamespace("test.org");
+            xmlStreamWriter.setDefaultNamespace("test.org");
+            xmlStreamWriter.writeStartElement("Bar");
+
+            xmlStreamWriter.writeEndElement();
+            xmlStreamWriter.writeEndElement();
+
+            xmlStreamWriter.flush();
+
+
+        } catch (XMLStreamException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+    }
+}
+
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/IteratorTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/IteratorTest.java
new file mode 100644
index 0000000..70befd2
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/IteratorTest.java
@@ -0,0 +1,273 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import java.io.File;

+import java.io.FileReader;

+import java.util.Iterator;

+

+import javax.activation.DataHandler;

+import javax.activation.FileDataSource;

+import javax.xml.namespace.QName;

+import javax.xml.stream.XMLInputFactory;

+

+import org.apache.axiom.om.impl.builder.StAXOMBuilder;

+import org.apache.axiom.om.impl.llom.factory.OMLinkedListImplFactory;

+

+public class IteratorTest extends AbstractTestCase {

+    private OMElement envelope = null;

+

+    public IteratorTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        //lets use a plain OM factory

+        envelope =

+                new StAXOMBuilder(new OMLinkedListImplFactory(),

+                        XMLInputFactory.newInstance().createXMLStreamReader(

+                                new FileReader(

+                                        getTestResourceFile(

+                                                "soap/soapmessage1.xml")))).getDocumentElement();

+    }

+

+    protected void tearDown() throws Exception {

+        envelope = null;

+    }

+

+    /**

+     * Test the plain iterator which includes all the

+     * children (including the texts)

+     */

+    public void testIterator() {

+        OMElement elt = envelope;

+        Iterator iter = elt.getChildren();

+        int counter = 0;

+        while (iter.hasNext()) {

+            counter ++;

+            assertNotNull("Must return not null objects!", iter.next());

+        }

+        assertEquals("This element should contain only five children including the text ", 5, counter);

+    }

+

+    /**

+     * Test the element iterator

+     */

+    public void testElementIterator() {

+        OMElement elt = envelope;

+        Iterator iter = elt.getChildElements();

+        int counter = 0;

+        while (iter.hasNext()) {

+            counter ++;

+            Object o = iter.next();

+            assertNotNull("Must return not null objects!", o);

+            assertTrue("All these should be elements!", ((OMNode) o).getType() == OMNode.ELEMENT_NODE);

+        }

+        assertEquals("This element should contain only two elements ", 2, counter);

+    }

+

+    /**

+     * Test the element iterator

+     */

+    public void testElementQNameIterator() {

+        OMElement elt = envelope;

+        QName qname = new QName("http://schemas.xmlsoap.org/soap/envelope/", "body");

+        Iterator iter = elt.getChildrenWithName(qname);

+        int counter = 0;

+        while (iter.hasNext()) {

+            counter ++;

+            Object o = iter.next();

+            assertNotNull("Must return not null objects!", o);

+            assertTrue("All these should be elements!", ((OMNode) o).getType() == OMNode.ELEMENT_NODE);

+        }

+        assertEquals("This element should contain only one element with the given QName ", 1, counter);

+    }

+

+    /**

+     * test the remove exception behavior

+     */

+    public void testIteratorRemove1() {

+        OMElement elt = envelope;

+        Iterator iter = elt.getChildren();

+

+        //this is supposed to throw an illegal state exception

+        try {

+            iter.remove();

+            fail("remove should throw an exception");

+        } catch (IllegalStateException e) {

+            //ok. this is what should happen

+        }

+

+    }

+

+    /**

+     * test the remove exception behavior, consecutive remove calls

+     */

+    public void testIteratorRemove2() {

+        OMElement elt = envelope;

+        Iterator iter = elt.getChildren();

+        if (iter.hasNext()) {

+            iter.next();

+        }

+        iter.remove();

+

+        //this call must generate an exception

+        try {

+            iter.remove();

+            fail("calling remove twice without a call to next is prohibited");

+        } catch (IllegalStateException e) {

+            //ok if we come here :)

+        }

+

+    }

+

+    /**

+     * Remove all!

+     */

+    public void testIteratorRemove3() {

+        OMElement elt = envelope;

+        Iterator iter = elt.getChildren();

+        while (iter.hasNext()) {

+            iter.next();

+            iter.remove();

+        }

+        iter = elt.getChildren();

+        if (iter.hasNext()) {

+            //we shouldn't reach here!

+            fail("No children should remain after removing all!");

+        }

+

+

+    }

+

+    /**

+     * test whether the children count reduces.

+     */

+    public void testIteratorRemove4() {

+        OMElement elt = envelope;

+        Iterator iter = elt.getChildren();

+        int firstChildrenCount = 0;

+        int secondChildrenCount = 0;

+        while (iter.hasNext()) {

+            assertNotNull(iter.next());

+            firstChildrenCount++;

+        }

+

+        //remove the last node

+        iter.remove();

+

+        //reloop and check the count

+        //Note- here we should get a fresh iterator since there is no method to

+        //reset the iterator

+        iter = elt.getChildren(); //reset the iterator

+        while (iter.hasNext()) {

+            assertNotNull(iter.next());

+            secondChildrenCount++;

+        }

+        assertEquals("children count must reduce from 1",

+                firstChildrenCount - 1,

+                secondChildrenCount);

+

+    }

+

+    /**

+     * This will test the errrors mentioned in @link http://issues.apache.org/jira/browse/WSCOMMONS-12

+     */

+    public void testScenariosInJIRA() {

+        try {

+            OMElement mtomSampleElement = createSampleXMLForTesting();

+            testScenarioOne(mtomSampleElement);

+            testScenarioTwo(mtomSampleElement);

+

+

+        } catch (Exception e) {

+            fail("Exception occurred whilst running the test " + e);

+        }

+

+    }

+

+    private OMElement createSampleXMLForTesting() throws Exception {

+        try {

+            File imageSource = new File("test-resources/mtom/img/test.jpg");

+            OMFactory fac = OMAbstractFactory.getOMFactory();

+            OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");

+

+            OMElement data = fac.createOMElement("mtomSample", omNs);

+            OMElement image = fac.createOMElement("image", omNs);

+ 

+            FileDataSource dataSource = new FileDataSource(imageSource);

+            DataHandler expectedDH = new DataHandler(dataSource);

+            OMText textData = fac.createOMText(expectedDH, true);

+            image.addChild(textData);

+

+            OMElement imageName = fac.createOMElement("fileName", omNs);

+            if (imageSource != null) {

+                imageName.setText(imageSource.getAbsolutePath());

+            }

+            data.addChild(image);

+            data.addChild(imageName);

+

+            return data;

+        } catch (Exception e) {

+            e.printStackTrace(); 

+        }

+

+        return null;

+    }

+

+    private void testScenarioOne(OMElement mtomSampleElement) {

+        Iterator imageElementIter = mtomSampleElement.getChildrenWithName(new QName("image"));

+        // do something with the iterator

+        while (imageElementIter.hasNext()) {

+            OMNode omNode = (OMNode) imageElementIter.next();

+            // do nothing

+        }

+

+        Iterator fileNameElementIter = mtomSampleElement.getChildrenWithName(new QName("fileName"));

+        // do something with the iterator

+        while (fileNameElementIter.hasNext()) {

+            OMNode omNode = (OMNode) fileNameElementIter.next();

+            if (omNode instanceof OMElement) {

+                OMElement fileNameElement = (OMElement) omNode;

+                assertTrue("fileName".equalsIgnoreCase(fileNameElement.getLocalName()));

+            }

+        }

+    }

+

+    private void testScenarioTwo(OMElement mtomSampleElement) {

+        Iterator childElementsIter = mtomSampleElement.getChildElements();

+

+        boolean imageElementFound = false;

+        boolean fileNameElementFound = false;

+

+        while (childElementsIter.hasNext()) {

+            OMNode omNode = (OMNode) childElementsIter.next();

+            if (omNode instanceof OMElement) {

+                OMElement omElement = (OMElement) omNode;

+                if (omElement.getLocalName().equals("fileName")) {

+                    fileNameElementFound = true;

+                } else if (omElement.getLocalName().equals("image")) {

+                    imageElementFound = true;

+                }

+            }

+        }

+

+        assertTrue(fileNameElementFound && imageElementFound);

+    }

+

+

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/MIMEOutputUtilsTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/MIMEOutputUtilsTest.java
new file mode 100644
index 0000000..2de9459
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/MIMEOutputUtilsTest.java
@@ -0,0 +1,115 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import java.io.ByteArrayInputStream;

+import java.io.ByteArrayOutputStream;

+import java.io.IOException;

+import java.io.StringWriter;

+import java.util.HashMap;

+import java.util.Properties;

+

+import javax.activation.DataHandler;

+import javax.mail.MessagingException;

+import javax.mail.internet.MimeBodyPart;

+import javax.mail.internet.MimeMessage;

+import javax.mail.internet.MimeMultipart;

+

+import junit.framework.TestCase;

+

+import org.apache.axiom.attachments.ByteArrayDataSource;

+import org.apache.axiom.om.impl.MIMEOutputUtils;

+import org.apache.axiom.soap.SOAPFactory;

+

+public class MIMEOutputUtilsTest extends TestCase {

+    byte[] buffer;

+    byte[] byteArray = new byte[]{13, 56, 65, 32, 12, 12, 7, -3, -2, -1,

+                                  98};

+

+    protected void setUp() throws Exception {

+        super.setUp();

+        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();

+        ByteArrayOutputStream outStream;

+        String boundary;

+        

+        OMOutputFormat omOutput = new OMOutputFormat();

+        boundary = omOutput.getMimeBoundary();

+        omOutput.setSOAP11(false);

+

+        String contentType = omOutput.getContentType();

+        DataHandler dataHandler;

+        dataHandler = new DataHandler(new ByteArrayDataSource(byteArray));

+        OMText textData = factory.createOMText(dataHandler, true);

+        assertNotNull(textData.getContentID());

+

+        DataHandler dataHandler2 = new DataHandler(

+                "Apache Software Foundation", "text/plain");

+        OMText text = factory.createOMText(dataHandler2, true);

+        assertNotNull(text.getContentID());

+        outStream = new ByteArrayOutputStream();

+        outStream.write(("Content-Type: " + contentType).getBytes());

+        outStream.write(new byte[]{13,10});

+        outStream.write(new byte[]{13,10});

+

+        MIMEOutputUtils.startWritingMime(outStream, boundary);

+		MimeBodyPart part1 = MIMEOutputUtils.createMimeBodyPart(textData

+				.getContentID(), (DataHandler) textData.getDataHandler());

+		MIMEOutputUtils.writeBodyPart(outStream, part1, boundary);

+		MimeBodyPart part2 = MIMEOutputUtils.createMimeBodyPart(text

+				.getContentID(), (DataHandler) text.getDataHandler());

+		MIMEOutputUtils.writeBodyPart(outStream, part2, boundary);

+        MIMEOutputUtils.finishWritingMime(outStream);

+        buffer = outStream.toByteArray();

+    }

+

+    public void testMIMEWriting() throws IOException, MessagingException {

+        ByteArrayInputStream inStream = new ByteArrayInputStream(buffer);

+        Properties props = new Properties();

+        javax.mail.Session session = javax.mail.Session

+                .getInstance(props, null);

+        MimeMessage mimeMessage = new MimeMessage(session, inStream);

+        DataHandler dh = mimeMessage.getDataHandler();

+        MimeMultipart multiPart = new MimeMultipart(dh.getDataSource());

+        MimeBodyPart mimeBodyPart0 = (MimeBodyPart) multiPart.getBodyPart(0);

+        Object object0 = mimeBodyPart0.getContent();

+        assertNotNull(object0);

+        MimeBodyPart mimeBodyPart1 = (MimeBodyPart) multiPart.getBodyPart(1);

+        Object object1 = mimeBodyPart1.getContent();

+        assertNotNull(object1);

+        assertEquals(multiPart.getCount(),2);

+    }

+    

+    public void testWriteSOAPWithAttachmentsMessage() throws IOException

+    {

+//    	ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();

+// 

+//        OMOutputFormat omOutput = new OMOutputFormat();

+//        omOutput.setCharSetEncoding(OMConstants.DEFAULT_CHAR_SET_ENCODING);

+//        omOutput.setSOAP11(false);

+//        omOutput.setDoingSWA(true);

+//        

+//        StringWriter stringWriter = new StringWriter();

+//        stringWriter.write("Apache Axis2");

+//        DataHandler dataHandler = new DataHandler(

+//                "Apache Software Foundation", "text/plain");

+//        HashMap map = new HashMap();

+//        map.put("uuid_dsjkjkda",dataHandler);

+//        byteArrayOutputStream.write((omOutput.getContentType()+"\n").getBytes());

+//        MIMEOutputUtils.writeSOAPWithAttachmentsMessage(stringWriter,byteArrayOutputStream,map,omOutput);

+//        System.out.println(byteArrayOutputStream.toString());

+    }

+}
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/MessagesTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/MessagesTest.java
new file mode 100644
index 0000000..023b690
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/MessagesTest.java
@@ -0,0 +1,62 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import org.apache.axiom.soap.SOAPEnvelope;

+

+public class MessagesTest extends OMTestCase {

+    SOAPEnvelope soapEnvelope;

+

+    public MessagesTest(String testName) {

+        super(testName);

+    }

+

+    public void testMessageWithLotOfWhiteSpaces() throws OMException,

+            Exception {

+        soapEnvelope =

+                (SOAPEnvelope) OMTestUtils.getOMBuilder(

+                        getTestResourceFile(TestConstants.WHITESPACE_MESSAGE))

+                .getDocumentElement();

+        OMTestUtils.walkThrough(soapEnvelope);

+    }

+

+    public void testMinimalMessage() throws OMException, Exception {

+        soapEnvelope =

+                (SOAPEnvelope) OMTestUtils.getOMBuilder(

+                        getTestResourceFile(TestConstants.MINIMAL_MESSAGE))

+                .getDocumentElement();

+        OMTestUtils.walkThrough(soapEnvelope);

+    }

+

+    public void testReallyBigMessage() throws OMException, Exception {

+        soapEnvelope =

+                (SOAPEnvelope) OMTestUtils.getOMBuilder(

+                        getTestResourceFile(TestConstants.REALLY_BIG_MESSAGE))

+                .getDocumentElement();

+        OMTestUtils.walkThrough(soapEnvelope);

+    }

+

+    public void testEmptyBodiedMessage() throws OMException, Exception {

+        soapEnvelope =

+                (SOAPEnvelope) OMTestUtils.getOMBuilder(

+                        getTestResourceFile(TestConstants.EMPTY_BODY_MESSAGE))

+                .getDocumentElement();

+        OMTestUtils.walkThrough(soapEnvelope);

+    }

+

+

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/NamespaceTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/NamespaceTest.java
new file mode 100755
index 0000000..4b0f821
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/NamespaceTest.java
@@ -0,0 +1,291 @@
+package org.apache.axiom.om;
+
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.custommonkey.xmlunit.XMLTestCase;
+import org.xml.sax.SAXException;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.Iterator;
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class NamespaceTest extends XMLTestCase {
+
+    public void testNoPrefixNamespaces() throws IOException, ParserConfigurationException, SAXException {
+
+        String expectedXML = "<axis2:DocumentElement xmlns:axis2=\"http://ws.apache.org/axis2\" " +
+                "xmlns:axis2ns1=\"http://undefined-ns-1.org\" xmlns:axis2ns2=\"http://undefined-ns-2.org\">" +
+                "<axis2:FirstChild /><axis2ns2:SecondChild xmlns:axis2ns2=\"http://undefined-ns-2.org\" " +
+                "axis2ns1:testAttr=\"testValue\" /></axis2:DocumentElement>";
+
+        OMFactory omFactory = OMAbstractFactory.getOMFactory();
+        OMNamespace axis2NS = omFactory.createOMNamespace("http://ws.apache.org/axis2", "axis2");
+        OMElement docElement = omFactory.createOMElement("DocumentElement", axis2NS);
+
+        OMNamespace firstOrphanNS = docElement.declareNamespace("http://undefined-ns-1.org", null);
+        docElement.declareNamespace("http://undefined-ns-2.org", null);
+
+        omFactory.createOMElement("FirstChild", axis2NS, docElement);
+
+        OMElement secondChild = omFactory.createOMElement(new QName("http://undefined-ns-2.org", "SecondChild"), docElement);
+        secondChild.addAttribute("testAttr", "testValue", firstOrphanNS);
+
+
+        Iterator allDeclaredNamespaces = docElement.getAllDeclaredNamespaces();
+        int namespaceCount = 0;
+        while (allDeclaredNamespaces.hasNext()) {
+            OMNamespace omNamespace = (OMNamespace) allDeclaredNamespaces.next();
+            namespaceCount++;
+        }
+        assertTrue(namespaceCount == 3);
+
+        assertTrue(secondChild.getNamespace().getPrefix().equals(docElement.findNamespace("http://undefined-ns-2.org", null).getPrefix()));
+
+
+    }
+
+    public void attributeNSTest() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        OMNamespace ns1 = fac.createOMNamespace("http://test.org", "");
+        OMNamespace ns2 = fac.createOMNamespace("http://test2.org", null);
+
+
+        OMElement elem = fac.createOMElement("test", ns1);
+        elem.addAttribute(fac.createOMAttribute("testAttr", ns2, "attrValue"));
+
+        OMNamespace namespace = elem.findNamespace("http://test.org", null);
+        assertTrue(namespace != null && namespace.getPrefix() != null && "".equals(namespace.getPrefix()));
+
+        OMNamespace namespace2 = elem.findNamespace("http://test2.org", null);
+        assertTrue(namespace2 != null && namespace2.getPrefix() != null && "".equals(namespace2.getPrefix()));
+    }
+
+    /**
+     * Here a namespace will be defined with a certain prefix in the root element. But later the same ns
+     * is defined with the same uri in a child element, but this time with a different prefix.
+     */
+    public void testNamespaceProblem() throws XMLStreamException {
+
+        /**
+         * <RootElement xmlns:ns1="http://ws.apache.org/axis2">
+         *    <ns2:ChildElement xmlns:ns2="http://ws.apache.org/axis2"/>
+         * </RootElement>
+         *
+         */
+
+        OMFactory omFac = OMAbstractFactory.getOMFactory();
+
+        OMElement documentElement = omFac.createOMElement("RootElement", null);
+        documentElement.declareNamespace("http://ws.apache.org/axis2", "ns1");
+
+        OMNamespace ns = omFac.createOMNamespace("http://ws.apache.org/axis2", "ns2");
+        omFac.createOMElement("ChildElement", ns, documentElement);
+
+        assertTrue(documentElement.toStringWithConsume().indexOf("ns2:ChildElement") > -1);
+    }
+
+    public void testNamespaceProblem2() throws XMLStreamException {
+
+        /**
+         * <RootElement xmlns="http://one.org">
+         *   <ns2:ChildElementOne xmlns:ns2="http://ws.apache.org/axis2" xmlns="http://two.org">
+         *      <ChildElementTwo xmlns="http://one.org" />
+         *   </ns2:ChildElementOne>
+         * </RootElement>
+         */
+
+        OMFactory omFac = OMAbstractFactory.getOMFactory();
+
+        OMElement documentElement = omFac.createOMElement("RootElement", null);
+        documentElement.declareDefaultNamespace("http://one.org");
+
+        OMNamespace ns = omFac.createOMNamespace("http://ws.apache.org/axis2", "ns2");
+        OMElement childOne = omFac.createOMElement("ChildElementOne", ns, documentElement);
+        childOne.declareDefaultNamespace("http://two.org");
+
+        OMElement childTwo = omFac.createOMElement("ChildElementTwo", null, childOne);
+        childTwo.declareDefaultNamespace("http://one.org");
+
+
+        assertEquals(2, getNumberOfOccurrences(documentElement.toStringWithConsume(), "xmlns=\"http://one.org\""));
+    }
+
+    public void testNamespaceProblem3() throws XMLStreamException {
+
+        /**
+         * <RootElement xmlns:ns1="http://one.org" xmlns:ns2="http://one.org">
+         *   <ns2:ChildElementOne xmlns="http://one.org">
+         *      <ns2:ChildElementTwo />
+         *   </ns2:ChildElementOne>
+         * </RootElement>
+         */
+
+        OMFactory omFac = OMAbstractFactory.getOMFactory();
+
+        OMElement documentElement = omFac.createOMElement("RootElement", null);
+        OMNamespace ns1 = documentElement.declareNamespace("http://one.org", "ns1");
+        OMNamespace ns2 = documentElement.declareNamespace("http://one.org", "ns2");
+
+        OMElement childOne = omFac.createOMElement("ChildElementOne", ns2, documentElement);
+        childOne.declareDefaultNamespace("http://one.org");
+
+        OMElement childTwo = omFac.createOMElement("ChildElementTwo", ns1, childOne);
+
+        assertEquals(1, getNumberOfOccurrences(documentElement.toStringWithConsume(), "xmlns:ns2=\"http://one.org\""));
+    }
+
+
+    public void testNamespaceProblem4() throws Exception {
+        String xml = "<getCreditScoreResponse xmlns=\"http://www.example.org/creditscore/doclitwrapped/\"><score xmlns=\"\">750</score></getCreditScoreResponse>";
+        XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(xml.getBytes()));
+        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(OMAbstractFactory.getOMFactory(), parser);
+        OMElement root = builder.getDocumentElement();
+        String actualXML = root.toString();
+        assertTrue(actualXML.indexOf("xmlns=\"\"") != -1);
+    }
+
+    public void testNamespaceProblem5() {
+        String xml = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Header /><soapenv:Body><ns1:createAccountRequest xmlns:ns1=\"http://www.wso2.com/types\"><clientinfo xmlns=\"http://www.wso2.com/types\"><name>bob</name><ssn>123456789</ssn></clientinfo><password xmlns=\"\">passwd</password></ns1:createAccountRequest></soapenv:Body></soapenv:Envelope>";
+
+        try {
+            OMElement documentElement = new StAXOMBuilder(new ByteArrayInputStream(xml.getBytes())).getDocumentElement();
+            String actualXML = documentElement.toString();
+            assertXMLEqual(xml, actualXML);
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+
+    private int getNumberOfOccurrences(String xml, String pattern) {
+        int index = -1;
+        int count = 0;
+        while ((index = xml.indexOf(pattern, index + 1)) != -1) {
+            count ++;
+        }
+
+        return count;
+    }
+
+    public void testNamespaceProblem6() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        //TODO: Find the constants for "Parameter" and "name"
+        OMElement paramElement = fac.createOMElement("Parameter", null);
+        OMNamespace ns = paramElement.declareDefaultNamespace("");
+        paramElement.addAttribute(fac.createOMAttribute("name", null, "someName"));
+
+
+        for (int i = 0; i < 5; i++) {
+            // Create the action element
+            OMElement actionElem = fac.createOMElement(
+                    "Action", ns);
+
+            for (int j = 0; j < 5; j++) {
+                // Create an element with the name of the key
+                OMElement elem = fac.createOMElement("someKey" + j, ns);
+                // Set the text value of the element
+                elem.setText("someValue" + j);
+                // Add the element as a child of this action element
+                actionElem.addChild(elem);
+            }
+
+            paramElement.addChild(actionElem);
+        }
+
+    }
+
+    /**
+     * This is re-producing and testing the bug mentioned in
+     * http://issues.apache.org/jira/browse/WSCOMMONS-74
+     */
+    public void testNamespaceProblem7() {
+
+        String expectedString = "<person xmlns=\"http://ws.apache.org/axis2/apacheconasia/06\">" +
+                "<name>John</name>" +
+                "<age>34</age>" +
+                "<weight>50</weight>" +
+                "</person>";
+
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+
+        OMNamespace ns = fac.createOMNamespace("http://ws.apache.org/axis2/apacheconasia/06", "");
+        OMElement personElem = fac.createOMElement("person", ns);
+        OMElement nameElem = fac.createOMElement("name", ns);
+        nameElem.setText("John");
+
+        OMElement ageElem = fac.createOMElement("age", ns);
+        ageElem.setText("34");
+
+        OMElement weightElem = fac.createOMElement("weight", ns);
+        weightElem.setText("50");
+
+        //Add children to the person element
+        personElem.addChild(nameElem);
+        personElem.addChild(ageElem);
+        personElem.addChild(weightElem);
+
+        String result = personElem.toString();
+
+
+        try {
+            assertXMLEqual(expectedString, result);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    /**
+     * This is re-producing and testing the bug mentioned in
+     * http://issues.apache.org/jira/browse/WSCOMMONS-74
+     */
+    public void testNamespaceProblem8() {
+
+        String expectedXML = "<person xmlns=\"http://ws.apache.org/axis2/apacheconasia/06\"><name xmlns=\"\">John</name><age>34</age><weight>50</weight></person>";
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        OMNamespace ns = fac.createOMNamespace("http://ws.apache.org/axis2/apacheconasia/06", "");
+        OMElement personElem = fac.createOMElement("person", ns);
+
+        //Create and add an unqualified element
+        OMElement nameElem = fac.createOMElement("name", null);
+        nameElem.setText("John");
+        personElem.addChild(nameElem);
+
+        OMElement ageElem = fac.createOMElement("age", ns);
+        ageElem.setText("34");
+
+        OMElement weightElem = fac.createOMElement("weight", ns);
+        weightElem.setText("50");
+
+        personElem.addChild(ageElem);
+        personElem.addChild(weightElem);
+
+        try {
+            assertXMLEqual(expectedXML, personElem.toString());
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+
+    }
+
+
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMBlankElementTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMBlankElementTest.java
new file mode 100644
index 0000000..24deb21
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMBlankElementTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om;
+
+import junit.framework.TestCase;
+
+import javax.xml.stream.XMLStreamException;
+import java.io.StringWriter;
+
+
+public class OMBlankElementTest extends TestCase {
+
+
+	public OMBlankElementTest(String name) {
+		super(name);
+	}
+
+	public void testBlankOMElem() {
+		try {
+			//We should not get anything as the return value here: the output of the serialization
+			String value = buildBlankOMElem();
+			assertNull("There's a serialized output for a blank XML element that cannot exist", value);
+		} catch (Exception e) {
+			//An exception is thrown trying to serializeAndConsume a blank element
+			assertTrue(true);
+		}
+	}
+
+
+
+	String buildBlankOMElem() throws XMLStreamException {
+		OMFactory factory = OMAbstractFactory.getOMFactory();
+		OMNamespace namespace1 = factory.createOMNamespace("","");
+		OMElement elem1 = factory.createOMElement("",namespace1);
+
+		StringWriter writer = new StringWriter();
+		elem1.build();
+		elem1.serialize(writer);
+		writer.flush();
+		return writer.toString();
+	}
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMBodyTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMBodyTest.java
new file mode 100644
index 0000000..c583773
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMBodyTest.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om;
+
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class OMBodyTest extends OMTestCase implements OMConstants {
+    SOAPBody soapBody;
+    private Log log = LogFactory.getLog(getClass());
+
+    public OMBodyTest(String testName) {
+        super(testName);
+    }
+
+    /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+        soapBody = soapEnvelope.getBody();
+    }
+
+    /*
+     * Class under test for SOAPFault addFault()
+     */
+    public void testAddFault() {
+        log.debug("Adding SOAP fault to body ....");
+        try {
+            soapBody.addChild(
+                    soapFactory.createSOAPFault(soapBody,
+                            new Exception("Testing soap fault")));
+        } catch (SOAPProcessingException e) {
+            log.info(e.getMessage());
+            fail(e.getMessage());
+        }
+        log.debug("\t checking for SOAP Fault ...");
+        assertTrue("SOAP body has no SOAP fault", soapBody.hasFault());
+        log.debug("\t checking for not-nullity ...");
+        assertTrue("SOAP body has no SOAP fault", soapBody.getFault() != null);
+    }
+
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMCachingTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMCachingTest.java
new file mode 100644
index 0000000..9119dbc
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMCachingTest.java
@@ -0,0 +1,94 @@
+package org.apache.axiom.om;
+
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class OMCachingTest extends AbstractTestCase {
+    private XMLStreamReader xmlStreamReader;
+
+    /**
+     * @param testName
+     */
+    public OMCachingTest(String testName) {
+        super(testName);
+    }
+
+    protected void setUp() throws Exception {
+
+    }
+
+    /**
+     * This will first serialize the element without caching. Then it tries to serialize again
+     * .
+     */
+    public void testCachingOne() {
+
+        OMElement documentElement = null;
+        try {
+            // first build the OM tree without caching and see whether up can cosume it again
+            StAXOMBuilder builder = new StAXOMBuilder(getXMLStreamReader());
+            documentElement = builder.getDocumentElement();
+            String envelopeString = documentElement.toStringWithConsume();
+        } catch (XMLStreamException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+
+        try {
+            String envelopeString = documentElement.toStringWithConsume();
+            fail("Parser should fail as its already being accessed without caching");
+        } catch (XMLStreamException e) {
+            assertTrue(true);
+        }
+
+    }
+
+    /**
+     * This will first serialize the OMElement with caching and again will try to serialize.
+     */
+    public void testCachingTwo() {
+
+        OMElement documentElement = null;
+        try {
+            // first build the OM tree without caching and see whether up can cosume it again
+            StAXOMBuilder builder = new StAXOMBuilder(getXMLStreamReader());
+            documentElement = builder.getDocumentElement();
+            String envelopeString = documentElement.toString();
+            envelopeString = documentElement.toStringWithConsume();
+            assertTrue(true);
+        } catch (XMLStreamException e) {
+            fail("Parser should not failt as the element was serialized with caching");
+        } catch (FileNotFoundException e) {
+            fail("Parser should not failt as the element was serialized with caching");
+        }
+
+    }
+
+    private XMLStreamReader getXMLStreamReader() throws XMLStreamException, FileNotFoundException {
+        return XMLInputFactory.newInstance().
+                createXMLStreamReader(
+                        new FileReader(
+                                getTestResourceFile("soap/soapmessage.xml")));
+    }
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDTDTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDTDTest.java
new file mode 100644
index 0000000..8196abc
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDTDTest.java
@@ -0,0 +1,52 @@
+package org.apache.axiom.om;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+
+import javax.xml.stream.XMLStreamException;
+import java.io.ByteArrayOutputStream;
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class OMDTDTest extends TestCase {
+
+    private OMDocument document;
+
+    protected void setUp() throws Exception {
+        try {
+            StAXOMBuilder stAXOMBuilder = new StAXOMBuilder("test-resources/xml/dtd.xml");
+            stAXOMBuilder.setDoDebug(true);
+            document = this.document = stAXOMBuilder.getDocument();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void testDTDSerialization() {
+        try {
+
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            document.serialize(baos);
+            String serializedString = new String(baos.toByteArray());
+
+            assertTrue(serializedString.indexOf("<!ENTITY foo \"bar\">" ) > -1);
+            assertTrue(serializedString.indexOf("<!ENTITY bar \"foo\">" ) > -1);
+            assertTrue(serializedString.indexOf("<feed xmlns=\"http://www.w3.org/2005/Atom\">" ) > -1);
+        } catch (XMLStreamException e) {
+            fail("Bug in serializing OMDocuments which have DTDs, text and a document element");
+        }
+    }
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDocumentTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDocumentTest.java
new file mode 100644
index 0000000..1c1a659
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMDocumentTest.java
@@ -0,0 +1,95 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import junit.framework.TestCase;

+import org.apache.axiom.om.impl.builder.StAXOMBuilder;

+

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLStreamException;

+import javax.xml.stream.XMLStreamReader;

+import java.io.ByteArrayOutputStream;

+import java.io.StringReader;

+import java.util.Iterator;

+

+public class OMDocumentTest extends TestCase {

+    private String sampleXML = "<?xml version='1.0' encoding='utf-8'?>" +

+            "<!--This is some comments at the start of the document-->" +

+            "<?PITarget PIData?>" +

+            "<Axis2>" +

+            "    <ProjectName>The Apache Web Sevices Project</ProjectName>" +

+            "</Axis2>";

+

+    public void testOMDocument() throws XMLStreamException {

+        // read the string in to the builder

+        OMDocument omDocument = getSampleOMDocument(sampleXML);

+

+        // serialise it to a string

+        String outXML = "";

+        ByteArrayOutputStream outStream = new ByteArrayOutputStream();

+        omDocument.serializeAndConsume(outStream);

+        outXML = new String(outStream.toByteArray());

+

+        // again load that to another builder

+        OMDocument secondDocument = getSampleOMDocument(outXML);

+

+        // check for the comment and the PI

+        boolean commentFound = false;

+        boolean piFound = false;

+        Iterator children = secondDocument.getChildren();

+        while (children.hasNext()) {

+            OMNode omNode = (OMNode) children.next();

+            if (omNode instanceof OMComment) {

+                commentFound = true;

+            } else if (omNode instanceof OMProcessingInstruction) {

+                piFound = true;

+            } else if (omNode instanceof OMElement && !commentFound && !piFound) {

+               fail("OMElement should come after Comment and PI");

+

+            }

+        }

+        assertTrue(commentFound && piFound);

+

+

+    }

+

+    private OMDocument getSampleOMDocument(String xml) {

+        try {

+            XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xml));

+            StAXOMBuilder builder = new StAXOMBuilder(xmlStreamReader);

+            return builder.getDocument();

+        } catch (XMLStreamException e) {

+            throw new UnsupportedOperationException();

+        }

+    }

+

+//    private OMDocument getSampleOMDocument() {

+//        OMFactory omFactory = OMAbstractFactory.getOMFactory();

+//        OMDocument omDocument = omFactory.createOMDocument();

+//        omFactory.createOMComment(omDocument, "This is some comments at the start of the document");

+//        omDocument.setCharsetEncoding("utf-8");

+//        omFactory.createOMProcessingInstruction(omDocument, "PITarget", "PIData");

+//

+//        OMElement documentElement = omFactory.createOMElement("Axis2", null, omDocument);

+//        omDocument.setDocumentElement(documentElement);

+//        omFactory.createOMElement("ProjectName", null, documentElement);

+//        documentElement.getFirstElement().setText("The Apache Web Sevices Project");

+//

+//        return omDocument;

+//    }

+

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMElementCloneTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMElementCloneTest.java
new file mode 100644
index 0000000..98f72ff
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMElementCloneTest.java
@@ -0,0 +1,92 @@
+package org.apache.axiom.om;

+

+import org.apache.axiom.om.impl.builder.StAXOMBuilder;

+import org.apache.axiom.soap.SOAPBody;

+import org.apache.axiom.soap.SOAPEnvelope;

+import org.custommonkey.xmlunit.XMLTestCase;

+import org.w3c.dom.Document;

+import org.xml.sax.SAXException;

+

+import javax.xml.parsers.DocumentBuilder;

+import javax.xml.parsers.DocumentBuilderFactory;

+import javax.xml.parsers.ParserConfigurationException;

+import java.io.ByteArrayInputStream;

+import java.io.File;

+import java.io.IOException;

+

+/*

+ * Copyright 2001-2004 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ *

+ */

+

+public class OMElementCloneTest extends XMLTestCase {

+

+    File dir = new File(TestConstants.TEST_RESOURCES, TestConstants.SOAP_DIR);

+

+    public void testElementCloningWithoutUsingOMElementMethod() throws Exception {

+        SOAPEnvelope soapEnvelope =

+                (SOAPEnvelope) OMTestUtils.getOMBuilder(

+                        new File(dir, TestConstants.SOAPMESSAGE))

+                        .getDocumentElement();

+        SOAPBody body = soapEnvelope.getBody();

+

+        OMElement firstClonedBodyElement = new StAXOMBuilder(body.getXMLStreamReader()).getDocumentElement();

+        OMElement secondClonedBodyElement = new StAXOMBuilder(body.getXMLStreamReader()).getDocumentElement();

+

+        // first check whether both have the same information

+        String firstClonedBodyElementText = firstClonedBodyElement.toString();

+        String secondClonedBodyElementText = secondClonedBodyElement.toString();

+        String bodyText = body.toString();

+        assertXMLEqual(newDocument(bodyText), newDocument(firstClonedBodyElementText));

+        assertXMLEqual(newDocument(bodyText), newDocument(secondClonedBodyElementText));

+        assertXMLEqual(newDocument(firstClonedBodyElementText), newDocument(secondClonedBodyElementText));

+

+        // lets check some links. They must not be equal

+        assertNotSame(body.getParent(), firstClonedBodyElement.getParent());

+        assertNotSame(body.getParent(), secondClonedBodyElement.getParent());

+        assertNotSame(firstClonedBodyElement.getParent(), secondClonedBodyElement.getParent());

+

+    }

+

+    public void testElementCloningUsingOMElementMethod() throws Exception {

+        SOAPEnvelope soapEnvelope =

+                (SOAPEnvelope) OMTestUtils.getOMBuilder(

+                        new File(dir, TestConstants.SOAPMESSAGE))

+                        .getDocumentElement();

+        SOAPBody body = soapEnvelope.getBody();

+

+        OMElement firstClonedBodyElement = body.cloneOMElement();

+        OMElement secondClonedBodyElement = body.cloneOMElement();

+

+        // first check whether both have the same information

+        assertXMLEqual(newDocument(body.toString()), newDocument(firstClonedBodyElement.toString()));

+        assertXMLEqual(newDocument(body.toString()), newDocument(secondClonedBodyElement.toString()));

+        assertXMLEqual(newDocument(firstClonedBodyElement.toString()), newDocument(secondClonedBodyElement.toString()));

+

+        // lets check some links. They must not be equal

+        assertNotSame(body.getParent(), firstClonedBodyElement.getParent());

+        assertNotSame(body.getParent(), secondClonedBodyElement.getParent());

+        assertNotSame(firstClonedBodyElement.getParent(), secondClonedBodyElement.getParent());

+

+    }

+

+    public Document newDocument(String xml)

+            throws ParserConfigurationException, SAXException, IOException {

+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

+        dbf.setNamespaceAware(true);

+        DocumentBuilder db = dbf.newDocumentBuilder();

+        return db.parse(new ByteArrayInputStream(xml.getBytes()));

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMNavigatorTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMNavigatorTest.java
new file mode 100644
index 0000000..e8351b6
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMNavigatorTest.java
@@ -0,0 +1,103 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import org.apache.axiom.om.impl.llom.OMNavigator;

+import org.apache.axiom.soap.SOAPEnvelope;

+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;

+

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLOutputFactory;

+import javax.xml.stream.XMLStreamReader;

+import javax.xml.stream.XMLStreamWriter;

+import java.io.File;

+import java.io.FileOutputStream;

+import java.io.FileReader;

+

+public class OMNavigatorTest extends AbstractTestCase {

+    private SOAPEnvelope envelope = null;

+    private OMXMLParserWrapper builder;

+    private File tempFile;

+    private XMLStreamWriter output;

+

+    public OMNavigatorTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().

+                createXMLStreamReader(

+                        new FileReader(

+                                getTestResourceFile(TestConstants.SOAP_SOAPMESSAGE1)));

+        builder = new StAXSOAPModelBuilder(xmlStreamReader, null);

+        envelope = (SOAPEnvelope) builder.getDocumentElement();

+        tempFile = File.createTempFile("temp", "xml");

+        output =

+                XMLOutputFactory.newInstance().createXMLStreamWriter(

+                        new FileOutputStream(tempFile));

+    }

+

+    public void testnavigatorFullyBuilt() throws Exception {

+        assertNotNull(envelope);

+        //dump the out put to a  temporary file

+        envelope.serialize(output);

+

+        //now the OM is fully created -> test the navigation

+        OMNavigator navigator = new OMNavigator(envelope);

+        OMNode node = null;

+        while (navigator.isNavigable()) {

+            node = navigator.next();

+            assertNotNull(node);

+        }

+    }

+

+    public void testnavigatorHalfBuilt() {

+        assertNotNull(envelope);

+        //now the OM is not fully created. Try to navigate it

+        OMNavigator navigator = new OMNavigator(envelope);

+        OMNode node = null;

+        while (navigator.isNavigable()) {

+            node = navigator.next();

+            assertNotNull(node);

+        }

+    }

+

+    public void testnavigatorHalfBuiltStep() {

+        assertNotNull(envelope);

+

+        //now the OM is not fully created

+        OMNavigator navigator = new OMNavigator(envelope);

+        OMNode node = null;

+        while (!navigator.isCompleted()) {

+            if (navigator.isNavigable()) {

+                node = navigator.next();

+            } else {

+                builder.next();

+                navigator.step();

+                node = navigator.next();

+            }

+            assertNotNull(node);

+

+        }

+

+    }

+

+    protected void tearDown() throws Exception {

+        tempFile.delete();

+    }

+

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTest.java
new file mode 100644
index 0000000..2da086e
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTest.java
@@ -0,0 +1,142 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import org.apache.axiom.soap.SOAPEnvelope;

+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;

+

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLStreamReader;

+import java.io.File;

+import java.io.FileReader;

+import java.util.Iterator;

+

+/**

+ * This test case tests the basic expectations of the engine from the OM.

+ */

+public class OMTest extends AbstractTestCase {

+    private SOAPEnvelope envelope;

+

+    /**

+     * Constructor.

+     */

+    public OMTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        File file = getTestResourceFile(TestConstants.SAMPLE1);

+        XMLStreamReader parser = XMLInputFactory.newInstance()

+                .createXMLStreamReader(new FileReader(file));

+        OMXMLParserWrapper builder = new StAXSOAPModelBuilder(parser, null);

+        envelope = (SOAPEnvelope) builder.getDocumentElement();

+    }

+

+    /**

+     * Sometime the hasNext() in the childeren iterator is true yet the next() is null

+     */

+    public void testNullInChilderen() {

+        isNullChildrenThere(envelope);

+    }

+

+    /**

+     * the envelope is completly namesapce qulified so all the OMElements got to have namespace values not null

+     */

+    public void test4MissingNamespaces() {

+        isNameSpacesMissing(envelope);

+    }

+

+    public void isNullChildrenThere(OMElement omeleent) {

+        Iterator it = omeleent.getChildren();

+        while (it.hasNext()) {

+            OMNode node = (OMNode) it.next();

+            assertNotNull(node);

+            if (node.getType() == OMNode.ELEMENT_NODE) {

+                isNullChildrenThere((OMElement) node);

+            }

+        }

+    }

+

+    public void isNameSpacesMissing(OMElement omeleent) {

+        OMNamespace omns = omeleent.getNamespace();

+        assertNotNull(omns);

+        assertNotNull(omns.getNamespaceURI());

+        Iterator it = omeleent.getChildren();

+        while (it.hasNext()) {

+            OMNode node = (OMNode) it.next();

+            if (node != null && node.getType() == OMNode.ELEMENT_NODE) {

+                isNameSpacesMissing((OMElement) node);

+            }

+        }

+    }

+

+    public void testRootNotCompleteInPartialBuild() throws Exception {

+        assertFalse("Root should not be complete", envelope.isComplete());

+    }

+

+    /**

+     * Assumption - The fed XML has at least two children under the root element

+     *

+     * @throws Exception

+     */

+    public void testFirstChildDetach() throws Exception {

+        OMElement root = envelope;

+        assertFalse("Root should not be complete", root.isComplete());

+        OMNode oldFirstChild = root.getFirstOMChild();

+        assertNotNull(oldFirstChild);

+        oldFirstChild.detach();

+        OMNode newFirstChild = root.getFirstOMChild();

+        assertNotNull(newFirstChild);

+        assertNotSame(oldFirstChild, newFirstChild);

+    }

+

+    //todo this is wrong correct this

+    public void testAdditionOfaCompletelyNewElement() throws Exception {

+

+        //        OMElement root= envelope;

+        //

+        //        OMNamespace soapenv= root.findNamespace("http://schemas.xmlsoap.org/soap/envelope/", "soapenv");

+        //        OMNamespace wsa= root.findNamespace("http://schemas.xmlsoap.org/ws/2004/03/addressing", "wsa");

+        //        if (wsa==null)

+        //            wsa= root.declareNamespace("http://schemas.xmlsoap.org/ws/2004/03/addressing", "wsa");

+        //

+        //        //Assumption - A RelatesTo Element does not exist in the input document

+        //        OMElement relatesTo= fac.createOMElement ("RelatesTo", wsa);

+        //        relatesTo.addAttribute(fac.createOMAttribute("RelationshipType", null, "wsa:Reply", relatesTo));

+        //        relatesTo.addAttribute(fac.createOMAttribute("mustUnderstand", soapenv, "0", relatesTo));

+        //        relatesTo.addChild(fac.createOMText(relatesTo, "uuid:3821F4F0-D020-11D8-A10A-E4EE6425FCB0"));

+        //        relatesTo.setComplete(true);

+        //

+        //        root.addChild(relatesTo);

+        //

+        //        QName name = new QName(wsa.getName(),"RelatesTo",wsa.getPrefix());

+        //

+        //        Iterator children = root.getChildrenWithName(name);

+        //        //this should contain only one child!

+        //        if (children.hasNext()){

+        //            OMElement newlyAddedElement = (OMElement)children.next();

+        //

+        //            assertNotNull(newlyAddedElement);

+        //

+        //            assertEquals(newlyAddedElement.getLocalName(),"RelatesTo");

+        //            //todo put the other assert statements here

+        //        }else{

+        //            assertFalse("New child not added",true);

+        //        }

+

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTestCase.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTestCase.java
new file mode 100644
index 0000000..8e4d056
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTestCase.java
@@ -0,0 +1,73 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import org.apache.axiom.soap.SOAPEnvelope;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;

+

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLOutputFactory;

+import javax.xml.stream.XMLStreamException;

+import javax.xml.stream.XMLStreamReader;

+import javax.xml.stream.XMLStreamWriter;

+import java.io.FileReader;

+import java.io.InputStream;

+import java.io.OutputStream;

+

+public abstract class OMTestCase extends AbstractTestCase {

+    protected StAXSOAPModelBuilder builder;

+    protected OMFactory ombuilderFactory;

+    protected SOAPFactory soapFactory;

+

+    protected SOAPEnvelope soapEnvelope;

+

+    public OMTestCase(String testName) {

+        super(testName);

+        ombuilderFactory = OMAbstractFactory.getOMFactory();

+        soapFactory = OMAbstractFactory.getSOAP11Factory();

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+        soapEnvelope = (SOAPEnvelope) getOMBuilder("").getDocumentElement();

+    }

+

+    protected StAXSOAPModelBuilder getOMBuilder(String fileName) throws Exception {

+        if ("".equals(fileName) || fileName == null) {

+            fileName = TestConstants.SOAP_SOAPMESSAGE;

+        }

+        XMLStreamReader parser = XMLInputFactory.newInstance()

+                .createXMLStreamReader(

+                        new FileReader(getTestResourceFile(fileName)));

+        builder = new StAXSOAPModelBuilder(parser, null);

+        return builder;

+    }

+

+    protected StAXSOAPModelBuilder getOMBuilder(InputStream in) throws Exception {

+        XMLStreamReader parser = XMLInputFactory.newInstance()

+                .createXMLStreamReader(in);

+        builder = new StAXSOAPModelBuilder(parser, null);

+        return builder;

+    }

+

+    protected XMLStreamWriter getStAXStreamWriter(OutputStream out) throws XMLStreamException {

+        return XMLOutputFactory.newInstance().createXMLStreamWriter(out);

+    }

+

+

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTestUtils.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTestUtils.java
new file mode 100644
index 0000000..fccf0a0
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTestUtils.java
@@ -0,0 +1,116 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import junit.framework.TestCase;

+import org.apache.axiom.soap.SOAPEnvelope;

+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;

+import org.w3c.dom.*;

+

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLStreamReader;

+import java.io.File;

+import java.io.FileReader;

+import java.util.Iterator;

+

+public class OMTestUtils {

+    public static OMXMLParserWrapper getOMBuilder(File file) throws Exception {

+        XMLStreamReader parser = XMLInputFactory.newInstance()

+                .createXMLStreamReader(new FileReader(file));

+        return new StAXSOAPModelBuilder(parser, null);

+    }

+

+    public static void walkThrough(OMElement omEle) {

+        Iterator attibIt = omEle.getAllAttributes();

+        if (attibIt != null) {

+            while (attibIt.hasNext()) {

+                TestCase.assertNotNull("once the has next is not null, the " +

+                        "element should not be null",

+                        attibIt.next());

+            }

+        }

+        Iterator it = omEle.getChildren();

+        if (it != null) {

+            while (it.hasNext()) {

+                OMNode ele = (OMNode) it.next();

+                TestCase.assertNotNull("once the has next is not null, the " +

+                        "element should not be null", ele);

+                if (ele instanceof OMElement) {

+                    walkThrough((OMElement) ele);

+                }

+            }

+        }

+    }

+

+    public static void compare(Element ele, OMElement omele) throws Exception {

+        if (ele == null && omele == null) {

+            return;

+        } else if (ele != null && omele != null) {

+            TestCase.assertEquals("Element name not correct",

+                    ele.getLocalName(),

+                    omele.getLocalName());

+            if (omele.getNamespace() != null) {

+                TestCase.assertEquals("Namespace URI not correct",

+                        ele.getNamespaceURI(),

+                        omele.getNamespace().getNamespaceURI());

+

+            }

+

+            //go through the attributes

+            NamedNodeMap map = ele.getAttributes();

+            Iterator attIterator = omele.getAllAttributes();

+            OMAttribute omattribute;

+            while (attIterator != null && attIterator.hasNext() && map == null) {

+                omattribute = (OMAttribute) attIterator.next();

+                Node node = map.getNamedItemNS(

+                        omattribute.getNamespace().getNamespaceURI(),

+                        omattribute.getLocalName());

+                if (node.getNodeType() == Node.ATTRIBUTE_NODE) {

+                    Attr attr = (Attr) node;

+                    TestCase.assertEquals(attr.getValue(),

+                            omattribute.getAttributeValue());

+                } else {

+                    throw new OMException("return type is not a Attribute");

+                }

+

+            }

+            Iterator it = omele.getChildren();

+            NodeList list = ele.getChildNodes();

+            for (int i = 0; i < list.getLength(); i++) {

+                Node node = list.item(i);

+                if (node.getNodeType() == Node.ELEMENT_NODE) {

+                    TestCase.assertTrue(it.hasNext());

+                    OMNode tempOmNode = (OMNode) it.next();

+                    while (tempOmNode.getType() != OMNode.ELEMENT_NODE) {

+                        TestCase.assertTrue(it.hasNext());

+                        tempOmNode = (OMNode) it.next();

+                    }

+                    compare((Element) node, (OMElement) tempOmNode);

+                }

+            }

+

+

+        } else {

+            throw new Exception("One is null");

+        }

+    }

+

+    public static SOAPEnvelope createOM(File file) throws Exception {

+        return (SOAPEnvelope) getOMBuilder(file).getDocumentElement();

+    }

+

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTextTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTextTest.java
new file mode 100644
index 0000000..db506fb
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMTextTest.java
@@ -0,0 +1,65 @@
+package org.apache.axiom.om;
+
+import junit.framework.TestCase;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class OMTextTest extends TestCase {
+    private static final String AXIS2_NS_URI = "http://ws.apache.org/axis2";
+    private static final String AXIS2_NS_PREFIX = "axis2";
+    private static final String SOME_TEXT = "Some Text";
+
+    public void testTextQNames() {
+        OMFactory factory = OMAbstractFactory.getOMFactory();
+        OMElement omElement = factory.createOMElement("TestElement", null);
+        omElement.setText(new QName(AXIS2_NS_URI, SOME_TEXT, AXIS2_NS_PREFIX));
+
+        Iterator allDeclaredNamespaces = omElement.getAllDeclaredNamespaces();
+        boolean foundNamespace = false;
+        while (allDeclaredNamespaces.hasNext()) {
+            OMNamespace omNamespace = (OMNamespace) allDeclaredNamespaces.next();
+            if (AXIS2_NS_URI.equals(omNamespace.getNamespaceURI()) && AXIS2_NS_PREFIX.equals(omNamespace.getPrefix()))
+            {
+                foundNamespace = true;
+            }
+        }
+        assertTrue("Namespace of the text is not defined in the parent element", foundNamespace);
+
+        String elementString = omElement.toString();
+        assertTrue(elementString.indexOf(AXIS2_NS_PREFIX + ":" + SOME_TEXT) > -1);
+        assertTrue((AXIS2_NS_PREFIX + ":" + SOME_TEXT).equals(omElement.getText()));
+
+        QName textAsQName = omElement.getTextAsQName();
+        assertTrue(textAsQName.equals(new QName(AXIS2_NS_URI, SOME_TEXT, AXIS2_NS_PREFIX)));
+    }
+
+    public void testTextQNamesWithoutQNames() {
+        OMFactory factory = OMAbstractFactory.getOMFactory();
+        OMElement omElement = factory.createOMElement("TestElement", null);
+        omElement.setText(SOME_TEXT);
+
+        String elementString = omElement.toString();
+        assertTrue(elementString.indexOf(":" + SOME_TEXT) == -1);
+        assertTrue(!(":" + SOME_TEXT).equals(omElement.getText()));
+
+        QName textAsQName = omElement.getTextAsQName();
+        assertTrue(textAsQName.equals(new QName(SOME_TEXT)));
+    }
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMWrapperTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMWrapperTest.java
new file mode 100644
index 0000000..509e570
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMWrapperTest.java
@@ -0,0 +1,73 @@
+package org.apache.axiom.om;

+

+import junit.framework.TestCase;

+

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLStreamReader;

+import javax.xml.stream.XMLStreamException;

+import java.io.StringReader;

+

+import org.apache.axiom.om.impl.builder.StAXOMBuilder;

+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+public class OMWrapperTest extends TestCase {

+

+    public void testSingleElementWrapper(){

+        try {

+            String xml = "<root>" +

+                    "<wrap1>" +

+                    "<wrap3>" +

+                    "<wrap2>" +

+                    "IncludedText" +

+                    "</wrap2>" +

+                    "</wrap3>" +

+                    "</wrap1>" +

+                    "</root>";

+

+            XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xml));

+            StAXOMBuilder b = new StAXOMBuilder(xmlStreamReader);

+

+            OMElement documentElement = b.getDocumentElement();

+            OMElement wrap2Element =

+                    documentElement.getFirstElement().

+                            getFirstElement().

+                            getFirstElement();

+

+            OMElement elt = OMAbstractFactory.getOMFactory().createOMElement(

+                    "testName","urn:testNs","ns1"

+            );

+

+            elt.addChild(wrap2Element);

+

+

+            XMLStreamReader reader = wrap2Element.getXMLStreamReaderWithoutCaching();

+            int count = 0;

+            while(reader.hasNext()){

+               reader.next();

+               count ++;

+            }

+

+            assertEquals(3,count);

+        } catch (XMLStreamException e) {

+           fail(e.getMessage());

+        }

+

+

+    }

+

+

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/SerializationTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/SerializationTest.java
new file mode 100644
index 0000000..14dfd76
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/SerializationTest.java
@@ -0,0 +1,332 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+
+import javax.xml.stream.XMLStreamException;
+import java.io.ByteArrayInputStream;
+
+/**
+ * Each of the following tests have a parent "person" and children "name", "age", "weight".
+ * The parent is defined as either:
+ *   a) a qualified name (QParent)
+ *   b) an unqualified name (UParent)
+ *   c) a qualified name using the default namespace (DParent)
+ * 
+ * Likewise the children are defined as either:
+ *   a) qualified names (QChildren)
+ *   b) unqualified children (UChildren) 
+ *   c) qualified using the default namespace (DChildren)
+ * 
+ *
+ */
+public class SerializationTest extends TestCase {
+
+    private static final String NS = "http://ws.apache.org/axis2/apacheconasia/06";
+    private static final String PREFIX = "prefix";
+
+    public void testDParentDChildren() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+
+        OMNamespace nsParent = fac.createOMNamespace(NS, "");
+        OMNamespace nsChildren = fac.createOMNamespace(NS, "");
+
+        OMElement personElem = fac.createOMElement("person", nsParent);
+        OMElement nameElem = fac.createOMElement("name", nsChildren);
+        nameElem.setText("John");
+
+        OMElement ageElem = fac.createOMElement("age", nsChildren);
+        ageElem.setText("34");
+
+        OMElement weightElem = fac.createOMElement("weight", nsChildren);
+        weightElem.setText("50");
+
+        //Add children to the person element
+        personElem.addChild(nameElem);
+        personElem.addChild(ageElem);
+        personElem.addChild(weightElem);
+
+        String xml = personElem.toString();
+
+        assertEquals("Incorrect namespace serialization",2, xml.split("http://ws.apache.org/axis2/apacheconasia/06").length);
+    }
+
+    public void testDParentUChildren() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+
+        OMNamespace nsParent = fac.createOMNamespace(NS, "");
+        OMNamespace nsChildren = fac.createOMNamespace("", "");
+
+        OMElement personElem = fac.createOMElement("person", nsParent);
+        OMElement nameElem = fac.createOMElement("name", nsChildren);
+        nameElem.setText("John");
+
+        OMElement ageElem = fac.createOMElement("age", nsChildren);
+        ageElem.setText("34");
+
+        OMElement weightElem = fac.createOMElement("weight", nsChildren);
+        weightElem.setText("50");
+
+        //Add children to the person element
+        personElem.addChild(nameElem);
+        personElem.addChild(ageElem);
+        personElem.addChild(weightElem);
+
+        String xml = personElem.toString();
+
+        assertEquals("Incorrect namespace serialization",2, xml.split("http://ws.apache.org/axis2/apacheconasia/06").length);
+        assertEquals("Incorrect namespace serialization",4, xml.split("\"\"").length);
+    }
+
+    public void testDParentQChildren() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+
+        OMNamespace nsParent = fac.createOMNamespace(NS, "");
+        OMNamespace nsChildren = fac.createOMNamespace(NS, PREFIX);
+
+        OMElement personElem = fac.createOMElement("person", nsParent);
+        OMElement nameElem = fac.createOMElement("name", nsChildren);
+        nameElem.setText("John");
+
+        OMElement ageElem = fac.createOMElement("age", nsChildren);
+        ageElem.setText("34");
+
+        OMElement weightElem = fac.createOMElement("weight", nsChildren);
+        weightElem.setText("50");
+
+        //Add children to the person element
+        personElem.addChild(nameElem);
+        personElem.addChild(ageElem);
+        personElem.addChild(weightElem);
+
+        String xml = personElem.toString();
+
+        assertEquals("Incorrect namespace serialization",5, xml.split("http://ws.apache.org/axis2/apacheconasia/06").length);
+    }
+
+
+    public void testQParentQChildren() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+
+        OMNamespace nsParent = fac.createOMNamespace(NS, PREFIX);
+        OMNamespace nsChildren = fac.createOMNamespace(NS, PREFIX);
+
+        OMElement personElem = fac.createOMElement("person", nsParent);
+        OMElement nameElem = fac.createOMElement("name", nsChildren);
+        nameElem.setText("John");
+
+        OMElement ageElem = fac.createOMElement("age", nsChildren);
+        ageElem.setText("34");
+
+        OMElement weightElem = fac.createOMElement("weight", nsChildren);
+        weightElem.setText("50");
+
+        //Add children to the person element
+        personElem.addChild(nameElem);
+        personElem.addChild(ageElem);
+        personElem.addChild(weightElem);
+
+        String xml = personElem.toString();
+
+        assertEquals("Incorrect namespace serialization",2, xml.split("http://ws.apache.org/axis2/apacheconasia/06").length);
+    }
+
+    public void testQParentUChildren() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+
+        OMNamespace nsParent = fac.createOMNamespace(NS, PREFIX);
+        OMNamespace nsChildren = fac.createOMNamespace("", "");
+
+        OMElement personElem = fac.createOMElement("person", nsParent);
+        OMElement nameElem = fac.createOMElement("name", nsChildren);
+        nameElem.setText("John");
+
+        OMElement ageElem = fac.createOMElement("age", nsChildren);
+        ageElem.setText("34");
+
+        OMElement weightElem = fac.createOMElement("weight", nsChildren);
+        weightElem.setText("50");
+
+        //Add children to the person element
+        personElem.addChild(nameElem);
+        personElem.addChild(ageElem);
+        personElem.addChild(weightElem);
+
+        String xml = personElem.toString();
+
+        assertEquals("Incorrect default namespace serialization",2, xml.split("http://ws.apache.org/axis2/apacheconasia/06").length);
+        assertEquals("Incorrect namespace serialization",1, xml.split("\"\"").length);
+    }
+
+    public void testQParentDChildren() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+
+        OMNamespace nsParent = fac.createOMNamespace(NS, PREFIX);
+        OMNamespace nsChildren = fac.createOMNamespace(NS, "");
+
+        OMElement personElem = fac.createOMElement("person", nsParent);
+        OMElement nameElem = fac.createOMElement("name", nsChildren);
+        nameElem.setText("John");
+
+        OMElement ageElem = fac.createOMElement("age", nsChildren);
+        ageElem.setText("34");
+
+        OMElement weightElem = fac.createOMElement("weight", nsChildren);
+        weightElem.setText("50");
+
+        //Add children to the person element
+        personElem.addChild(nameElem);
+        personElem.addChild(ageElem);
+        personElem.addChild(weightElem);
+
+        String xml = personElem.toString();
+
+        assertEquals("Incorrect default namespace serialization",5, xml.split("http://ws.apache.org/axis2/apacheconasia/06").length);
+    }
+
+    public void testUParentUChildren() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+
+        OMNamespace nsParent = fac.createOMNamespace("", "");
+        OMNamespace nsChildren = fac.createOMNamespace("", "");
+
+        OMElement personElem = fac.createOMElement("person", nsParent);
+        OMElement nameElem = fac.createOMElement("name", nsChildren);
+        nameElem.setText("John");
+
+        OMElement ageElem = fac.createOMElement("age", nsChildren);
+        ageElem.setText("34");
+
+        OMElement weightElem = fac.createOMElement("weight", nsChildren);
+        weightElem.setText("50");
+
+        //Add children to the person element
+        personElem.addChild(nameElem);
+        personElem.addChild(ageElem);
+        personElem.addChild(weightElem);
+
+        String xml = personElem.toString();
+
+        assertEquals("Incorrect default namespace serialization",1, xml.split("http://ws.apache.org/axis2/apacheconasia/06").length);
+        assertEquals("Incorrect namespace serialization",1, xml.split("\"\"").length);
+    }
+
+    public void testUParentQChildren() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+
+        OMNamespace nsParent = fac.createOMNamespace("", "");
+        OMNamespace nsChildren = fac.createOMNamespace(NS, PREFIX);
+
+        OMElement personElem = fac.createOMElement("person", nsParent);
+        OMElement nameElem = fac.createOMElement("name", nsChildren);
+        nameElem.setText("John");
+
+        OMElement ageElem = fac.createOMElement("age", nsChildren);
+        ageElem.setText("34");
+
+        OMElement weightElem = fac.createOMElement("weight", nsChildren);
+        weightElem.setText("50");
+
+        //Add children to the person element
+        personElem.addChild(nameElem);
+        personElem.addChild(ageElem);
+        personElem.addChild(weightElem);
+
+        String xml = personElem.toString();
+
+        assertEquals("Incorrect default namespace serialization",4, xml.split("http://ws.apache.org/axis2/apacheconasia/06").length);
+        assertEquals("Incorrect namespace serialization",1, xml.split("\"\"").length);
+    }
+
+    public void testUParentDChildren() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+
+        OMNamespace nsParent = fac.createOMNamespace("", "");
+        OMNamespace nsChildren = fac.createOMNamespace(NS, PREFIX);
+
+        OMElement personElem = fac.createOMElement("person", nsParent);
+        OMElement nameElem = fac.createOMElement("name", nsChildren);
+        nameElem.setText("John");
+
+        OMElement ageElem = fac.createOMElement("age", nsChildren);
+        ageElem.setText("34");
+
+        OMElement weightElem = fac.createOMElement("weight", nsChildren);
+        weightElem.setText("50");
+
+        //Add children to the person element
+        personElem.addChild(nameElem);
+        personElem.addChild(ageElem);
+        personElem.addChild(weightElem);
+
+        String xml = personElem.toString();
+
+        assertEquals("Incorrect namespace serialization",4, xml.split("http://ws.apache.org/axis2/apacheconasia/06").length);
+        assertEquals("Incorrect namespace serialization",1, xml.split("\"\"").length);
+    }
+
+
+
+
+
+    /**
+     * Special case when OMElement is created with a null OMNamespace.
+     * In this case, that element must always belongs to the default, default namespace
+     */
+    public void testNullOMNamespace() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        OMNamespace ns = fac.createOMNamespace("http://ws.apache.org/axis2/apacheconasia/06", "");
+        OMElement personElem = fac.createOMElement("person", ns);
+
+        //Create and add using null namespace...this should pick up default namespace from parent
+        OMElement nameElem = fac.createOMElement("name", null);
+        nameElem.setText("John");
+        personElem.addChild(nameElem);
+
+        String xml = personElem.toString();
+
+        assertEquals("Incorrect namespace serialization",2, xml.split("http://ws.apache.org/axis2/apacheconasia/06").length);
+        assertEquals("Incorrect serialization", 2, xml.split("xmlns=\"\"").length);
+
+    }
+
+    public void testOMSerializationWithTwoNonBuiltOMElements(){
+        try {
+            String sampleXMLOne = "<ChildOne><Name>ChildName</Name></ChildOne>";
+            String sampleXMLTwo = "<ChildTwo><Name>ChildName</Name></ChildTwo>";
+
+            String expectedXML = "<Root><ChildOne><Name>ChildName</Name></ChildOne><ChildTwo><Name>ChildName</Name></ChildTwo></Root>";
+            OMFactory omFactory = OMAbstractFactory.getOMFactory();
+
+            OMElement rootElement = omFactory.createOMElement("Root", null);
+            OMElement childOne = new StAXOMBuilder(new ByteArrayInputStream(sampleXMLOne.getBytes())).getDocumentElement();
+            ((OMNodeEx) childOne).setParent(null);
+            rootElement.addChild(childOne);
+            OMElement childTwo = new StAXOMBuilder(new ByteArrayInputStream(sampleXMLTwo.getBytes())).getDocumentElement();
+            ((OMNodeEx) childTwo).setParent(null);
+            rootElement.addChild(childTwo);
+
+            assertTrue(expectedXML.equals(rootElement.toString()));
+        } catch (XMLStreamException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+    }
+
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/SpacesTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/SpacesTest.java
new file mode 100644
index 0000000..8a54a34
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/SpacesTest.java
@@ -0,0 +1,118 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import java.io.ByteArrayInputStream;

+import java.io.ByteArrayOutputStream;

+import java.io.FileInputStream;

+import java.io.IOException;

+import java.io.InputStream;

+import java.io.InputStreamReader;

+import java.util.Iterator;

+

+import javax.xml.parsers.DocumentBuilder;

+import javax.xml.parsers.DocumentBuilderFactory;

+import javax.xml.parsers.ParserConfigurationException;

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLStreamException;

+

+import org.apache.axiom.om.impl.builder.StAXOMBuilder;

+import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;

+import org.custommonkey.xmlunit.Diff;

+import org.custommonkey.xmlunit.XMLTestCase;

+import org.w3c.dom.Document;

+import org.xml.sax.InputSource;

+import org.xml.sax.SAXException;

+

+

+public class SpacesTest extends XMLTestCase {

+    private static final String filePath = "test-resources/xml/spaces.xml";

+    private static final String filePath2 = "test-resources/xml/spaces2.xml";

+

+

+    private OMElement rootElement;

+

+    public void testCData() throws Exception {

+        checkOMConformance(new FileInputStream(filePath));

+    }

+

+    private void checkOMConformance(InputStream iStream) throws Exception {

+        try {

+            XMLInputFactory factory = XMLInputFactory.newInstance();

+

+            StAXOMBuilder staxOMBuilder = OMXMLBuilderFactory.

+                    createStAXOMBuilder(OMAbstractFactory.getOMFactory(),

+                            factory.createXMLStreamReader(

+                                    iStream));

+            staxOMBuilder.setDoDebug(true);

+            rootElement = staxOMBuilder.getDocumentElement();

+            boolean hasCDataNode = hasCDataNode(rootElement);

+            String file = hasCDataNode ? filePath : filePath2;

+

+            ByteArrayOutputStream baos = new ByteArrayOutputStream();

+            ((OMDocument) rootElement.getParent()).serialize(baos);

+

+            InputSource resultXML = new InputSource(new InputStreamReader(

+                    new ByteArrayInputStream(baos.toByteArray())));

+

+            Document dom1 = newDocument(new InputSource(new FileInputStream(file)));

+            Document dom2 = newDocument(resultXML);

+            Diff diff = compareXML(dom1, dom2);

+            assertXMLEqual(diff, true);

+        } catch (XMLStreamException e) {

+            fail(e.getMessage());

+            throw new Exception(e);

+        } catch (ParserConfigurationException e) {

+            fail(e.getMessage());

+            throw new Exception(e);

+        } catch (SAXException e) {

+            fail(e.getMessage());

+            throw new Exception(e);

+        } catch (IOException e) {

+            fail(e.getMessage());

+            throw new Exception(e);

+        }

+    }

+

+    private boolean hasCDataNode(OMNode pNode) {

+    	switch (pNode.getType()) {

+    		case OMNode.CDATA_SECTION_NODE:

+    			return true;

+    		case OMNode.ELEMENT_NODE:

+    	    	OMElement e = (OMElement) pNode;

+    	    	for (Iterator iter = e.getChildren();  iter.hasNext();  ) {

+    	    		if (hasCDataNode((OMNode) iter.next())) {

+    	    			return true;

+    	    		}

+    	    	}

+    			break;

+    		default:

+    			break;

+    	}

+    	return false;

+    }

+

+    public Document newDocument(InputSource in)

+            throws ParserConfigurationException, SAXException, IOException {

+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

+        dbf.setNamespaceAware(true);

+        DocumentBuilder db = dbf.newDocumentBuilder();

+        return db.parse(in);

+    }

+

+

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/StaxParserTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/StaxParserTest.java
new file mode 100644
index 0000000..23f82bb
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/StaxParserTest.java
@@ -0,0 +1,221 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om;

+

+import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;

+

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLOutputFactory;

+import javax.xml.stream.XMLStreamException;

+import javax.xml.stream.XMLStreamReader;

+import javax.xml.stream.XMLStreamWriter;

+import java.io.ByteArrayInputStream;

+import java.util.Iterator;

+

+public class StaxParserTest extends AbstractTestCase {

+

+    XMLStreamReader parser1;

+    XMLStreamReader parser2;

+    XMLStreamReader parser3;

+    XMLStreamReader parser4;

+    String xmlDocument = "<purchase-order xmlns=\"http://openuri.org/easypo\">" +

+            "<customer>" +

+            "    <name>Gladys Kravitz</name>" +

+            "    <address>Anytown, PA</address>" +

+            "  </customer>" +

+            "  <date>2005-03-06T14:06:12.697+06:00</date>" +

+            "</purchase-order>";

+

+    public StaxParserTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        //make the parsers

+        //Parser 1 is a plain parser from the stax implementation

+        parser1 =

+                XMLInputFactory.newInstance().createXMLStreamReader(

+                        new ByteArrayInputStream(xmlDocument.getBytes()));

+

+        //parser 2 is one of our parsers taken with cache. i.e. when the parser

+        //proceeds the object model will be built

+        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(

+                OMAbstractFactory.getSOAP11Factory(),

+                XMLInputFactory.newInstance().createXMLStreamReader(

+                        new ByteArrayInputStream(xmlDocument.getBytes())));

+        parser2 = builder.getDocumentElement().getXMLStreamReader();

+

+        //same as parser2 but this time the parser is not a caching parser. Once the

+        //parser proceeds, it's gone forever.

+        OMXMLParserWrapper builder2 = OMXMLBuilderFactory.createStAXOMBuilder(

+                OMAbstractFactory.getSOAP11Factory(),

+                XMLInputFactory.newInstance().createXMLStreamReader(

+                        new ByteArrayInputStream(xmlDocument.getBytes())));

+        parser3 =

+                builder2.getDocumentElement().getXMLStreamReaderWithoutCaching();

+

+        //parser4 is another instance of our parser accessing the same stream as parser3.

+        // Note - The implementation returns a *new* instance but with reference to

+        //the same underlying stream!

+        parser4 = builder2.getDocumentElement().getXMLStreamReaderWithoutCaching();

+

+    }

+

+    public void testParserEventsWithCache() throws Exception {

+

+        //check the initial event

+        assertEquals(parser1.getEventType(), parser2.getEventType());

+

+        //check the other events

+        while (parser1.hasNext()) {

+

+            int parser1Event = parser1.next();

+            int parser2Event = parser2.next();

+            assertEquals(parser1Event, parser2Event);

+

+        }

+

+

+    }

+

+    public void testParserEventsWithoutCache() throws Exception {

+

+        assertEquals(parser1.getEventType(), parser3.getEventType());

+

+        while (parser1.hasNext()) {

+            int parser1Event = parser1.next();

+            int parser2Event = parser3.next();

+            assertEquals(parser1Event, parser2Event);

+        }

+

+

+    }

+

+    public void testParserEvents2WithCache() throws Exception {

+        while (parser1.hasNext()) {

+            int parser1Event = parser1.getEventType();

+            int parser2Event = parser2.getEventType();

+            parser1.next();

+            parser2.next();

+            assertEquals(parser1Event, parser2Event);

+        }

+

+

+    }

+

+

+    public void testParserBehaviornonCaching() throws Exception{

+

+        OMXMLParserWrapper builder2 = OMXMLBuilderFactory.createStAXOMBuilder(

+                OMAbstractFactory.getOMFactory(),

+                XMLInputFactory.newInstance().createXMLStreamReader(

+                        new ByteArrayInputStream(xmlDocument.getBytes())));

+

+        OMElement documentElement = builder2.getDocumentElement();

+        XMLStreamReader originalParser =

+                documentElement.getXMLStreamReaderWithoutCaching();

+

+        //consume the parser. this should force the xml stream to be exhausted without

+        //building the tree

+        while(originalParser.hasNext()){

+            originalParser.next();

+        }

+

+        //try to find the children of the document element. This should produce an

+        //error since the underlying stream is fully consumed without building the object tree

+        Iterator childElements = documentElement.getChildElements();

+        try {

+            while (childElements.hasNext()) {

+                childElements.next();

+                fail("The stream should've been consumed by now!");

+            }

+        } catch (Exception e) {

+            //if we are here without failing, then we are successful

+        }

+    }

+

+

+    public void testParserBehaviorCaching() throws Exception{

+

+        OMXMLParserWrapper builder2 = OMXMLBuilderFactory.createStAXOMBuilder(

+                OMAbstractFactory.getSOAP11Factory(),

+                XMLInputFactory.newInstance().createXMLStreamReader(

+                        new ByteArrayInputStream(xmlDocument.getBytes())));

+

+        OMElement documentElement = builder2.getDocumentElement();

+        XMLStreamReader originalParser =

+                documentElement.getXMLStreamReader();

+

+        //consume the parser. this should force the xml stream to be exhausted but the

+        //tree to be fully built

+        while(originalParser.hasNext()){

+            originalParser.next();

+        }

+

+        //try to find the children of the document element. This should *NOT* produce an

+        //error even when the underlying stream is fully consumed , the object tree is already complete

+        Iterator childElements = documentElement.getChildElements();

+        int count = 0;

+        try {

+            while (childElements.hasNext()) {

+                childElements.next();

+                count++;

+            }

+        } catch (Exception e) {

+            fail("The object tree needs to be built and traversing the children is to be a success!");

+        }

+

+        assertEquals("Number of elements need to be 2",count,2);

+    }

+

+

+    public void testParserBehaviorNonCaching2() throws Exception{

+

+        OMXMLParserWrapper builder2 = OMXMLBuilderFactory.createStAXOMBuilder(

+                OMAbstractFactory.getSOAP11Factory(),

+                XMLInputFactory.newInstance().createXMLStreamReader(

+                        new ByteArrayInputStream(xmlDocument.getBytes())));

+

+        OMElement documentElement = builder2.getDocumentElement();

+

+        XMLStreamReader originalParser =

+                documentElement.getXMLStreamReaderWithoutCaching();

+

+        //consume the parser. this should force the xml stream to be exhausted without

+        //building the tree

+        while(originalParser.hasNext()){

+            originalParser.next();

+        }

+

+        //try to find the children of the document element. This should produce an

+        //error since the underlying stream is fully consumed without building the object tree

+        Iterator childElements = documentElement.getChildElements();

+        try {

+            XMLStreamWriter writer =

+                    XMLOutputFactory.newInstance().

+                            createXMLStreamWriter(System.out);

+            documentElement.serializeAndConsume(writer);

+            fail("Stream should be consumed by now");

+        }catch(XMLStreamException e){

+           //wea re cool

+        } catch (Exception e) {

+           fail("This should throw an XMLStreamException");

+        }

+    }

+

+}

+

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/TestConstants.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/TestConstants.java
new file mode 100644
index 0000000..18f2745
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/TestConstants.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om;
+
+/**
+ * All the various files
+ * created 03-Nov-2005 12:02:12
+ */
+
+public class TestConstants {
+    public static final String TEST_RESOURCES = "test-resources";
+    public static final String SOAP_DIR = "soap";
+    public static final String SOAPMESSAGE = "soapmessage.xml";
+    public static final String SOAP_SOAPMESSAGE = "soap/soapmessage.xml";
+    public static final String SOAP_SOAPMESSAGE1 = "soap/soapmessage1.xml";
+    public static final String SAMPLE1 = "soap/sample1.xml";
+    public static final String WHITESPACE_MESSAGE = "soap/whitespacedMessage.xml";
+    public static final String MINIMAL_MESSAGE = "soap/minimalMessage.xml";
+    public static final String REALLY_BIG_MESSAGE = "soap/reallyReallyBigMessage.xml";
+    public static final String EMPTY_BODY_MESSAGE = "soap/emtyBodymessage.xml";
+    public static final String BAD_WRONG_SOAP_NS = "badsoap/wrongSoapNs.xml";
+    public static final String BAD_TWO_HEADERS = "badsoap/twoheaders.xml";
+    public static final String BAD_TWO_BODY = "badsoap/twoBodymessage.xml";
+    public static final String BAD_ENVELOPE_MISSING = "badsoap/envelopeMissing.xml";
+    public static final String BAD_HEADER_BODY_WRONG_ORDER = "badsoap/haederBodyWrongOrder.xml";
+
+    private TestConstants() {
+    }
+
+
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/factory/OMLinkedListImplFactoryTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/factory/OMLinkedListImplFactoryTest.java
new file mode 100644
index 0000000..ad08184
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/factory/OMLinkedListImplFactoryTest.java
@@ -0,0 +1,221 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.factory;

+

+import org.apache.axiom.om.*;

+import org.apache.axiom.soap.*;

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+

+/**

+ * User: Eran Chinthaka (eran.chinthaka@gmail.com)

+ * Date: Feb 8, 2005

+ * Time: 11:06:09 AM

+ */

+public class OMLinkedListImplFactoryTest extends AbstractTestCase {

+

+    private Log log = LogFactory.getLog(getClass());

+

+    public OMLinkedListImplFactoryTest(String testName) {

+        super(testName);

+    }

+

+    SOAPFactory omFactory;

+    OMNamespace namespace;

+    String nsUri = "http://www.apache.org/~chinthaka";

+    String nsPrefix = "myhome";

+

+    protected void setUp() throws Exception {

+        super.setUp();

+        omFactory = OMAbstractFactory.getSOAP11Factory();

+        namespace = omFactory.createOMNamespace(nsUri, nsPrefix);

+    }

+

+    public void testCreateOMElementWithNoBuilder() {

+        OMElement omElement = omFactory.createOMElement("chinthaka",

+                namespace);

+        assertTrue(

+                "Programatically created OMElement should have done = true ",

+                omElement.isComplete());

+

+    }

+

+    public void testCreateOMElement() {

+        try {

+            OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(

+                    getTestResourceFile("soap/whitespacedMessage.xml"));

+            OMElement documentElement = omBuilder.getDocumentElement();

+            OMElement child = omFactory.createOMElement("child",

+                    namespace,

+                    documentElement,

+                    omBuilder);

+            assertTrue(

+                    "OMElement with a builder should start with done = false ",

+                    !child.isComplete());

+            assertTrue("This OMElement must have a builder ",

+                    child.getBuilder() instanceof OMXMLParserWrapper);

+

+        } catch (Exception e) {

+            log.info(e.getMessage());

+        }

+    }

+

+    public void testCreateOMNamespace() {

+        assertTrue("OMNamespace uri not correct",

+                nsUri.equals(namespace.getNamespaceURI()));   // here equalsIgnoreCase should not be used as case does matter

+        assertTrue("OMNamespace prefix not correct",

+                nsPrefix.equals(namespace.getPrefix()));  // here equalsIgnoreCase should not be used as case does matter

+    }

+

+    public void testCreateText() {

+        OMElement omElement = omFactory.createOMElement("chinthaka",

+                namespace);

+        String text = "sampleText";

+        OMText omText = omFactory.createOMText(omElement, text);

+        assertTrue("Programatically created OMText should have done = true ",

+                omText.isComplete());

+        assertTrue(

+                "Programatically created OMText should have correct text value ",

+                text.equals(omText.getText()));

+

+    }

+

+    public void testCreateSOAPBody() {

+        try {

+            OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(

+                    getTestResourceFile("soap/minimalMessage.xml"));

+            SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();

+            SOAPBody soapBodyOne = omFactory.createSOAPBody(soapEnvelope);

+            assertTrue(

+                    "Programatically created SOAPBody should have done = true ",

+                    soapBodyOne.isComplete());

+            soapBodyOne.detach();

+            SOAPBody soapBodyTwo = omFactory.createSOAPBody(soapEnvelope,

+                    omBuilder);

+            assertTrue(

+                    "SOAPBody with a builder should start with done = false ",

+                    !soapBodyTwo.isComplete());

+            assertTrue("This SOAPBody must have a builder ",

+                    soapBodyTwo.getBuilder() instanceof OMXMLParserWrapper);

+

+

+        } catch (Exception e) {

+            log.info(e.getMessage());

+        }

+    }

+

+    public void testCreateSOAPEnvelope() {

+        try {

+            omFactory.createOMNamespace(

+                    SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,

+                    SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX);

+            SOAPEnvelope soapEnvelopeTwo = omFactory.createSOAPEnvelope();

+            assertTrue(

+                    "Programatically created SOAPEnvelope should have done = true ",

+                    soapEnvelopeTwo.isComplete());

+            SOAPEnvelope soapEnvelope = omFactory.createSOAPEnvelope(

+                    OMTestUtils.getOMBuilder(

+                            getTestResourceFile("soap/minimalMessage.xml")));

+            assertTrue(

+                    "SOAPEnvelope with a builder should start with done = false ",

+                    !soapEnvelope.isComplete());

+            assertTrue("This SOAPEnvelope must have a builder ",

+                    soapEnvelope.getBuilder() instanceof OMXMLParserWrapper);

+

+

+        } catch (Exception e) {

+            log.info(e.getMessage());

+        }

+    }

+

+    public void testCreateSOAPHeader() {

+        try {

+            OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(

+                    getTestResourceFile("soap/minimalMessage.xml"));

+            SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();

+            SOAPHeader soapHeader = omFactory.createSOAPHeader(soapEnvelope);

+            assertTrue(

+                    "Programatically created SOAPHeader should have done = true ",

+                    soapHeader.isComplete());

+            soapHeader.detach();

+            SOAPHeader soapHeaderTwo = omFactory.createSOAPHeader(soapEnvelope,

+                    omBuilder);

+            assertTrue(

+                    "SOAPHeader with a builder should start with done = false ",

+                    !soapHeaderTwo.isComplete());

+            assertTrue("This SOAPHeader must have a builder ",

+                    soapHeaderTwo.getBuilder() instanceof OMXMLParserWrapper);

+

+

+        } catch (Exception e) {

+            log.info(e.getMessage());

+        }

+    }

+

+    public void testCreateSOAPHeaderBlock() {

+        try {

+            OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(

+                    getTestResourceFile("soap/soapmessage.xml"));

+            SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();

+            SOAPHeader soapHeader = soapEnvelope.getHeader();

+            SOAPHeaderBlock soapHeaderBlock = omFactory.createSOAPHeaderBlock(

+                    "soapHeaderBlockOne", namespace, soapHeader);

+            assertTrue(

+                    "Programatically created SOAPHeaderBlock should have done = true ",

+                    soapHeaderBlock.isComplete());

+            SOAPHeaderBlock soapHeaderBlockTwo = omFactory.createSOAPHeaderBlock(

+                    "soapHeaderBlockOne", namespace, soapHeader, omBuilder);

+            assertTrue(

+                    "SOAPHeaderBlock with a builder should start with done = false ",

+                    !soapHeaderBlockTwo.isComplete());

+            assertTrue("This SOAPHeaderBlock must have a builder ",

+                    soapHeaderBlockTwo.getBuilder() instanceof OMXMLParserWrapper);

+

+

+        } catch (Exception e) {

+            log.info(e.getMessage());

+        }

+    }

+

+    public void testCreateSOAPFault() {

+        try {

+            OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(

+                    getTestResourceFile("soap/soapmessage.xml"));

+            SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();

+            SOAPBody soapBody = soapEnvelope.getBody();

+            SOAPFault soapFault = omFactory.createSOAPFault(soapBody,

+                    new Exception(" this is just a test "));

+            assertTrue(

+                    "Programatically created SOAPFault should have done = true ",

+                    soapFault.isComplete());

+            soapFault.detach();

+            SOAPFault soapFaultTwo = omFactory.createSOAPFault(soapBody,

+                    omBuilder);

+            assertTrue(

+                    "SOAPFault with a builder should start with done = false ",

+                    !soapFaultTwo.isComplete());

+            assertTrue("This SOAPFault must have a builder ",

+                    soapFaultTwo.getBuilder() instanceof OMXMLParserWrapper);

+

+

+        } catch (Exception e) {

+            log.info(e.getMessage());

+        }

+    }

+

+

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/OMBlankElementTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/OMBlankElementTest.java
new file mode 100644
index 0000000..31be444
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/OMBlankElementTest.java
@@ -0,0 +1,64 @@
+package org.apache.axiom.om.impl;

+

+import junit.framework.TestCase;

+import org.apache.axiom.om.OMAbstractFactory;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMException;

+import org.apache.axiom.om.OMFactory;

+import org.apache.axiom.om.OMNamespace;

+

+import javax.xml.stream.XMLStreamException;

+import java.io.StringWriter;

+

+public class OMBlankElementTest extends TestCase {

+

+    public OMBlankElementTest(String name) {

+        super(name);

+    }

+

+    public void testBlankOMElem() throws XMLStreamException {

+        try {

+            //We should not get anything as the return value here: the output of the serialization

+            String value = buildBlankOMElem();

+            assertNull(

+                "There's a serialized output for a blank XML element that cannot exist",

+                value);

+        } catch (OMException e) {

+        }

+    }

+

+    String buildBlankOMElem() throws XMLStreamException {

+        OMFactory factory = OMAbstractFactory.getOMFactory();

+        OMNamespace namespace1 = factory.createOMNamespace("", "");

+        OMElement elem1 = factory.createOMElement("", namespace1);

+

+        StringWriter writer = new StringWriter();

+        elem1.build();

+        elem1.serialize(writer);

+        writer.flush();

+        return writer.toString();

+    }

+

+    public void testOMElemWithWhiteSpace() throws XMLStreamException {

+        try {

+            //We should not get anything as the return value here: the output of the serialization

+            String value = buildWithWhiteSpaceOMElem();

+            assertNull(

+                "There's a serialized output for a blank XML element that cannot exist",

+                value);

+        } catch (OMException e) {

+        }

+    }

+

+    String buildWithWhiteSpaceOMElem() throws XMLStreamException {

+        OMFactory factory = OMAbstractFactory.getOMFactory();

+        OMNamespace namespace1 = factory.createOMNamespace("  ", "");

+        OMElement elem1 = factory.createOMElement("  ", namespace1);

+

+        StringWriter writer = new StringWriter();

+        elem1.build();

+        elem1.serialize(writer);

+        writer.flush();

+        return writer.toString();

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/builder/StAXOMBuilderTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/builder/StAXOMBuilderTest.java
new file mode 100644
index 0000000..4e0719d
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/builder/StAXOMBuilderTest.java
@@ -0,0 +1,70 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.builder;

+

+import org.apache.axiom.om.AbstractTestCase;

+import org.apache.axiom.om.OMAbstractFactory;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMNode;

+import org.apache.axiom.om.OMText;

+import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;

+

+import javax.xml.stream.XMLInputFactory;

+import java.io.FileReader;

+import java.util.Iterator;

+

+public class StAXOMBuilderTest extends AbstractTestCase {

+    StAXOMBuilder stAXOMBuilder;

+    FileReader testFile;

+    private OMElement rootElement;

+

+    /**

+     * Constructor.

+     */

+    public StAXOMBuilderTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        testFile = new FileReader(getTestResourceFile("non_soap.xml"));

+        stAXOMBuilder =

+                OMXMLBuilderFactory.createStAXOMBuilder(

+                        OMAbstractFactory.getSOAP11Factory(),

+                        XMLInputFactory.newInstance().createXMLStreamReader(

+                                testFile));

+    }

+

+    public void testGetRootElement() throws Exception {

+        rootElement = stAXOMBuilder.getDocumentElement();

+        assertTrue("Root element can not be null", rootElement != null);

+        assertTrue(" Name of the root element is wrong",

+                rootElement.getLocalName().equalsIgnoreCase("Root"));

+        // get the first OMElement child

+        OMNode omnode = rootElement.getFirstOMChild();

+        while (omnode instanceof OMText) {

+            omnode = omnode.getNextOMSibling();

+        }

+        Iterator children = ((OMElement) omnode).getChildren();

+        int childrenCount = 0;

+        while (children.hasNext()) {

+            OMNode node = (OMNode) children.next();

+            if (node instanceof OMElement)

+                childrenCount++;

+        }

+        assertTrue(childrenCount == 5);

+    }

+}
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/AbstractTestCase.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/AbstractTestCase.java
new file mode 100644
index 0000000..0c93b24
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/AbstractTestCase.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.dom;
+
+import junit.framework.TestCase;
+
+import java.io.File;
+
+/**
+ * Abstract base class for test cases.
+ */
+public abstract class AbstractTestCase
+        extends TestCase {
+    protected String testDir = "test" + File.separator;
+    protected String sampleDir = "samples" + File.separator;
+    protected String outDir = "target" + File.separator + "generated" +
+            File.separator +
+            "samples" +
+            File.separator;
+    protected String tempDir = "target" + File.separator + "generated" +
+            File.separator +
+            "temp";
+    protected String testResourceDir = "test-resources";
+
+    /**
+     * Basedir for all file I/O. Important when running tests from
+     * the reactor.
+     */
+    public String basedir = System.getProperty("basedir");
+
+    /**
+     * @param testName
+     */
+    public AbstractTestCase(String testName) {
+        super(testName);
+        if (basedir == null) {
+            basedir = new File(".").getAbsolutePath();
+        }
+        testDir = new File(basedir, testDir).getAbsolutePath();
+        sampleDir = new File(basedir, sampleDir).getAbsolutePath();
+        outDir = new File(basedir, outDir).getAbsolutePath();
+        tempDir = new File(basedir, tempDir).getAbsolutePath();
+    }
+
+    public File getTestResourceFile(String relativePath) {
+        return new File(testResourceDir, relativePath);
+    }
+
+    public File getTempOutputFile(String filename) {
+        File f = new File(tempDir);
+        if(!f.exists()) {
+            f.mkdirs();
+        }
+        return new File(f, filename);
+    }
+}
+
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ConvertLLOMToDOOMTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ConvertLLOMToDOOMTest.java
new file mode 100644
index 0000000..e28c685
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ConvertLLOMToDOOMTest.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import java.io.ByteArrayInputStream;
+
+import junit.framework.TestCase;
+
+/**
+ * This test will test the conversion of a LLOM soap envelope to
+ * DOOM 
+ */
+public class ConvertLLOMToDOOMTest extends TestCase {
+
+    public ConvertLLOMToDOOMTest(String arg0) {
+        super(arg0);
+    }
+
+    public void testConvert() {
+        try {
+            String origXML = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+            "   <soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">\n" +
+            "      <soapenv:Header>\n" +
+            "         <wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" soapenv:mustUnderstand=\"1\">\n" +
+            "            <ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\" Id=\"Signature-6426875\">\n" +
+            "               <ds:SignedInfo>\n" +
+            "                  <ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\" />\n" +
+            "                  <ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\" />\n" +
+            "                  <ds:Reference URI=\"#id-3083604\">\n" +
+            "                     <ds:Transforms>\n" +
+            "                        <ds:Transform Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\" />\n" +
+            "                     </ds:Transforms>\n" +
+            "                     <ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\n" +
+            "                     <ds:DigestValue>lDeZJk0/r6u4tOOhOKbN0IEvwi0=</ds:DigestValue>\n" +
+            "                  </ds:Reference>\n" +
+            "               </ds:SignedInfo>\n" +
+            "               <ds:SignatureValue>KhUeWMoUxUFe5jeTlqLdIEIG2Z7Q2q2mh9HT3IAYwbCev+FzXcuLSiPSsb7/+PSDM2SD0gl9tMp+dHjfPxmq7WiduH9mbnP6gkrxxu0T5rR916WsboshJGJKiPlj71bwpMsrrZohx4evHPdQ2SZHthlNb6jZyjq+LS7qFydppHk=</ds:SignatureValue>\n" +
+            "               <ds:KeyInfo Id=\"KeyId-2529687\">\n" +
+            "                  <wsse:SecurityTokenReference xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" wsu:Id=\"STRId-31966667\">\n" +
+            "                     <ds:X509Data>\n" +
+            "                        <ds:X509IssuerSerial>\n" +
+            "                           <ds:X509IssuerName>CN=OASIS Interop Test CA,O=OASIS</ds:X509IssuerName>\n" +
+            "                           <ds:X509SerialNumber>68652640310044618358965661752471103641</ds:X509SerialNumber>\n" +
+            "                        </ds:X509IssuerSerial>\n" +
+            "                     </ds:X509Data>\n" +
+            "                  </wsse:SecurityTokenReference>\n" +
+            "               </ds:KeyInfo>\n" +
+            "            </ds:Signature>\n" +
+            "            <wsu:Timestamp xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" wsu:Id=\"Timestamp-13986615\">\n" +
+            "               <wsu:Created>2006-03-31T15:34:38.699Z</wsu:Created>\n" +
+            "               <wsu:Expires>2006-03-31T15:39:38.699Z</wsu:Expires>\n" +
+            "            </wsu:Timestamp>\n" +
+            "         </wsse:Security>\n" +
+            "         <wsa:To xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">http://localhost:9080/axis2/services/Service</wsa:To>\n" +
+            "         <wsa:ReplyTo xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">\n" +
+            "            <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>\n" +
+            "         </wsa:ReplyTo>\n" +
+            "         <wsa:MessageID xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">urn:uuid:049875A6E153FCAAF011438192785862</wsa:MessageID>\n" +
+            "         <wsa:Action xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT</wsa:Action>\n" +
+            "      </soapenv:Header>\n" +
+            "      <soapenv:Body xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" wsu:Id=\"id-3083604\">\n" +
+            "         <RequestSecurityToken xmlns=\"http://schemas.xmlsoap.org/ws/2005/02/trust\" Context=\"http://get.optional.attrs.working\">\n" +
+            "            <TokenType>http://schemas.xmlsoap.org/ws/2005/02/sc/sct</TokenType>\n" +
+            "            <RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</RequestType>\n" +
+            "         </RequestSecurityToken>\n" +
+            "      </soapenv:Body>\n" +
+            "   </soapenv:Envelope>";
+
+            XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(origXML.getBytes()));
+            StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(reader, null);
+            
+            SOAPEnvelope env = builder.getSOAPEnvelope();
+            
+            env.build();
+            
+            StAXSOAPModelBuilder doomBuilder = new StAXSOAPModelBuilder(env.getXMLStreamReader(), DOOMAbstractFactory.getSOAP11Factory(), SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+            
+            SOAPEnvelope doomEnv = doomBuilder.getSOAPEnvelope();
+            
+            doomEnv.build();
+            
+            OMElement payload = doomEnv.getBody().getFirstElement();
+            
+            StAXOMBuilder llomBuilder = new StAXOMBuilder(payload.getXMLStreamReaderWithoutCaching());
+            
+            OMElement llomPayload = llomBuilder.getDocumentElement(); 
+            
+            llomPayload.build();
+            
+            String xml = llomPayload.toString();
+            
+            assertTrue("Conversion failed", xml.indexOf("</RequestSecurityToken>") != -1);
+            
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+    
+    public void testConvert1() {
+        try {
+            SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
+            SOAPEnvelope env = fac.getDefaultEnvelope();
+            fac.createOMElement(new QName("http://test.org", "Test"), env.getBody());
+            env.build();
+            
+            StAXSOAPModelBuilder doomBuilder = new StAXSOAPModelBuilder(env.getXMLStreamReader(), DOOMAbstractFactory.getSOAP11Factory(), SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+            
+            SOAPEnvelope doomEnv = doomBuilder.getSOAPEnvelope();
+            
+            doomEnv.build();
+            
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java
new file mode 100644
index 0000000..089172c
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.dom;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.impl.dom.jaxp.DocumentBuilderFactoryImpl;
+import org.apache.axiom.om.impl.dom.jaxp.DocumentBuilderImpl;
+import org.w3c.dom.Document;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+public class DOMImplementationTest extends TestCase {
+
+	public DOMImplementationTest(String name) {
+		super(name);
+	}
+	
+	public void testDOMImpl() {
+		try {
+//			System.setProperty("javax.xml.parsers.DocumentBuilderFactory",DocumentBuilderFactoryImpl.class.getName());
+		    
+            DocumentBuilderFactoryImpl.setDOOMRequired(true);
+            
+			DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();
+			DocumentBuilder builder = fac.newDocumentBuilder();
+			Document doc = builder.newDocument();
+			
+			assertEquals("Incorrect DocumentBuilderFactory instance", DocumentBuilderFactoryImpl.class.getName(),fac.getClass().getName());
+			assertEquals("Incorrect DocumentBuilder instance", DocumentBuilderImpl.class.getName(),builder.getClass().getName());
+			assertEquals("Incorrect Document instance", DocumentImpl.class.getName(),doc.getClass().getName());
+            
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail(e.getMessage());
+		} finally {
+            DocumentBuilderFactoryImpl.setDOOMRequired(false);
+        }
+	}
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/DocumentImplTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/DocumentImplTest.java
new file mode 100644
index 0000000..15a257a
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/DocumentImplTest.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.Text;
+
+public class DocumentImplTest extends TestCase {
+
+	public DocumentImplTest() {
+		super();
+	}
+
+	public DocumentImplTest(String name) {
+		super(name);
+	}
+	
+	public void testCreateElement() {
+		String tagName = "LocalName";
+		String namespace = "http://ws.apache.org/axis2/ns";
+        OMDOMFactory fac = new OMDOMFactory();
+		DocumentImpl doc = new DocumentImpl(fac);
+		Element elem = doc.createElement(tagName);
+		
+		assertEquals("Local name misnatch",tagName, elem.getNodeName());
+		
+		elem = doc.createElementNS(namespace, "axis2:" + tagName);
+		assertEquals("Local name misnatch",tagName,elem.getLocalName());
+		assertEquals("Namespace misnatch",namespace,elem.getNamespaceURI());
+		
+	}
+	
+	public void testCreateAttribute() {
+		String attrName = "attrIdentifier";
+		String attrValue = "attrValue";
+		String attrNs = "http://ws.apache.org/axis2/ns";
+		String attrNsPrefix = "axis2";
+		
+        OMDOMFactory fac = new OMDOMFactory();
+        DocumentImpl doc = new DocumentImpl(fac);
+		Attr attr = doc.createAttribute(attrName);
+
+		assertEquals("Attr name mismatch",attrName,attr.getName());
+		assertNull("Namespace value should be null", attr.getNamespaceURI());
+		
+		
+		attr = doc.createAttributeNS(attrNs,attrNsPrefix + ":" + attrName);
+		assertEquals("Attr name mismatch",attrName,attr.getLocalName());
+		assertNotNull("Namespace value should not be null", attr.getNamespaceURI());
+		assertEquals("NamsspaceURI mismatch", attrNs, attr.getNamespaceURI());
+		assertEquals("namespace prefix mismatch", attrNsPrefix, attr.getPrefix());
+		
+		attr.setValue(attrValue);
+		
+	}
+	
+	public void testCreateText() {
+		String textValue = "temp text value";
+		
+        OMDOMFactory fac = new OMDOMFactory();
+        DocumentImpl doc = new DocumentImpl(fac);
+		Text txt = doc.createTextNode(textValue);
+		
+		assertEquals("Text value mismatch", textValue, txt.getData());
+	}
+
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImplTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImplTest.java
new file mode 100644
index 0000000..682e6d7
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/ElementImplTest.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
+import org.apache.axiom.om.impl.dom.jaxp.DocumentBuilderFactoryImpl;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+import javax.xml.namespace.QName;
+import java.io.ByteArrayOutputStream;
+import java.util.Iterator;
+
+public class ElementImplTest extends TestCase {
+
+	public ElementImplTest() {
+		super();
+	}
+
+	public ElementImplTest(String name) {
+		super(name);
+	}
+	
+	public void testSetText() {
+		OMDOMFactory factory = new OMDOMFactory();
+		String localName = "TestLocalName";
+		String namespace = "http://ws.apache.org/axis2/ns";
+		String prefix = "axis2";
+		OMElement elem = factory.createOMElement(localName,namespace,prefix);
+		
+		String text = "The quick brown fox jumps over the lazy dog";
+		
+		elem.setText(text);
+		
+		assertEquals("Text value mismatch", text, elem.getText());
+		
+	}
+	
+	public void testSerialize() {
+		OMDOMFactory factory = new OMDOMFactory();
+		String localName = "TestLocalName";
+		String namespace = "http://ws.apache.org/axis2/ns";
+		String prefix = "axis2";
+		String tempText = "The quick brown fox jumps over the lazy dog";
+		String textToAppend = " followed by another";
+		
+		OMElement elem = factory.createOMElement(localName,namespace,prefix);
+		OMText textNode = factory.createOMText(elem,tempText);
+		
+		((Text)textNode).appendData(textToAppend);
+		ByteArrayOutputStream baos = new ByteArrayOutputStream();
+		try {
+			elem.serialize(baos);
+			String xml = new String(baos.toByteArray());
+            assertEquals("Incorrect serialized xml", 0, xml.indexOf("<axis2:TestLocalName"));
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail(e.getMessage());
+		}
+	}
+	
+	public void testAddChild() {
+		OMDOMFactory factory = new OMDOMFactory();
+		String localName = "TestLocalName";
+		String childLocalName = "TestChildLocalName";
+		String namespace = "http://ws.apache.org/axis2/ns";
+		String prefix = "axis2";
+		
+		OMElement elem = factory.createOMElement(localName,namespace,prefix);
+		OMElement childElem = factory.createOMElement(childLocalName,namespace, prefix);
+		
+		elem.addChild(childElem);
+		
+		Iterator it = elem.getChildrenWithName(new QName(namespace, childLocalName));
+		
+		int count = 0;
+		while (it.hasNext()) {
+			OMElement child = (OMElement) it.next();
+			assertEquals("Child local name mismatch", childLocalName, child.getLocalName());
+			assertEquals("Child namespace mismatch", namespace, child.getNamespace().getNamespaceURI());
+			count ++;
+		}
+		assertEquals("In correct number of children", 1, count );
+	}
+	
+	public void testAppendChild() {
+		try {
+			String elementName = "TestElem";
+			String childElemName = "TestChildElem";
+			String childTextValue = "text value of the child text node";
+			
+			//Apending am Element node
+            DocumentBuilderFactoryImpl.setDOOMRequired(true);
+			Document doc = DocumentBuilderFactoryImpl.newInstance().newDocumentBuilder().newDocument();
+			Element elem = doc.createElement(elementName);
+			Element childElem = doc.createElement(childElemName);
+			
+			elem.appendChild(childElem);
+			
+			Element addedChild = (Element)elem.getFirstChild();
+			assertNotNull("Child Element node missing",addedChild);
+			assertEquals("Incorre node object", childElem, addedChild);
+			
+			elem = doc.createElement(elementName);
+			Text text = doc.createTextNode(childTextValue);
+			elem.appendChild(text);
+			
+			Text addedTextnode = (Text)elem.getFirstChild();
+			assertNotNull("Child Text node missing", addedTextnode);
+			assertEquals("Incorrect node object", text, addedTextnode);
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail(e.getMessage());
+		} finally {
+            DocumentBuilderFactoryImpl.setDOOMRequired(false);      
+        }
+	}
+	
+	/**
+	 * Testing the NodeList returned with the elements's children
+	 */
+	public void testGetElementsbyTagName() {
+		try {
+			String childElementLN = "Child";
+			
+            DocumentBuilderFactoryImpl.setDOOMRequired(true);
+            
+			Document doc = DocumentBuilderFactoryImpl.newInstance().newDocumentBuilder().newDocument();
+			Element docElem = doc.getDocumentElement();
+			assertNull("The document element shoudl be null", docElem);
+			
+			docElem = doc.createElement("Test");
+			docElem.appendChild(doc.createElement(childElementLN));
+			docElem.appendChild(doc.createElement(childElementLN));
+			docElem.appendChild(doc.createElement(childElementLN));
+			docElem.appendChild(doc.createElement(childElementLN));
+			docElem.appendChild(doc.createElement(childElementLN));
+			docElem.appendChild(doc.createElement(childElementLN));
+			docElem.appendChild(doc.createElement(childElementLN));
+			
+			NodeList list = docElem.getElementsByTagName(childElementLN);
+			
+			assertEquals("Incorrect number of child elements", 7 ,list.getLength());
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail(e.getMessage());
+		} finally {
+            DocumentBuilderFactoryImpl.setDOOMRequired(false);      
+        }
+	}
+	
+	public void testGetElementsbyTagNameNS() {
+		try {
+			String childElementLN = "test:Child";
+			String childElementNS = "http://ws.apache.org/ns/axis2/dom";
+			
+            DocumentBuilderFactoryImpl.setDOOMRequired(true);
+			Document doc = DocumentBuilderFactoryImpl.newInstance().newDocumentBuilder().newDocument();
+			Element docElem = doc.getDocumentElement();
+			assertNull("The document element shoudl be null", docElem);
+			
+			docElem = doc.createElementNS("http://test.org", "test:Test");
+			
+			docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
+			docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
+			docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
+			docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
+			docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
+			docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
+			docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
+			
+			NodeList list = docElem.getElementsByTagNameNS(childElementNS, childElementLN);
+			
+			assertEquals("Incorrect number of child elements", 7 ,list.getLength());
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail(e.getMessage());
+		} finally {
+            DocumentBuilderFactoryImpl.setDOOMRequired(false);      
+        }
+	}	
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/MessagesTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/MessagesTest.java
new file mode 100644
index 0000000..066a1cf
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/MessagesTest.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.soap.SOAPEnvelope;
+
+public class MessagesTest extends OMDOMTestCase {
+    SOAPEnvelope soapEnvelope;
+
+    public MessagesTest(String testName) {
+        super(testName);
+    }
+
+    public void testMessageWithLotOfWhiteSpaces() throws OMException,
+            Exception {
+        soapEnvelope =
+                (SOAPEnvelope) OMTestUtils.getOMBuilder(
+                        getTestResourceFile("soap/whitespacedMessage.xml"))
+                .getDocumentElement();
+        OMTestUtils.walkThrough(soapEnvelope);
+    }
+
+    public void testMinimalMessage() throws OMException, Exception {
+        soapEnvelope =
+                (SOAPEnvelope) OMTestUtils.getOMBuilder(
+                        getTestResourceFile("soap/minimalMessage.xml"))
+                .getDocumentElement();
+        OMTestUtils.walkThrough(soapEnvelope);
+    }
+
+    public void testReallyBigMessage() throws OMException, Exception {
+        soapEnvelope =
+                (SOAPEnvelope) OMTestUtils.getOMBuilder(
+                        getTestResourceFile("soap/reallyReallyBigMessage.xml"))
+                .getDocumentElement();
+        OMTestUtils.walkThrough(soapEnvelope);
+    }
+
+    public void testEmptyBodiedMessage() throws OMException, Exception {
+        soapEnvelope =
+                (SOAPEnvelope) OMTestUtils.getOMBuilder(
+                        getTestResourceFile("soap/emtyBodymessage.xml"))
+                .getDocumentElement();
+        OMTestUtils.walkThrough(soapEnvelope);
+    }
+
+
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMDOMFactoryTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMDOMFactoryTest.java
new file mode 100644
index 0000000..c0c3261
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMDOMFactoryTest.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
+
+import javax.xml.namespace.QName;
+
+public class OMDOMFactoryTest extends TestCase{
+
+	public OMDOMFactoryTest() {
+		super();
+	}
+	
+	public OMDOMFactoryTest(String name) {
+		super(name);
+	}
+	
+	public void testCreateElement() {
+		OMDOMFactory factory = new OMDOMFactory();
+		String localName = "TestLocalName";
+		String namespace = "http://ws.apache.org/axis2/ns";
+		String prefix = "axis2";
+		OMElement elem = factory.createOMElement(localName,namespace,prefix);
+		QName qname = elem.getQName();
+		
+		assertEquals("Localname mismatch",localName,qname.getLocalPart());
+		assertEquals("Namespace mismatch",namespace,qname.getNamespaceURI());
+		assertEquals("namespace prefix mismatch", prefix, qname.getPrefix());
+	}
+
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMDOMTestCase.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMDOMTestCase.java
new file mode 100644
index 0000000..e4f221e
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMDOMTestCase.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
+import org.apache.axiom.soap.impl.dom.factory.DOMSOAPFactory;
+import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.FileReader;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+public abstract class OMDOMTestCase extends AbstractTestCase{
+
+	protected static final String IN_FILE_NAME = "soap/soapmessage.xml";
+    protected StAXSOAPModelBuilder builder;
+    protected OMFactory ombuilderFactory;
+    protected SOAPFactory soapFactory;
+    
+    protected SOAPEnvelope soapEnvelope;
+	
+    public OMDOMTestCase(String testName) {
+		super(testName);
+	}
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+        soapEnvelope = (SOAPEnvelope) getOMBuilder("").getDocumentElement();
+    }
+	
+    protected StAXSOAPModelBuilder getOMBuilder(String fileName) throws Exception {
+        if ("".equals(fileName) || fileName == null) {
+            fileName = IN_FILE_NAME;
+        }
+        XMLStreamReader parser = XMLInputFactory.newInstance()
+                .createXMLStreamReader(
+                        new FileReader(getTestResourceFile(fileName)));
+        builder = new StAXSOAPModelBuilder(parser, new SOAP11Factory(), null);
+        return builder;
+    }
+    
+    
+
+    protected StAXSOAPModelBuilder getOMBuilder(InputStream in) throws Exception {
+        XMLStreamReader parser = XMLInputFactory.newInstance()
+                .createXMLStreamReader(in);
+        builder = new StAXSOAPModelBuilder(parser, new DOMSOAPFactory(), null);
+        return builder;
+    }
+
+    protected XMLStreamWriter getStAXStreamWriter(OutputStream out) throws XMLStreamException {
+        return XMLOutputFactory.newInstance().createXMLStreamWriter(out);
+    }
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMTestUtils.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMTestUtils.java
new file mode 100644
index 0000000..b795304
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/OMTestUtils.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.dom;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import java.io.File;
+import java.io.FileReader;
+import java.util.Iterator;
+
+public class OMTestUtils {
+    public static OMXMLParserWrapper getOMBuilder(File file) throws Exception {
+        XMLStreamReader parser = XMLInputFactory.newInstance()
+                .createXMLStreamReader(new FileReader(file));
+        return OMXMLBuilderFactory.createStAXSOAPModelBuilder(
+                new SOAP11Factory(), parser);
+    }
+
+    public static void walkThrough(OMElement omEle) {
+        Iterator attibIt = omEle.getAllAttributes();
+        if (attibIt != null) {
+            while (attibIt.hasNext()) {
+                TestCase.assertNotNull("once the has next is not null, the " +
+                        "element should not be null",
+                        attibIt.next());
+            }
+        }
+        Iterator it = omEle.getChildren();
+        if (it != null) {
+            while (it.hasNext()) {
+                OMNode ele = (OMNode) it.next();
+                TestCase.assertNotNull("once the has next is not null, the " +
+                        "element should not be null", ele);
+                if (ele instanceof OMElement) {
+                    walkThrough((OMElement) ele);
+                }
+            }
+        }
+    }
+
+    public static void compare(Element ele, OMElement omele) throws Exception {
+        if (ele == null && omele == null) {
+            return;
+        } else if (ele != null && omele != null) {
+            TestCase.assertEquals("Element name not correct",
+                    ele.getLocalName(),
+                    omele.getLocalName());
+            if (omele.getNamespace() != null) {
+                TestCase.assertEquals("Namespace URI not correct",
+                        ele.getNamespaceURI(),
+                        omele.getNamespace().getNamespaceURI());
+
+            }
+
+            //go through the attributes
+            NamedNodeMap map = ele.getAttributes();
+            Iterator attIterator = omele.getAllAttributes();
+            OMAttribute omattribute;
+            while (attIterator != null && attIterator.hasNext() && map == null) {
+                omattribute = (OMAttribute) attIterator.next();
+                Node node = map.getNamedItemNS(
+                        omattribute.getNamespace().getNamespaceURI(),
+                        omattribute.getLocalName());
+                if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
+                    Attr attr = (Attr) node;
+                    TestCase.assertEquals(attr.getValue(),
+                            omattribute.getAttributeValue());
+                } else {
+                    throw new OMException("return type is not a Attribute");
+                }
+
+            }
+            Iterator it = omele.getChildren();
+            NodeList list = ele.getChildNodes();
+            for (int i = 0; i < list.getLength(); i++) {
+                Node node = list.item(i);
+                if (node.getNodeType() == Node.ELEMENT_NODE) {
+                    TestCase.assertTrue(it.hasNext());
+                    OMNode tempOmNode = (OMNode) it.next();
+                    while (tempOmNode.getType() != OMNode.ELEMENT_NODE) {
+                        TestCase.assertTrue(it.hasNext());
+                        tempOmNode = (OMNode) it.next();
+                    }
+                    compare((Element) node, (OMElement) tempOmNode);
+                }
+            }
+
+
+        } else {
+            throw new Exception("One is null");
+        }
+    }
+
+    public static SOAPEnvelope createOM(File file) throws Exception {
+        return (SOAPEnvelope) getOMBuilder(file).getDocumentElement();
+    }
+
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/TextImplTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/TextImplTest.java
new file mode 100644
index 0000000..fccce31
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/dom/TextImplTest.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
+import org.w3c.dom.Text;
+
+public class TextImplTest extends TestCase {
+
+	public TextImplTest() {
+		super();
+	}
+
+	public TextImplTest(String name) {
+		super(name);
+	}
+
+	public void testSetText() {
+		OMDOMFactory factory = new OMDOMFactory();
+		String localName = "TestLocalName";
+		String namespace = "http://ws.apache.org/axis2/ns";
+		String prefix = "axis2";
+		String tempText = "The quick brown fox jumps over the lazy dog";
+
+		OMElement elem = factory.createOMElement(localName, namespace, prefix);
+		OMText textNode = factory.createOMText(elem, tempText);
+
+		assertEquals("Text value mismatch", tempText, textNode.getText());
+	}
+
+	public void testAppendText() {
+		OMDOMFactory factory = new OMDOMFactory();
+		String localName = "TestLocalName";
+		String namespace = "http://ws.apache.org/axis2/ns";
+		String prefix = "axis2";
+		String tempText = "The quick brown fox jumps over the lazy dog";
+		String textToAppend = " followed by another fox";
+
+		OMElement elem = factory.createOMElement(localName, namespace, prefix);
+		OMText textNode = factory.createOMText(elem, tempText);
+
+		((Text) textNode).appendData(textToAppend);
+
+		assertEquals("Text value mismatch", tempText + textToAppend, textNode
+				.getText());
+	}
+
+	public void testSplitText() {
+		String textValue = "temp text value";
+
+        OMDOMFactory fac = new OMDOMFactory();
+        DocumentImpl doc = new DocumentImpl(fac);
+
+		Text txt = doc.createTextNode(textValue);
+		txt.splitText(3);
+
+		assertNotNull("Text value missing in the original Text node", txt
+				.getNodeValue());
+
+		assertNotNull("Sibling missing after split", txt.getNextSibling());
+		assertNotNull("Text value missing in the new split Text node", txt
+				.getNextSibling().getNodeValue());
+
+		assertEquals("Incorrect split point", textValue.substring(0, 3), txt
+				.getNodeValue());
+		assertEquals("Incorrect split point", textValue.substring(3, textValue
+				.length()), txt.getNextSibling().getNodeValue());
+
+	}
+
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMDocumentSerilizationTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMDocumentSerilizationTest.java
new file mode 100644
index 0000000..cd7f911
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMDocumentSerilizationTest.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.llom;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMOutputFormat;
+
+import javax.xml.stream.XMLStreamException;
+import java.io.ByteArrayOutputStream;
+import java.io.UnsupportedEncodingException;
+
+/**
+ * This tests the serializeAndConsume method
+ */
+public class OMDocumentSerilizationTest extends TestCase {
+
+    private OMDocument document;
+    private String xmlDeclStart = "<?xml";
+    private String encoding = "encoding='UTF-8'";
+    private String encoding_UTF16 = "encoding='UTF-16'";
+    private String encoding2 = "encoding=\"UTF-8\"";
+    private String encoding2_UTF16 = "encoding=\"UTF-16\"";
+    private String version = "version='1.0'";
+    private String version_11 = "version='1.1'";
+    private String version2 = "version=\"1.0\"";
+    private String version2_11 = "version=\"1.1\"";
+
+    public void setUp() {
+        OMFactory factory = OMAbstractFactory.getOMFactory();
+
+        OMNamespace namespace = factory.createOMNamespace("http://testuri.org","test");
+        OMElement documentElement = factory.createOMElement("DocumentElement",namespace);
+
+        OMElement child1 = factory.createOMElement("Child1",namespace);
+        child1.setText("TestText");
+        documentElement.addChild(child1);
+
+        document = factory.createOMDocument();
+        document.setOMDocumentElement(documentElement);
+
+    }
+
+    public OMDocumentSerilizationTest(String name) {
+        super(name);
+    }
+
+
+    public void testXMLDecleration() throws XMLStreamException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        document.serializeAndConsume(baos);
+
+        String xmlDocument = new String(baos.toByteArray());
+
+        assertTrue("XML Declaration missing",-1<xmlDocument.indexOf(xmlDeclStart));
+    }
+
+    public void testExcludeXMLDeclaration() throws XMLStreamException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        OMOutputFormat format = new OMOutputFormat();
+        format.setIgnoreXMLDeclaration(true);
+        document.serializeAndConsume(baos, format);
+
+        String xmlDocument = new String(baos.toByteArray());
+
+        assertTrue(
+                "XML Declaration is included when serilizing without the declaration",
+                -1 == xmlDocument.indexOf(xmlDeclStart));
+    }
+
+    public void testCharsetEncoding() throws XMLStreamException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        document.serializeAndConsume(baos);
+
+        String xmlDocument = new String(baos.toByteArray());
+
+        assertTrue("Charset declaration missing",-1 < xmlDocument.indexOf(encoding) ||
+                                                 -1 < xmlDocument.indexOf(encoding.toLowerCase()) ||
+                                                 -1 < xmlDocument.indexOf(encoding2.toLowerCase()) ||
+                                                 -1 < xmlDocument.indexOf(encoding2));
+    }
+
+    public void testCharsetEncodingUTF_16() throws XMLStreamException, UnsupportedEncodingException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        OMOutputFormat format = new OMOutputFormat();
+        format.setCharSetEncoding("UTF-16");
+        document.serializeAndConsume(baos, format);
+
+        String xmlDocument = new String(baos.toByteArray(),"UTF-16");
+        assertTrue("Charset declaration missing",-1<xmlDocument.indexOf(encoding_UTF16) ||
+                                                 -1<xmlDocument.indexOf(encoding2_UTF16));
+    }
+
+
+    public void testXMLVersion() throws XMLStreamException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        document.serializeAndConsume(baos);
+
+        String xmlDocument = new String(baos.toByteArray());
+        assertTrue("Charset declaration missing",-1<xmlDocument.indexOf(version) ||
+                                                 -1<xmlDocument.indexOf(version2));
+    }
+
+    public void testXMLVersion_11() throws XMLStreamException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        document.setXMLVersion("1.1");
+        document.serializeAndConsume(baos);
+
+        String xmlDocument = new String(baos.toByteArray());
+        assertTrue("Charset declaration missing",-1<xmlDocument.indexOf(version_11) ||
+                                                 -1<xmlDocument.indexOf(version2_11));
+    }
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMElementGetElementTextTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMElementGetElementTextTest.java
new file mode 100644
index 0000000..7f5f912
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMElementGetElementTextTest.java
@@ -0,0 +1,60 @@
+package org.apache.axiom.om.impl.llom;

+

+import junit.framework.TestCase;

+import org.apache.axiom.om.OMFactory;

+import org.apache.axiom.om.OMAbstractFactory;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMComment;

+

+import javax.xml.stream.XMLStreamException;

+import javax.xml.stream.XMLStreamReader;

+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+public class OMElementGetElementTextTest extends TestCase {

+

+    protected OMElement documentElement;

+    public void setUp() {

+        OMFactory factory = OMAbstractFactory.getOMFactory();

+

+        OMNamespace namespace = factory.createOMNamespace("http://testuri.org","test");

+        documentElement = factory.createOMElement("DocumentElement",namespace);

+        factory.createOMText(documentElement,"this is a TEXT");

+        factory.createOMComment(documentElement,"this is a comment");

+        factory.createOMText(documentElement,"this is a TEXT block 2");

+

+    }

+

+    /**

+     *

+     */

+     public void testGetElementTextProperly(){

+        try {

+            XMLStreamReader xmlStreamReader = documentElement.getXMLStreamReader();

+            //move to the Start_Element

+            while(xmlStreamReader.getEventType()!=XMLStreamReader.START_ELEMENT){

+                xmlStreamReader.next();

+            }

+

+            String elementText = xmlStreamReader.getElementText();

+            assertEquals("this is a TEXTthis is a TEXT block 2",elementText);

+        } catch (XMLStreamException e) {

+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.

+        }

+    }

+

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMNamespaceImplTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMNamespaceImplTest.java
new file mode 100644
index 0000000..ba69c51
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMNamespaceImplTest.java
@@ -0,0 +1,161 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ * Copyright 2006 International Business Machines Corp.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.llom;

+

+import junit.framework.Test;

+import junit.framework.TestCase;

+import junit.framework.TestSuite;

+import junit.textui.TestRunner;

+

+import java.lang.reflect.Field;

+import java.lang.reflect.Method;

+

+import org.apache.axiom.om.impl.OMNamespaceImpl;

+

+/**

+ * This class will test the methods and fields of

+ * the OMNamespaceImpl class. 

+ */

+public class OMNamespaceImplTest extends TestCase {

+

+    /**

+     * The main method.

+     *

+     * @param args The command line arguments

+     */

+    public static void main(String[] args) {

+        TestRunner.run(suite());

+    }

+

+    /**

+     * A one arg constructor to allow specifying

+     * a single test method to run.

+     *

+     * @param name The name of the test to run

+     */

+    public OMNamespaceImplTest(String name) {

+        super(name);

+    }

+

+    /**

+     * This method returns a test suite of tests to

+     * run.

+     *

+     * @return A test suite to be run

+     */

+    public static Test suite() {

+        return new TestSuite(OMNamespaceImplTest.class);

+    }

+

+    /**

+     * This method will test the getPrefix method.

+     */

+    public void testGetPrefix() {

+        OMNamespaceImpl omNsImpl =

+            new OMNamespaceImpl("http://www.w3.org/XML/1998/namespace",

+                                "xml");

+        assertEquals("http://www.w3.org/XML/1998/namespace",

+                     omNsImpl.getNamespaceURI());

+        omNsImpl = new OMNamespaceImpl(null, null);

+        assertNull(omNsImpl.getNamespaceURI());

+    }

+

+    /**

+     * This method will test the getName method.

+     */

+    public void testGetName() {

+        OMNamespaceImpl omNsImpl =

+            new OMNamespaceImpl("http://www.w3.org/XML/1998/namespace",

+                                "xml");

+        assertEquals("xml", omNsImpl.getPrefix());

+        omNsImpl = new OMNamespaceImpl(null, null);

+        assertNull(omNsImpl.getPrefix());

+    }

+

+    /**

+     * This method wil test the equals method.

+     */

+    public void testEquals() {

+        OMNamespaceImpl omNsImpl =

+            new OMNamespaceImpl("http://www.w3.org/XML/1998/namespace",

+                                null);

+        assertTrue(omNsImpl.equals("http://www.w3.org/XML/1998/namespace",

+                                   null));

+

+        omNsImpl =

+            new OMNamespaceImpl("http://www.w3.org/XML/1998/namespace",

+                                "xml");

+        assertTrue(omNsImpl.equals("http://www.w3.org/XML/1998/namespace",

+                                   "xml"));

+        assertTrue(!omNsImpl.equals("http://www.w3.org/XML/1998/namespace",

+                                    "xml2"));

+        assertTrue(!omNsImpl.equals("http://www.w3.org/XML/1998/namespace",

+                                    null));

+        assertTrue(!omNsImpl.equals("http://www.w3.org/XML/2001/namespace",

+                                    "xml"));

+        assertTrue(!omNsImpl.equals(null,

+                                    "xml"));

+

+        omNsImpl = new OMNamespaceImpl(null, null);

+        assertTrue(!omNsImpl.equals("http://www.w3.org/XML/1998/namespace",

+                                   "xml"));

+        assertTrue(!omNsImpl.equals("http://www.w3.org/XML/1998/namespace",

+                                    null));

+        assertTrue(!omNsImpl.equals(null,

+                                    "xml"));

+        assertTrue(omNsImpl.equals(null, null));

+        

+    }

+

+    /**

+     * This method will insure that the OMNamespaceImpl

+     * class remains immutable.

+     *

+     * @throws Exception Any kind of exception

+     */

+    public void testImmutable() throws Exception {

+

+        Field[] clsField = OMNamespaceImpl.class.getDeclaredFields();

+        for (int i = 0; i < clsField.length; i++) {

+            String fieldData = clsField[i].toString();

+            if ((fieldData.indexOf("prefix") != -1) 

+                || (fieldData.indexOf("uri") != -1)) {

+                assertTrue("The field should have been private, "

+                           + " but instead contained: " + fieldData + ".",

+                           fieldData.indexOf("private") != -1);

+            }

+        }

+

+        String[] method = new String[] {"setPrefix", "setUri", "setName"};

+        for (int i = 0; i < method.length; i++) {

+            try {

+                Method m =

+                    OMNamespaceImpl.class.getMethod(method[i],

+                                                  new Class[] {String.class});

+                fail("A NoSuchMethodException should have been thrown"

+                     + " when trying to get method \"" + method[i]

+                     + "\".");

+            } catch (NoSuchMethodException e) {

+                // These methods should not exist, so this is

+                // expected.

+            }

+        }

+

+    }

+

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMOutputTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMOutputTest.java
new file mode 100644
index 0000000..0bcd0b0
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMOutputTest.java
@@ -0,0 +1,114 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.llom;

+

+import org.apache.axiom.attachments.ByteArrayDataSource;

+import org.apache.axiom.om.AbstractTestCase;

+import org.apache.axiom.om.OMAbstractFactory;

+import org.apache.axiom.om.OMAttribute;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMFactory;

+import org.apache.axiom.om.OMOutputFormat;

+import org.apache.axiom.om.impl.OMNamespaceImpl;

+

+import javax.activation.DataHandler;

+import java.io.File;

+import java.io.FileOutputStream;

+

+public class OMOutputTest extends AbstractTestCase {

+

+    /**

+     * @param testName

+     */

+    public OMOutputTest(String testName) {

+        super(testName);

+    }

+

+    String outFileName;

+

+    String outBase64FileName;

+

+    OMElement envelope;

+

+    File outMTOMFile;

+

+    File outBase64File;

+

+    /*

+     * @see TestCase#setUp()

+     */

+    protected void setUp() throws Exception {

+        super.setUp();

+        DataHandler dataHandler;

+

+        outFileName = "OMSerializeMTOMOut.txt";

+        outBase64FileName = "OMSerializeBase64Out.xml";

+        outMTOMFile = getTempOutputFile(outFileName);

+        outBase64File = getTempOutputFile(outBase64FileName);

+

+        OMFactory fac = OMAbstractFactory.getOMFactory();

+        

+        OMNamespaceImpl soap = new OMNamespaceImpl(

+                "http://schemas.xmlsoap.org/soap/envelope/", "soap");

+        envelope = new OMElementImpl("Envelope", soap, fac);

+        OMElement body = new OMElementImpl("Body", soap, fac);

+

+        OMNamespaceImpl dataName = new OMNamespaceImpl(

+                "http://www.example.org/stuff", "m");

+        OMElement data = new OMElementImpl("data", dataName, fac);

+

+        OMNamespaceImpl mime = new OMNamespaceImpl(

+                "http://www.w3.org/2003/06/xmlmime", "m");

+

+        OMElement text = new OMElementImpl("name", dataName, fac);

+        OMAttribute cType1 = new OMAttributeImpl("contentType", mime,

+                "text/plain", fac);

+        text.addAttribute(cType1);

+        byte[] byteArray = new byte[]{13, 56, 65, 32, 12, 12, 7, -3, -2, -1,

+                                      98};

+        dataHandler = new DataHandler(new ByteArrayDataSource(byteArray));

+        OMTextImpl textData = new OMTextImpl(dataHandler, false, fac);

+

+        envelope.addChild(body);

+        body.addChild(data);

+        data.addChild(text);

+        text.addChild(textData);

+    }

+

+    /*

+     * @see TestCase#tearDown()

+     */

+    protected void tearDown() throws Exception {

+        super.tearDown();

+        if (this.outMTOMFile.exists()) {

+            this.outMTOMFile.delete();

+        }

+        if (this.outBase64File.exists()) {

+            this.outBase64File.delete();

+        }

+    }

+

+    public void testComplete() throws Exception {

+        OMOutputFormat mtomOutputFormat = new OMOutputFormat();

+        mtomOutputFormat.setDoOptimize(true);

+        OMOutputFormat baseOutputFormat = new OMOutputFormat();

+        baseOutputFormat.setDoOptimize(false);

+        

+        envelope.serializeAndConsume(new FileOutputStream(outBase64File), baseOutputFormat);

+        envelope.serializeAndConsume(new FileOutputStream(outMTOMFile), mtomOutputFormat);

+    }

+}
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMSourcedElementTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMSourcedElementTest.java
new file mode 100644
index 0000000..696c2ce
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/llom/OMSourcedElementTest.java
@@ -0,0 +1,193 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.llom;

+

+import org.apache.axiom.om.AbstractTestCase;

+import org.apache.axiom.om.OMDataSource;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMNode;

+import org.apache.axiom.om.OMOutputFormat;

+import org.apache.axiom.om.impl.OMNamespaceImpl;

+import org.apache.axiom.om.impl.llom.factory.OMLinkedListImplFactory;

+import org.apache.axiom.om.impl.serialize.StreamingOMSerializer;

+

+import javax.xml.namespace.QName;

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLOutputFactory;

+import javax.xml.stream.XMLStreamException;

+import javax.xml.stream.XMLStreamReader;

+import javax.xml.stream.XMLStreamWriter;

+import java.io.ByteArrayOutputStream;

+import java.io.IOException;

+import java.io.OutputStream;

+import java.io.StringReader;

+import java.io.StringWriter;

+import java.io.Writer;

+import java.lang.reflect.Method;

+import java.lang.reflect.Modifier;

+import java.util.Arrays;

+import java.util.Iterator;

+

+public class OMSourcedElementTest extends AbstractTestCase {

+    private static String testDocument =

+        "<library xmlns='http://www.sosnoski.com/uwjws/library' books='1'>" +

+        "<type id='java' category='professional' deductable='true'>"+

+        "<name>Java Reference</name></type><type id='xml' "+

+        "category='professional' deductable='true'><name>XML Reference</name>" +

+        "</type><book isbn='1930110111' type='xml'><title>XSLT Quickly</title>" +

+        "<author>DuCharme, Bob</author><publisher>Manning</publisher>" +

+        "<price>29.95</price></book></library>";

+    

+    private OMSourcedElementImpl element;

+

+    /**

+     * @param testName

+     */

+    public OMSourcedElementTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        element = new OMSourcedElementImpl("library",

+            new OMNamespaceImpl("http://www.sosnoski.com/uwjws/library", ""),

+                new OMLinkedListImplFactory(), new TestDataSource(testDocument));

+    }

+    

+    public void testMethodOverrides() {

+        Method[] submeths = OMSourcedElementImpl.class.getDeclaredMethods();

+        Method[] supmeths = OMElementImpl.class.getDeclaredMethods();

+        outer: for (int i = 0; i < supmeths.length; i++) {

+            Method supmeth = supmeths[i];

+            Class[] params = supmeth.getParameterTypes();

+            if (!Modifier.isPrivate(supmeth.getModifiers())) {

+                for (int j = 0; j < submeths.length; j++) {

+                    Method submeth = submeths[j];

+                    if (supmeth.getName().equals(submeth.getName())) {

+                        if (Arrays.equals(params, submeth.getParameterTypes())) {

+                            continue outer;

+                        }

+                    }

+                }

+                fail("OMSourcedElementImpl must override method " + supmeth +

+                    "\nSee class JavaDocs for details");

+            }

+        }

+    }

+    

+    private int countItems(Iterator iter) {

+        int count = 0;

+        while (iter.hasNext()) {

+            count++;

+            iter.next();

+        }

+        return count;

+    }

+    

+    public void testSerializeToStream() throws Exception {

+        ByteArrayOutputStream bos = new ByteArrayOutputStream();

+        element.serialize(bos);

+        assertEquals("Serialized text error", testDocument,

+            new String(bos.toByteArray()));

+        assertFalse("Element expansion when serializing", element.isExpanded());

+    }

+    

+    public void testSerializeToWriter() throws Exception {

+        StringWriter writer = new StringWriter();

+        element.serialize(writer);

+        assertEquals("Serialized text error", testDocument, writer.toString());

+        assertFalse("Element expansion when serializing", element.isExpanded());

+    }

+    

+    public void testSerializeToXMLWriter() throws Exception {

+        StringWriter writer = new StringWriter();

+        XMLStreamWriter xmlwriter = XMLOutputFactory.newInstance().createXMLStreamWriter(writer);

+        element.serialize(writer);

+        xmlwriter.flush();

+        assertEquals("Serialized text error", testDocument, writer.toString());

+        assertFalse("Element expansion when serializing", element.isExpanded());

+    }

+

+    public void testExpand() throws Exception {

+        element.getAllDeclaredNamespaces();

+        assertEquals("Expanded namespace count error", 1,

+            countItems(element.getAllDeclaredNamespaces()));

+        assertEquals("Expanded attribute count error", 1,

+            countItems(element.getAllAttributes()));

+        assertEquals("Expanded attribute value error", "1",

+            element.getAttributeValue(new QName("books")));

+        OMElement child = element.getFirstElement();

+        assertEquals("Child element name", "type", child.getLocalName());

+        assertEquals("Child element namespace",

+            "http://www.sosnoski.com/uwjws/library", child.getNamespace().getNamespaceURI());

+        OMNode next = child.getNextOMSibling();

+        assertTrue("Expected child element", next instanceof OMElement);

+        next = next.getNextOMSibling();

+        assertTrue("Expected child element", next instanceof OMElement);

+        child = (OMElement)next;

+        assertEquals("Child element name", "book", child.getLocalName());

+        assertEquals("Child element namespace",

+            "http://www.sosnoski.com/uwjws/library", child.getNamespace().getNamespaceURI());

+        assertEquals("Attribute value error", "xml",

+            child.getAttributeValue(new QName("type")));

+    }

+    

+    private static class TestDataSource implements OMDataSource {

+        private final String data;

+        

+        private TestDataSource(String data) {

+            this.data = data;

+        }

+

+        /* (non-Javadoc)

+         * @see org.apache.axiom.om.OMDataSource#serialize(java.io.OutputStream, org.apache.axiom.om.OMOutputFormat)

+         */

+        public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {

+            try {

+                output.write(data.getBytes());

+            } catch (IOException e) {

+                throw new XMLStreamException(e);

+            }

+        }

+

+        /* (non-Javadoc)

+         * @see org.apache.axiom.om.OMDataSource#serialize(java.io.Writer, org.apache.axiom.om.OMOutputFormat)

+         */

+        public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException {

+            try {

+                writer.write(data);

+            } catch (IOException e) {

+                throw new XMLStreamException(e);

+            }

+        }

+

+        /* (non-Javadoc)

+         * @see org.apache.axiom.om.OMDataSource#serialize(javax.xml.stream.XMLStreamWriter)

+         */

+        public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {

+            StreamingOMSerializer serializer = new StreamingOMSerializer();

+            serializer.serialize(getReader(), xmlWriter);

+        }

+

+        /* (non-Javadoc)

+         * @see org.apache.axiom.om.OMDataSource#getReader()

+         */

+        public XMLStreamReader getReader() throws XMLStreamException {

+            XMLInputFactory inputFactory = XMLInputFactory.newInstance();

+            return inputFactory.createXMLStreamReader(new StringReader(data));

+        }

+    }

+}
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/mtom/MTOMStAXSOAPModelBuilderTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/mtom/MTOMStAXSOAPModelBuilderTest.java
new file mode 100644
index 0000000..9c46eae
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/mtom/MTOMStAXSOAPModelBuilderTest.java
@@ -0,0 +1,98 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.mtom;

+

+import org.apache.axiom.attachments.Attachments;

+import org.apache.axiom.om.AbstractTestCase;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMText;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.soap.SOAP12Constants;

+

+import javax.activation.DataHandler;

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLStreamReader;

+import java.io.BufferedReader;

+import java.io.FileInputStream;

+import java.io.InputStream;

+import java.io.InputStreamReader;

+import java.util.Iterator;

+

+public class MTOMStAXSOAPModelBuilderTest extends AbstractTestCase {

+    Attachments attachments;

+

+    String inFileName;

+

+    OMXMLParserWrapper builder;

+

+    /**

+     * @param testName

+     */

+    public MTOMStAXSOAPModelBuilderTest(String testName) {

+        super(testName);

+    }

+

+    String contentTypeString = "multipart/Related; type=\"application/xop+xml\"; boundary=\"----=_AxIs2_Def_boundary_=42214532\"; start=\"SOAPPart\"";

+

+    protected void setUp() throws Exception {

+        super.setUp();

+        inFileName = "mtom/MTOMBuilderTestIn.txt";

+        InputStream inStream = new FileInputStream(getTestResourceFile(inFileName));

+        attachments = new Attachments(inStream, contentTypeString);

+        XMLStreamReader reader = XMLInputFactory.newInstance()

+                .createXMLStreamReader(new BufferedReader(new InputStreamReader(attachments

+                .getSOAPPartInputStream())));

+        builder = new MTOMStAXSOAPModelBuilder(reader, attachments, SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);

+    }

+

+    public void testCreateOMElement() throws Exception {

+        OMElement root = builder.getDocumentElement();

+//        System.out.println(root.getLocalName() + " : "

+//                + root.getNamespace().getName());

+        OMElement body = (OMElement) root.getFirstOMChild();

+//        System.out.println(body.getLocalName() + " : "

+//                + body.getNamespace().getName());

+

+        OMElement data = (OMElement) body.getFirstOMChild();

+//        System.out.println(data.getLocalName() + " : "

+//                + data.getNamespace().getName());

+        Iterator childIt = data.getChildren();

+        //while (childIt.hasNext()) {

+        OMElement child = (OMElement) childIt.next();

+        OMText blob = (OMText) child.getFirstOMChild();

+        /*

+         * Following is the procedure the user has to follow to read objects in

+         * OBBlob User has to know the object type & whether it is serializable.

+         * If it is not he has to use a Custom Defined DataSource to get the

+         * Object.

+         */

+        byte[] expectedObject = new byte[]{13, 56, 65, 32, 12, 12, 7, -3, -2,

+                                           -1, 98};

+        DataHandler actualDH;

+        actualDH = (DataHandler)blob.getDataHandler();

+        //ByteArrayInputStream object = (ByteArrayInputStream) actualDH

+        //.getContent();

+        //byte[] actualObject= null;

+        //  object.read(actualObject,0,10);

+

+        //  assertEquals("Object check", expectedObject[5],actualObject[5] );

+    }

+

+    public void testGetDataHandler() {

+    }

+

+}
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/ElementSerializerTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/ElementSerializerTest.java
new file mode 100644
index 0000000..c6fc607
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/ElementSerializerTest.java
@@ -0,0 +1,132 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.serializer;

+

+import org.apache.axiom.om.AbstractTestCase;

+import org.apache.axiom.om.OMAbstractFactory;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMFactory;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMNode;

+import org.apache.axiom.om.OMText;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;

+import org.apache.axiom.soap.SOAPBody;

+import org.apache.axiom.soap.SOAPEnvelope;

+

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLOutputFactory;

+import javax.xml.stream.XMLStreamReader;

+import javax.xml.stream.XMLStreamWriter;

+import java.io.File;

+import java.io.FileOutputStream;

+import java.io.FileReader;

+

+public class ElementSerializerTest extends AbstractTestCase {

+    private XMLStreamReader reader;

+    private XMLStreamWriter writer;

+    private OMXMLParserWrapper builder;

+    private File tempFile;

+

+    public ElementSerializerTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        reader =

+                XMLInputFactory.newInstance().

+                createXMLStreamReader(

+                        new FileReader(

+                                getTestResourceFile("soap/soapmessage.xml")));

+        tempFile = File.createTempFile("temp", "xml");

+        writer = XMLOutputFactory.newInstance().

+                createXMLStreamWriter(new FileOutputStream(tempFile));

+        builder =

+                OMXMLBuilderFactory.createStAXSOAPModelBuilder(

+                        OMAbstractFactory.getSOAP11Factory(), reader);

+    }

+

+    public void testElementSerilization() throws Exception {

+        OMElement elt = builder.getDocumentElement();

+        elt.serialize(writer);

+

+    }

+

+    public void testElementSerilizationCacheOff() throws Exception {

+        OMElement elt = builder.getDocumentElement();

+        elt.serialize(writer);

+

+    }

+

+    public void testElementSerilizationChild() throws Exception {

+        OMElement elt = builder.getDocumentElement();

+        OMNode node = elt.getFirstOMChild().getNextOMSibling();

+        node.serialize(writer);

+

+    }

+

+    public void testElementSerilizationSOAPBodyCacheOff() throws Exception {

+        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();

+        OMNode node = env.getBody();

+        node.serialize(writer);

+    }

+

+    public void testElement() throws Exception {

+        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();

+        SOAPBody body = env.getBody();

+        body.serialize(writer);

+    }

+

+    public void testCompleteElement() throws Exception {

+        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();

+        env.serialize(writer);

+    }

+

+    public void testDualNamespaces1() throws Exception {

+        OMFactory factory = OMAbstractFactory.getOMFactory();

+        OMNamespace ns1 = factory.createOMNamespace("bar", "x");

+        OMNamespace ns2 = factory.createOMNamespace("bar", "y");

+        OMElement root = factory.createOMElement("root", ns1);

+        OMElement elt11 = factory.createOMElement("foo1", ns1);

+        OMElement elt12 = factory.createOMElement("foo2", ns1);

+        OMElement elt21 = factory.createOMElement("yuck", ns2);

+        OMElement elt22 = factory.createOMElement("yuck", ns2);

+        elt11.addChild(elt21);

+        elt12.addChild(elt22);

+        root.addChild(elt11);

+        root.addChild(elt12);

+        root.serialize(writer);

+    }

+

+    public void testDualNamespaces2() throws Exception {

+        OMFactory factory = OMAbstractFactory.getOMFactory();

+        OMNamespace ns1 = factory.createOMNamespace("bar", "x");

+        OMElement root = factory.createOMElement("root", ns1);

+        OMNamespace ns2 = root.declareNamespace("bar", "y");

+        OMElement elt1 = factory.createOMElement("foo", ns1);

+        OMElement elt2 = factory.createOMElement("yuck", ns2);

+        OMText txt1 = factory.createOMText(elt2, "blah");

+        elt2.addChild(txt1);

+        elt1.addChild(elt2);

+        root.addChild(elt1);

+        root.serialize(writer);

+    }

+

+    protected void tearDown() throws Exception {

+        tempFile.delete();

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/NoNamespaceSerializerTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/NoNamespaceSerializerTest.java
new file mode 100644
index 0000000..890e8ac
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/NoNamespaceSerializerTest.java
@@ -0,0 +1,152 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.serializer;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStreamReader;
+
+public class NoNamespaceSerializerTest extends TestCase {
+
+    private String xmlTextOne = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
+            "<soapenv:Body>\n" +
+            "   <ns1:getBalance xmlns:ns1=\"http://localhost:8081/axis/services/BankPort/\">\n" +
+            "      <accountNo href=\"#id0\"/>\n" +
+            "   </ns1:getBalance>\n" +
+            " </soapenv:Body></soapenv:Envelope>";
+
+    private String xmlText2 = "<purchase-order xmlns=\"http://openuri.org/easypo\">\n" +
+            "  <customer>\n" +
+            "    <name>Gladys Kravitz</name>\n" +
+            "    <address>Anytown, PA</address>\n" +
+            "  </customer>\n" +
+            "  <date>2005-03-06T14:06:12.697+06:00</date>\n" +
+            "</purchase-order>";
+
+    private String xmlTextTwo = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
+            "<soapenv:Body>\n" +
+            "   <getBalance xmlns=\"http://localhost:8081/axis/services/BankPort/\">\n" +
+            "      <accountNo href=\"#id0\"/>\n" +
+            "   </getBalance>\n" +
+            " </soapenv:Body></soapenv:Envelope>";
+
+    private XMLStreamReader readerOne;
+    private XMLStreamReader readerTwo;
+    private XMLStreamWriter writer;
+
+    // private OMXMLParserWrapper builder;
+    // private File tempFile;
+
+    private OMXMLParserWrapper builderOne;
+    private OMXMLParserWrapper builderTwo;
+    // private File tempFile;
+
+
+
+    protected void setUp() throws Exception {
+        readerOne =
+                XMLInputFactory.newInstance().
+                createXMLStreamReader(
+                        new InputStreamReader(
+                                new ByteArrayInputStream(xmlTextOne.getBytes())));
+        readerTwo =
+                XMLInputFactory.newInstance().
+                createXMLStreamReader(
+                        new InputStreamReader(
+                                new ByteArrayInputStream(xmlTextTwo.getBytes())));
+        writer = XMLOutputFactory.newInstance().
+                createXMLStreamWriter(new ByteArrayOutputStream());
+        builderOne =
+                OMXMLBuilderFactory.createStAXSOAPModelBuilder(
+                        OMAbstractFactory.getSOAP11Factory(), readerOne);
+        builderTwo =
+                OMXMLBuilderFactory.createStAXSOAPModelBuilder(
+                        OMAbstractFactory.getSOAP11Factory(), readerTwo);
+    }
+
+    public void testSerilizationWithDefaultNamespaces() throws Exception {
+        SOAPEnvelope env = (SOAPEnvelope) builderTwo.getDocumentElement();
+        env.serialize(writer);
+        OMElement balanceElement = env.getBody().getFirstElement();
+        assertEquals("Deafualt namespace has not been set properly",
+                balanceElement.getNamespace().getNamespaceURI(),
+                "http://localhost:8081/axis/services/BankPort/");
+
+        OMElement accountNo = balanceElement.getFirstElement();
+        assertEquals(
+                "Deafualt namespace of children has not been set properly",
+                accountNo.getNamespace().getNamespaceURI(),
+                "http://localhost:8081/axis/services/BankPort/");
+
+    }
+
+    public void submitPurchaseOrderTest()
+            throws Exception {
+        SOAPFactory omFactory = OMAbstractFactory.getSOAP11Factory();
+        SOAPEnvelope env = omFactory.getDefaultEnvelope();
+        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(
+                omFactory,
+                XMLInputFactory.newInstance().
+                createXMLStreamReader(
+                        new InputStreamReader(
+                                new ByteArrayInputStream(xmlText2.getBytes()))));
+        env.getBody().addChild(builder.getDocumentElement());
+
+        // not sure why this test was created. Just checking whether serialization has worked or not. Someone
+        // wanna check the correct thing later?
+        String outputString = env.toString();
+        assertTrue(outputString != null && !"".equals(outputString) && outputString.length() > 1);
+    }
+
+    /**
+     * Will just do a probe test to check serialize with caching on works without any exception
+     */
+    public void testSerilizationWithCacheOn() throws Exception {
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+        writer = XMLOutputFactory.newInstance().
+                createXMLStreamWriter(byteArrayOutputStream);
+
+        SOAPEnvelope env = (SOAPEnvelope) builderOne.getDocumentElement();
+        env.serialize(writer);
+        writer.flush();
+        assertTrue(new String(byteArrayOutputStream.toByteArray()).length() > 1);
+    }
+
+    /**
+     * Will just do a probe test to check serialize with caching off works without any exception
+     */
+    public void testSerilizationWithCacheOff() throws Exception {
+        writer = XMLOutputFactory.newInstance().
+                createXMLStreamWriter(new ByteArrayOutputStream());
+
+        SOAPEnvelope env = (SOAPEnvelope) builderOne.getDocumentElement();
+        env.serializeAndConsume(writer);
+        writer.flush();
+    }
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMFaultSerializerTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMFaultSerializerTest.java
new file mode 100644
index 0000000..d2aa8e6
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMFaultSerializerTest.java
@@ -0,0 +1,73 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.serializer;

+

+import org.apache.axiom.om.AbstractTestCase;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;

+

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLStreamReader;

+import java.io.FileReader;

+

+public class OMFaultSerializerTest extends AbstractTestCase {

+    private XMLStreamReader reader1;

+    private XMLStreamReader reader2;

+

+    public OMFaultSerializerTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        reader1 =

+                XMLInputFactory.newInstance().

+                        createXMLStreamReader(

+                                new FileReader(

+                                        getTestResourceFile("soap/soap11/soapfault1.xml")));

+        reader2 =

+            XMLInputFactory.newInstance().

+                    createXMLStreamReader(

+                            new FileReader(

+                                    getTestResourceFile("soap/soap11/soapfault2.xml")));

+

+    }

+

+    /**

+     * Test SOAPFault that does not disable the default namespace

+     * (i.e. does not use xmlns="")

+     *

+     * @throws Exception

+     */

+    public void test1() throws Exception {

+    	StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(reader1, null);

+        OMElement ome = builder.getDocumentElement();

+        ome.toString();

+//        System.out.println(ome);

+    }

+    /**

+     * Test SOAPFault that does disable the default namespace

+     * (i.e. does use xmlns="")

+     * @throws Exception

+     */

+    public void test2() throws Exception {

+    	StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(reader2, null);

+        OMElement ome = builder.getDocumentElement();

+        ome.toString();

+//        System.out.println(ome);

+    }

+}

+    
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMSerializerTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMSerializerTest.java
new file mode 100644
index 0000000..6f64b5e
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/OMSerializerTest.java
@@ -0,0 +1,144 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.serializer;

+

+import org.apache.axiom.om.AbstractTestCase;

+import org.apache.axiom.om.OMAbstractFactory;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;

+import org.apache.axiom.om.impl.serialize.StreamingOMSerializer;

+import org.apache.axiom.soap.SOAPBody;

+import org.apache.axiom.soap.SOAPEnvelope;

+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;

+

+import javax.xml.stream.*;

+import java.io.*;

+

+public class OMSerializerTest extends AbstractTestCase {

+    private XMLStreamReader reader;

+    private XMLStreamWriter writer;

+    private File tempFile;

+

+    public OMSerializerTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        reader =

+                XMLInputFactory.newInstance().

+                        createXMLStreamReader(

+                                new FileReader(

+                                        getTestResourceFile("soap/soapmessage.xml")));

+        tempFile = File.createTempFile("temp", "xml");

+//        writer =

+//                XMLOutputFactory.newInstance().

+//                        createXMLStreamWriter(new FileOutputStream(tempFile));

+

+

+    }

+

+    public void testRawSerializer() throws Exception {

+        StreamingOMSerializer serializer = new StreamingOMSerializer();

+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();

+        writer =

+                XMLOutputFactory.newInstance().

+                        createXMLStreamWriter(byteArrayOutputStream);

+        //serializer.setNamespacePrefixStack(new Stack());

+        serializer.serialize(reader, writer);

+        writer.flush();

+

+        String outputString = new String(byteArrayOutputStream.toByteArray());

+        assertTrue(outputString != null && !"".equals(outputString) && outputString.length() > 1);

+

+    }

+

+    public void testElementPullStream1() throws Exception {

+        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(

+                OMAbstractFactory.getSOAP11Factory(),

+                reader);

+        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();

+        StreamingOMSerializer serializer = new StreamingOMSerializer();

+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();

+        writer =

+                XMLOutputFactory.newInstance().

+                        createXMLStreamWriter(byteArrayOutputStream);

+

+        serializer.serialize(env.getXMLStreamReaderWithoutCaching(), writer);

+        writer.flush();

+

+        String outputString = new String(byteArrayOutputStream.toByteArray());

+        assertTrue(outputString != null && !"".equals(outputString) && outputString.length() > 1);

+    }

+

+    public void testElementPullStream1WithCacheOff() throws Exception {

+

+        StAXSOAPModelBuilder soapBuilder = new StAXSOAPModelBuilder(reader, null);

+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();

+        writer =

+                XMLOutputFactory.newInstance().

+                        createXMLStreamWriter(byteArrayOutputStream);

+

+        SOAPEnvelope env = (SOAPEnvelope) soapBuilder.getDocumentElement();

+        env.serializeAndConsume(writer);

+        writer.flush();

+

+        String outputString = new String(byteArrayOutputStream.toByteArray());

+        assertTrue(outputString != null && !"".equals(outputString) && outputString.length() > 1);

+

+        writer =

+                XMLOutputFactory.newInstance().

+                        createXMLStreamWriter(byteArrayOutputStream);

+

+        StringWriter stringWriter = new StringWriter();

+

+        //now we should not be able to serilaize anything ! this should throw

+        //an error

+        try {

+            env.serializeAndConsume(writer);

+            fail();

+        } catch (XMLStreamException e) {

+            e.printStackTrace(new PrintWriter(stringWriter, true));

+            assertTrue(stringWriter.toString().indexOf("problem accessing the parser. Parser already accessed!") > -1);

+        } catch (Exception e) {

+            fail("Expecting an XMLStreamException " + e.getMessage());

+        }

+    }

+

+    public void testElementPullStream2() throws Exception {

+        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(

+                OMAbstractFactory.getSOAP11Factory(),

+                reader);

+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();

+        writer =

+                XMLOutputFactory.newInstance().

+                        createXMLStreamWriter(byteArrayOutputStream);

+

+        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();

+        SOAPBody body = env.getBody();

+        StreamingOMSerializer serializer = new StreamingOMSerializer();

+        serializer.serialize(body.getXMLStreamReaderWithoutCaching(),

+                writer);

+        writer.flush();

+

+        String outputString = new String(byteArrayOutputStream.toByteArray());

+        assertTrue(outputString != null && !"".equals(outputString) && outputString.length() > 1);

+    }

+

+    protected void tearDown() throws Exception {

+        tempFile.delete();

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/PreserveEnvelopeTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/PreserveEnvelopeTest.java
new file mode 100644
index 0000000..669236f
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/serializer/PreserveEnvelopeTest.java
@@ -0,0 +1,99 @@
+package org.apache.axiom.om.impl.serializer;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.custommonkey.xmlunit.XMLTestCase;
+
+import javax.xml.stream.XMLStreamException;
+import java.io.ByteArrayInputStream;
+
+	public class PreserveEnvelopeTest extends XMLTestCase{
+
+		
+		 private String originalXML = "<Assertion xmlns=\"urn:oasis:names:tc:SAML:1.0:assertion\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" AssertionID=\"ef98507718ea606c6ae1e89d2c0865ee\" IssueInstant=\"2006-01-03T15:09:35.164Z\" Issuer=\"C=US,O=National Center for Supercomputing Applications,CN=Hemapani Srinath Perera\" MajorVersion=\"1\" MinorVersion=\"1\"><Conditions NotBefore=\"2006-01-03T15:09:35.164Z\" NotOnOrAfter=\"2006-01-03T15:39:35.164Z\"><AudienceRestrictionCondition><Audience>http://www.extreme.indiana.edu/lead/TestCMD_Simple_Tue_Jan_03_10_09_27_EST_2006_142825</Audience></AudienceRestrictionCondition></Conditions><AuthorizationDecisionStatement Decision=\"Permit\" Resource=\"http://www.extreme.indiana.edu/lead/TestCMD_Simple_Tue_Jan_03_10_09_27_EST_2006_142825\"><Subject><NameIdentifier>/C=US/O=Indiana University/OU=Computer Science/CN=Hemapani Srinath Perera</NameIdentifier><SubjectConfirmation><ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:bearer</ConfirmationMethod></SubjectConfirmation></Subject><Action Namespace=\"http://www.extreme.indiana.edu/lead\">Run</Action></AuthorizationDecisionStatement><ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\n" +
+	     "<ds:SignedInfo>\n" +
+	     "<ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"></ds:CanonicalizationMethod>\n" +
+	     "<ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"></ds:SignatureMethod>\n" +
+	     "<ds:Reference URI=\"#ef98507718ea606c6ae1e89d2c0865ee\">\n" +
+	     "<ds:Transforms>\n" +
+	     "<ds:Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\"></ds:Transform>\n" +
+	     "<ds:Transform Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"><ec:InclusiveNamespaces xmlns:ec=\"http://www.w3.org/2001/10/xml-exc-c14n#\" PrefixList=\"code ds kind rw saml samlp typens #default\"></ec:InclusiveNamespaces></ds:Transform>\n" +
+	     "</ds:Transforms>\n" +
+	     "<ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"></ds:DigestMethod>\n" +
+	     "<ds:DigestValue>0bqebD+zkADcbXleyxpFUySp7cY=</ds:DigestValue>\n" +
+	     "</ds:Reference>\n" +
+	     "</ds:SignedInfo>\n" +
+	     "<ds:SignatureValue>\n" +
+	     "HVZDR4InypCICJxbCSrZJsikcpSACZRTt5Ly2gfLBUpdVeq6koHAKo8WGrGHbZVzNFAmxj3i52jQ\n" +
+	     "aYeO0J6LIA==\n" +
+	     "</ds:SignatureValue>\n" +
+	     "<ds:KeyInfo>\n" +
+	     "<ds:X509Data>\n" +
+	     "<ds:X509Certificate>\n" +
+	     "MIIClDCCAXygAwIBAwICBEkwDQYJKoZIhvcNAQEEBQAwaTELMAkGA1UEBhMCVVMxODA2BgNVBAoT\n" +
+	     "L05hdGlvbmFsIENlbnRlciBmb3IgU3VwZXJjb21wdXRpbmcgQXBwbGljYXRpb25zMSAwHgYDVQQD\n" +
+	     "ExdIZW1hcGFuaSBTcmluYXRoIFBlcmVyYTAeFw0wNjAxMDMxNDM2MTFaFw0wNjAxMDQwMjQxMTFa\n" +
+	     "MHkxCzAJBgNVBAYTAlVTMTgwNgYDVQQKEy9OYXRpb25hbCBDZW50ZXIgZm9yIFN1cGVyY29tcHV0\n" +
+	     "aW5nIEFwcGxpY2F0aW9uczEgMB4GA1UEAxMXSGVtYXBhbmkgU3JpbmF0aCBQZXJlcmExDjAMBgNV\n" +
+	     "BAMTBXByb3h5MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALyBo53oJTrVjs/RCFLJaMKektAqeNCi\n" +
+	     "IAhEx+pE0BxL23WV8mhxUNDJevO7lkRuwuDWchbobq8S1WNRYrbOqRkCAwEAATANBgkqhkiG9w0B\n" +
+	     "AQQFAAOCAQEAEZRsxz1izBa8SNw7x1nCttjTDnRM102CTad/uq3vihKmOauBo8lFqklT2xoFv+Nx\n" +
+	     "WX1FXT5AAqedITtUn99zk3Sr5c/SgdO59NxSaWgqxTOd7koZUmz8Sta9IK7d1fDFhDie2W2EtUMk\n" +
+	     "QX0Rr7KHReF6a0knQ+kGlhDuA2YN27CpNg+gBTq0+p1yaVA79qf2BVDYBklPG2N5tWn2GekHoUMs\n" +
+	     "7nlU9WlUI0tRUKuGGdQ+2WLTW0w2UuqsJuHvDaquZRnTOjhdiRw5/Mg62LqkSwo99Dc3JiJusqoY\n" +
+	     "16Unq8wp5gVJbj36UoVvqnVOyBltseIaU5bLS5LIrv11hXA6fg==\n" +
+	     "</ds:X509Certificate>\n" +
+	     "<ds:X509Certificate>\n" +
+	     "MIIEVzCCAz+gAwIBAgICBEkwDQYJKoZIhvcNAQEEBQAwaTELMAkGA1UEBhMCVVMxODA2BgNVBAoT\n" +
+	     "L05hdGlvbmFsIENlbnRlciBmb3IgU3VwZXJjb21wdXRpbmcgQXBwbGljYXRpb25zMSAwHgYDVQQD\n" +
+	     "ExdDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNTEwMjUxOTMxMzRaFw0wNzEwMjUxOTMxMzRa\n" +
+	     "MGkxCzAJBgNVBAYTAlVTMTgwNgYDVQQKEy9OYXRpb25hbCBDZW50ZXIgZm9yIFN1cGVyY29tcHV0\n" +
+	     "aW5nIEFwcGxpY2F0aW9uczEgMB4GA1UEAxMXSGVtYXBhbmkgU3JpbmF0aCBQZXJlcmEwggEiMA0G\n" +
+	     "CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC/pkVn4ZUEM5BjfocwiiQVF4ivFpJJ8u1m8vq0WNlc\n" +
+	     "bw4rjMOet1YArC46fZ1Gg652A1dF92+8hHNeBa6chll5HRZkx5FLN7XEGY4EcHhXA6lHmjklpf8N\n" +
+	     "Iy6/91ElOT1pVoLRpOeJ1TFT/nQxMBMJbMyhycrUV49M8oL3O/CYAm1YVQjCtdieK/ibFXzgP2iX\n" +
+	     "R8oOrAX/Ogp+FilUkdrZlhhhzV/NdGdQrPQxxpWbXsLOgiyEU4W1BWSHHI1E1cs0KUoYvaboAYaq\n" +
+	     "E+0WZlhqDxQy3SKOZVPYk9fJu9+qAb0gaDIgtN4FrZFYvTrlNMcrmyaC2ozr43nxwVMlq9dnAgMB\n" +
+	     "AAGjggEHMIIBAzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIE8DAdBgNVHQ4EFgQU90FgTLg4k1yN3yJu\n" +
+	     "d4TZIbxUGigwgZMGA1UdIwSBizCBiIAU8r6NqmFJES25W3IkKhjSwoXGmIGhbaRrMGkxCzAJBgNV\n" +
+	     "BAYTAlVTMTgwNgYDVQQKEy9OYXRpb25hbCBDZW50ZXIgZm9yIFN1cGVyY29tcHV0aW5nIEFwcGxp\n" +
+	     "Y2F0aW9uczEgMB4GA1UEAxMXQ2VydGlmaWNhdGlvbiBBdXRob3JpdHmCAQAwNAYDVR0fBC0wKzAp\n" +
+	     "oCegJYYjaHR0cDovL2NhLm5jc2EudWl1Yy5lZHUvNGE2Y2Q4YjEucjAwDQYJKoZIhvcNAQEEBQAD\n" +
+	     "ggEBAHnFMFeZTHjuq/juH3qw1jDrr4IuKnljuLHWSi8GuMt1mxOs/vR7rMg0OAs16gMJP3X2uSK5\n" +
+	     "0miXqsbZ4AQuBJqo5Pm8UaSzeJlBle02SUvt2Fxhze9odLgoUXHp/1hKm9blHbp5cZqlbsmckk8y\n" +
+	     "4xOPgNYh1G3oxdv2OcadmJBMlYwcBK+TkO8GbemqXqdFt6itGkkhLGQdspw9c1r38bXd9lhLbVR8\n" +
+	     "7yif8ffqIgouVe/wj3NIjSbxgjff88Hz6CCuOWiafvfpgmrU906yOZqe6jBDBTKF5xmqyCNKKFAJ\n" +
+	     "UbmPCX2vMKCpWrLU+MotR2HSbljslSUhfKCjHvFb/AA=\n" +
+	     "</ds:X509Certificate>\n" +
+	     "</ds:X509Data>\n" +
+	     "</ds:KeyInfo></ds:Signature></Assertion>";
+
+
+		 
+		 public void testOMNS() {
+		        try {
+		        	StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(originalXML.getBytes()));
+		            OMElement documentElement = builder.getDocumentElement();
+		            //assertXMLEqual(originalXML, documentElement.toString());
+		            documentElement.build();
+
+                    String outstr  = documentElement.toString();
+                    assertTrue(outstr.indexOf("xmlns:saml=") > 0);
+		            assertTrue(outstr.indexOf("<Assertion") == 0);
+		            
+		        } catch (XMLStreamException e) {
+		            e.printStackTrace();
+
+		        }
+		    }
+
+        
+
+
+
+    }
+
+
+
+
+
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
new file mode 100644
index 0000000..e51f8ad
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/streamwrapper/OMStaxStreamingWrapperTest.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axiom.om.impl.streamwrapper;
+
+import org.apache.axiom.om.AbstractTestCase;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import java.io.File;
+import java.io.FileReader;
+
+public class OMStaxStreamingWrapperTest extends AbstractTestCase {
+    private SOAPEnvelope envelope = null;
+    private File tempFile;
+    private XMLStreamReader parser;
+
+    public OMStaxStreamingWrapperTest(String testName) {
+        super(testName);
+    }
+
+    protected void setUp() throws Exception {
+        XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().
+                createXMLStreamReader(
+                        new FileReader(
+                                getTestResourceFile("soap/soapmessage1.xml")));
+        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(
+                OMAbstractFactory.getSOAP11Factory(), xmlStreamReader);
+        envelope = (SOAPEnvelope) builder.getDocumentElement();
+        tempFile = File.createTempFile("temp", "xml");
+
+    }
+
+    public void testWrapperHalfOM() throws Exception {
+        assertNotNull(envelope);
+        parser = envelope.getXMLStreamReaderWithoutCaching();
+        while (parser.hasNext()) {
+            int event = parser.next();
+            assertTrue(event > 0);
+        }
+    }
+
+    protected void tearDown() throws Exception {
+        tempFile.delete();
+    }
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/streamwrapper/OmStAXBuilderTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/streamwrapper/OmStAXBuilderTest.java
new file mode 100644
index 0000000..85456ab
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/streamwrapper/OmStAXBuilderTest.java
@@ -0,0 +1,66 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.streamwrapper;

+

+import org.apache.axiom.om.AbstractTestCase;

+import org.apache.axiom.om.OMAbstractFactory;

+import org.apache.axiom.om.OMXMLParserWrapper;

+import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;

+import org.apache.axiom.soap.SOAPEnvelope;

+import org.apache.axiom.soap.SOAPFactory;

+

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLStreamReader;

+import java.io.File;

+import java.io.FileOutputStream;

+import java.io.FileReader;

+

+public class OmStAXBuilderTest extends AbstractTestCase {

+    private SOAPFactory factory = null;

+    private OMXMLParserWrapper builder;

+    private File tempFile;

+

+    public OmStAXBuilderTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        factory = OMAbstractFactory.getSOAP11Factory();

+        XMLStreamReader reader = XMLInputFactory.newInstance().

+                createXMLStreamReader(

+                        new FileReader(

+                                getTestResourceFile("soap/soapmessage.xml")));

+        builder =

+                OMXMLBuilderFactory.createStAXSOAPModelBuilder(factory,

+                        reader);

+        tempFile = File.createTempFile("temp", "xml");

+    }

+

+    public void testStaxBuilder() throws Exception {

+        SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();

+        assertNotNull(envelope);

+        envelope.serialize(new FileOutputStream(tempFile));

+

+

+    }

+

+    protected void tearDown() throws Exception {

+        tempFile.delete();

+    }

+

+

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/traverse/OMChildrenWithSpecificAttributeIteratorTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/traverse/OMChildrenWithSpecificAttributeIteratorTest.java
new file mode 100644
index 0000000..f08b512
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/impl/traverse/OMChildrenWithSpecificAttributeIteratorTest.java
@@ -0,0 +1,108 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.impl.traverse;

+

+import junit.framework.TestCase;

+import org.apache.axiom.om.OMAbstractFactory;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMFactory;

+import org.apache.axiom.om.OMNamespace;

+

+import javax.xml.namespace.QName;

+import java.util.Iterator;

+

+public class OMChildrenWithSpecificAttributeIteratorTest extends TestCase {

+

+    public OMChildrenWithSpecificAttributeIteratorTest(String testName) {

+        super(testName);

+    }

+

+    public void testChildrenRetrievalWithDetaching() {

+

+        OMFactory factory = OMAbstractFactory.getOMFactory();

+        OMNamespace testNamespace = factory.createOMNamespace("http://test.ws.org", "test");

+        OMElement documentElement = getSampleDocumentElement(testNamespace);

+

+        Iterator childrenIter = new OMChildrenWithSpecificAttributeIterator(

+                documentElement.getFirstOMChild(), new QName(testNamespace.getNamespaceURI(), "myAttr",

+                testNamespace.getPrefix()), "Axis2", true);

+

+        int childCount = getChidrenCount(childrenIter);

+        assertEquals("Iterator must return 5 children with the given attribute", childCount, 5);

+

+        Iterator children = documentElement.getChildren();

+        childCount = getChidrenCount(children);

+        assertEquals("Iterator must return only one child, having detached the other children", childCount, 1);

+

+    }

+

+    public void testChildrenRetrievalWithNoDetaching() {

+

+        OMFactory factory = OMAbstractFactory.getOMFactory();

+        OMNamespace testNamespace = factory.createOMNamespace("http://test.ws.org", "test");

+        OMElement documentElement = getSampleDocumentElement(testNamespace);

+

+        Iterator childrenIter = new OMChildrenWithSpecificAttributeIterator(

+                documentElement.getFirstOMChild(), new QName(testNamespace.getNamespaceURI(), "myAttr",

+                testNamespace.getPrefix()), "Axis2", false);

+

+        int childCount = getChidrenCount(childrenIter);

+        assertEquals("Iterator must return 5 children with the given attribute", childCount, 5);

+

+        Iterator children = documentElement.getChildren();

+        childCount = getChidrenCount(children);

+        assertEquals("Iterator must return 6 children, having not detached the children", childCount, 6);

+

+    }

+

+    private OMElement getSampleDocumentElement(OMNamespace testNamespace){

+        OMFactory factory = OMAbstractFactory.getOMFactory();

+

+        OMElement documentElement = factory.createOMElement("Employees", testNamespace);

+        documentElement.declareNamespace(testNamespace);

+

+        OMElement employee;

+        OMElement name;

+

+        for (int i = 0; i < 5; i++) {

+            employee = factory.createOMElement("Employee", testNamespace, documentElement);

+            name = factory.createOMElement("Name"+i, testNamespace);

+            employee.addAttribute("myAttr", "Axis2", testNamespace);

+            name.setText("Apache Developer");

+            employee.addChild(name);

+        }

+

+        //adding one more child with the given attr

+        employee = factory.createOMElement("Employee", testNamespace, documentElement);

+        name = factory.createOMElement("Name", testNamespace);

+        name.addAttribute("myAttr", "Un-Related Value", testNamespace);

+        name.setText("Apache Developer");

+        employee.addChild(name);

+

+        return documentElement;

+    }

+

+    private int getChidrenCount(Iterator childrenIter) {

+        int childCount = 0;

+        while (childrenIter.hasNext()) {

+        	childrenIter.next();

+            childCount++;

+        }

+

+        return childCount;

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/infoset/XMLConformanceTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/infoset/XMLConformanceTest.java
new file mode 100644
index 0000000..6804512
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/infoset/XMLConformanceTest.java
@@ -0,0 +1,53 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.infoset;

+

+import junit.framework.Test;

+import junit.framework.TestCase;

+import junit.framework.TestSuite;

+

+import java.io.File;

+

+public class XMLConformanceTest extends TestCase {

+

+    public static Test suite() throws Exception {

+        TestSuite suite = new TestSuite();

+

+        File testSuiteDirectory = new File("test-resources/XMLSuite/xmlconf");

+        if (testSuiteDirectory.exists()) {

+            ProcessDir(testSuiteDirectory, suite);

+        }

+        return suite;

+    }

+

+    private static void ProcessDir(File dir, TestSuite suite) throws Exception {

+        if (dir.isDirectory()) {

+            //process all children

+            String[] children = dir.list();

+            for (int i = 0; i < children.length; i++) {

+                File child = (new File(dir, children[i]));

+                ProcessDir(child, suite);

+            }

+        } else {

+            //check if it's xml file

+            String absPath = dir.getAbsolutePath();

+            if (absPath.endsWith(".xml")) {

+                suite.addTest(new XMLConformanceUnit(absPath, "testSingleFileConformance"));

+            }

+        }

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/infoset/XMLConformanceUnit.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/infoset/XMLConformanceUnit.java
new file mode 100644
index 0000000..a566b4f
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/infoset/XMLConformanceUnit.java
@@ -0,0 +1,109 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.om.infoset;

+

+import org.apache.axiom.om.OMAbstractFactory;

+import org.apache.axiom.om.OMDocument;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.impl.builder.StAXOMBuilder;

+import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;

+import org.custommonkey.xmlunit.Diff;

+import org.custommonkey.xmlunit.XMLTestCase;

+import org.w3c.dom.Document;

+import org.xml.sax.EntityResolver;

+import org.xml.sax.InputSource;

+import org.xml.sax.SAXException;

+

+import javax.xml.parsers.DocumentBuilder;

+import javax.xml.parsers.DocumentBuilderFactory;

+import javax.xml.parsers.ParserConfigurationException;

+import javax.xml.stream.XMLInputFactory;

+import java.io.ByteArrayInputStream;

+import java.io.ByteArrayOutputStream;

+import java.io.File;

+import java.io.FileInputStream;

+import java.io.FileReader;

+import java.io.IOException;

+import java.io.InputStreamReader;

+

+public class XMLConformanceUnit extends XMLTestCase implements EntityResolver {

+

+    private String filePath;

+    private File directory;

+

+    public XMLConformanceUnit(String filePath, String testName) {

+        super(testName);

+        this.filePath = filePath;

+        this.directory = new File(filePath).getParentFile();

+    }

+

+    public void testSingleFileConformance()

+            throws Exception {

+        OMElement rootElement;

+

+        System.out.println("XML File:" + filePath);

+        XMLInputFactory factory = XMLInputFactory.newInstance();

+//        factory.setProperty("report-cdata-event", Boolean.TRUE);

+        StAXOMBuilder staxOMBuilder = OMXMLBuilderFactory.

+                createStAXOMBuilder(OMAbstractFactory.getOMFactory(),

+                        factory.createXMLStreamReader(

+                                new FileInputStream(filePath)));

+        rootElement = staxOMBuilder.getDocumentElement();

+

+        ByteArrayOutputStream baos = new ByteArrayOutputStream();

+        ((OMDocument)rootElement.getParent()).serialize(baos);

+

+        InputSource resultXML = new InputSource(new InputStreamReader(

+                new ByteArrayInputStream(baos.toByteArray())));

+

+        Document dom1 = newDocument(new InputSource(new FileReader(filePath)));

+        Document dom2 = newDocument(resultXML);

+

+        Diff diff = compareXML(dom1, dom2);

+        assertXMLEqual(diff, true);

+    }

+

+    /**

+     * Method newDocument

+     *

+     * @param in

+     * @throws javax.xml.parsers.ParserConfigurationException

+     *

+     * @throws org.xml.sax.SAXException

+     * @throws java.io.IOException

+     */

+    public Document newDocument(InputSource in)

+            throws ParserConfigurationException, SAXException, IOException {

+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

+        dbf.setNamespaceAware(true);

+        DocumentBuilder db = dbf.newDocumentBuilder();

+        db.setEntityResolver(this);

+        return db.parse(in);

+    }

+

+    public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {

+        File f = new File(directory, systemId.substring(systemId.lastIndexOf('/')));

+        return new InputSource(new FileInputStream(f));

+    }

+

+    public String getName() {

+        String name = filePath;

+        if(name.lastIndexOf("xmlconf")!=-1)

+            name = name.substring(name.lastIndexOf("xmlconf"));

+        return name.replace('\\','/');

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/OMElementHelperTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/OMElementHelperTest.java
new file mode 100644
index 0000000..7eec40e
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/util/OMElementHelperTest.java
@@ -0,0 +1,57 @@
+package org.apache.axiom.om.util;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.impl.dom.DOOMAbstractFactory;
+import org.custommonkey.xmlunit.XMLTestCase;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class OMElementHelperTest extends XMLTestCase {
+
+    private String testXMLFilePath = "test-resources/soap/soapmessage.xml";
+
+
+
+    public void testImportOMElement() {
+        try {
+            XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance().createXMLStreamReader(new FileInputStream(testXMLFilePath));
+            OMElement documentElement = new StAXOMBuilder(OMAbstractFactory.getOMFactory(), xmlStreamReader).getDocumentElement();
+
+            // first lets try to import an element created from llom in to llom factory. This should return the same element
+            assertTrue(ElementHelper.importOMElement(documentElement, OMAbstractFactory.getOMFactory()) == documentElement);
+
+            // then lets pass in an OMElement created using llom and pass DOOMFactory
+            OMElement importedElement = ElementHelper.importOMElement(documentElement, DOOMAbstractFactory.getOMFactory());
+            assertTrue(importedElement != documentElement);
+            assertTrue(importedElement.getOMFactory().getClass().isInstance(DOOMAbstractFactory.getOMFactory()));
+
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+            fail();
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPBodyTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPBodyTest.java
new file mode 100644
index 0000000..0ffd622
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPBodyTest.java
@@ -0,0 +1,154 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMException;

+

+public class SOAPBodyTest extends SOAPBodyTestCase {

+

+    public SOAPBodyTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+    }

+

+    //SOAP 1.1 Body Test (Programaticaly created)----------------------------------------------------------------------------------

+    public void testSOAP11AddFault1() {

+        soap11Body.addFault(new Exception("This an exception for testing"));

+        assertTrue(

+                "SOAP 1.1 Body Test:- After calling addFault method, SOAP body has no fault",

+                soap11Body.hasFault());

+

+    }

+

+    public void testSOAP11addFault2() {

+        soap11Body.addFault(soap11Factory.createSOAPFault(soap11Body));

+        assertTrue(

+                "SOAP 1.1 Body Test:- After calling addFault method, SOAP body has no fault",

+                soap11Body.hasFault());

+

+

+    }

+

+    public void testSOAP11HasFault() {

+        assertFalse(

+                "SOAP 1.1 Body Test:- After creating a soap body it has a fault",

+                soap11Body.hasFault());

+        soap11Body.addFault(new Exception("This an exception for testing"));

+        assertTrue(

+                "SOAP 1.1 Body Test:- After calling addFault method, hasFault method returns false",

+                soap11Body.hasFault());

+    }

+

+    public void testSOAP11GetFault() {

+        assertTrue(

+                "SOAP 1.1 Body Test:- After creating a soap body it has a fault",

+                soap11Body.getFault() == null);

+        soap11Body.addFault(new Exception("This an exception for testing"));

+        assertFalse(

+                "SOAP 1.1 Body Test:- After calling addFault method, getFault method returns null",

+                soap11Body.getFault() == null);

+    }

+

+    //SOAP 1.2 Body Test (Programaticaly Created)----------------------------------------------------------------------------------

+    public void testSOAP12AddFault1() {

+        soap12Body.addFault(new Exception("This an exception for testing"));

+        assertTrue(

+                "SOAP 1.2 Body Test:- After calling addFault method, SOAP body has no fault",

+                soap12Body.hasFault());

+

+    }

+

+    public void testSOAP12AddFault2() {

+        soap12Body.addFault(soap12Factory.createSOAPFault(soap12Body));

+        assertTrue(

+                "SOAP 1.2 Body Test:- After calling addFault method, SOAP body has no fault",

+                soap12Body.hasFault());

+    }

+

+    public void testSOAP12HasFault() {

+        assertFalse(

+                "SOAP 1.2 Body Test:- After creating a soap body it has a fault",

+                soap12Body.hasFault());

+        soap12Body.addFault(new Exception("This an exception for testing"));

+        assertTrue(

+                "SOAP 1.2 Body Test:- After calling addFault method, hasFault method returns false",

+                soap12Body.hasFault());

+    }

+

+    public void testSOAP12GetFault() {

+        assertTrue(

+                "SOAP 1.2 Body Test:- After creating a soap body it has a fault",

+                soap12Body.getFault() == null);

+        soap12Body.addFault(new Exception("This an exception for testing"));

+        assertFalse(

+                "SOAP 1.2 Body Test:- After calling addFault method, getFault method returns null",

+                soap12Body.getFault() == null);

+    }

+

+    //SOAP 1.1 Body Test (With Parser)-------------------------------------------------------------------------------------------

+    public void testSOAP11HasFaultWithParser() {

+        assertTrue(

+                "SOAP 1.1 Body Test With parser :- hasFault method returns false",

+                soap11BodyWithParser.hasFault());

+    }

+

+    public void testSOAP11GetFaultWithParser() {

+        assertFalse(

+                "SOAP 1.1 Body Test With parser :- getFault method returns null",

+                soap11BodyWithParser.getFault() == null);

+        assertTrue(

+                "SOAP 1.1 Body Test With parser : - SOAP fault name mismatch",

+                soap11BodyWithParser.getFault().getLocalName().equals(

+                        SOAPConstants.SOAPFAULT_LOCAL_NAME));

+    }

+

+    //SOAP 1.2 Body Test (With Parser)-------------------------------------------------------------------------------------------------

+    public void testSOAP12HasFaultWithParser() {

+        assertTrue(

+                "SOAP 1.2 Body Test With parser :- hasFault method returns false",

+                soap12BodyWithParser.hasFault());

+    }

+

+    public void testSOAP12GetFaultWithParser() {

+        assertFalse(

+                "SOAP 1.2 Body Test With parser :- getFault method returns null",

+                soap12BodyWithParser.getFault() == null);

+        assertTrue(

+                "SOAP 1.2 Body Test With parser : - SOAP fault name mismatch",

+                soap12BodyWithParser.getFault().getLocalName().equals(

+                        SOAPConstants.SOAPFAULT_LOCAL_NAME));

+    }

+

+    public void testSOAPBodyDetachment(){

+        try {

+            soap11Body.detach();

+            fail("Detachment of SOAP Body is not allowed !!");

+        } catch (OMException e) {

+            assertTrue(true);

+        }

+

+        try {

+            soap12Body.detach();

+            fail("Detachment of SOAP Body is not allowed !!");

+        } catch (OMException e) {

+            assertTrue(true);

+        }

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPBodyTestCase.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPBodyTestCase.java
new file mode 100644
index 0000000..e4fc11b
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPBodyTestCase.java
@@ -0,0 +1,40 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+public abstract class SOAPBodyTestCase extends SOAPTestCase {

+    protected SOAPBody soap11Body;

+    protected SOAPBody soap12Body;

+

+    protected SOAPBody soap11BodyWithParser;

+    protected SOAPBody soap12BodyWithParser;

+

+    public SOAPBodyTestCase(String testName) {

+        super(testName);

+

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+        soap11Body = soap11Factory.createSOAPBody(soap11Envelope);

+        soap12Body = soap12Factory.createSOAPBody(soap12Envelope);

+

+        soap11BodyWithParser = soap11EnvelopeWithParser.getBody();

+        soap12BodyWithParser = soap12EnvelopeWithParser.getBody();

+    }

+

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPEnvelopeTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPEnvelopeTest.java
new file mode 100644
index 0000000..05d382c
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPEnvelopeTest.java
@@ -0,0 +1,117 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMAbstractFactory;

+

+

+public class SOAPEnvelopeTest extends SOAPTestCase {

+    protected SOAPEnvelope soap11Envelope;

+    protected SOAPEnvelope soap12Envelope;

+

+    public SOAPEnvelopeTest(String testName) {

+        super(testName);

+        soap11Envelope = soap11Factory.getDefaultEnvelope();

+        soap12Envelope = soap12Factory.getDefaultEnvelope();

+    }

+

+    //SOAP 1.1 Envelope Test (Programaticaly Created)-----------------------------------------------

+    public void testSOAP11GetHeader() {

+        SOAPHeader header = soap11Envelope.getHeader();

+        assertTrue("SOAP 1.1 Header Test : - Header local name mismatch",

+                header.getLocalName().equals(SOAPConstants.HEADER_LOCAL_NAME));

+        assertTrue("SOAP 1.1 Header Test : - Header namespace mismatch",

+                header.getNamespace().getNamespaceURI().equals(

+                        SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));

+    }

+

+    public void testSOAP11GetBody() {

+        SOAPBody body = soap11Envelope.getBody();

+        assertTrue("SOAP 1.1 Body Test : - Body local name mismatch",

+                body.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME));

+        assertTrue("SOAP 1.1 Body Test : - Body namespace mismatch",

+                body.getNamespace().getNamespaceURI().equals(

+                        SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));

+    }

+

+    //SOAP 1.2 Envelope Test (Programaticaly Created)-------------------------------------------------

+    public void testSOAP12GetHeader() {

+        SOAPHeader header = soap12Envelope.getHeader();

+        assertTrue("SOAP 1.2 Header Test : - Header local name mismatch",

+                header.getLocalName().equals(SOAPConstants.HEADER_LOCAL_NAME));

+        assertTrue("SOAP 1.2 Header Test : - Header namespace mismatch",

+                header.getNamespace().getNamespaceURI().equals(

+                        SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));

+    }

+

+    public void testSOAP12GetBody() {

+        SOAPBody body = soap12Envelope.getBody();

+        assertTrue("SOAP 1.2 Body Test : - Body local name mismatch",

+                body.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME));

+        assertTrue("SOAP 1.2 Body Test : - Body namespace mismatch",

+                body.getNamespace().getNamespaceURI().equals(

+                        SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));

+    }

+

+    //SOAP 1.1 Envelope Test (With Parser)-----------------------------------------------------------------

+    public void testSOAP11GetHeaderWithParser() {

+        SOAPHeader header = soap11EnvelopeWithParser.getHeader();

+        assertTrue("SOAP 1.1 Header Test : - Header local name mismatch",

+                header.getLocalName().equals(SOAPConstants.HEADER_LOCAL_NAME));

+        assertTrue("SOAP 1.1 Header Test : - Header namespace mismatch",

+                header.getNamespace().getNamespaceURI().equals(

+                        SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));

+    }

+

+    public void testSOAP11GetBodyWithParser() {

+        SOAPBody body = soap11EnvelopeWithParser.getBody();

+        assertTrue("SOAP 1.1 Body Test : - Body local name mismatch",

+                body.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME));

+        assertTrue("SOAP 1.1 Body Test : - Body namespace mismatch",

+                body.getNamespace().getNamespaceURI().equals(

+                        SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));

+    }

+

+    //SOAP 1.2 Envelope Test (With Parser)--------------------------------------------------------------------

+    public void testSOAP12GetHeaderWithParser() {

+        SOAPHeader header = soap12EnvelopeWithParser.getHeader();

+        assertTrue("SOAP 1.2 Header Test : - Header local name mismatch",

+                header.getLocalName().equals(SOAPConstants.HEADER_LOCAL_NAME));

+        assertTrue("SOAP 1.2 Header Test : - Header namespace mismatch",

+                header.getNamespace().getNamespaceURI().equals(

+                        SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));

+    }

+

+    public void testSOAP12GetBodyWithParser() {

+        SOAPBody body = soap12EnvelopeWithParser.getBody();

+        assertTrue("SOAP 1.2 Body Test : - Body local name mismatch",

+                body.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME));

+        assertTrue("SOAP 1.2 Body Test : - Body namespace mismatch",

+                body.getNamespace().getNamespaceURI().equals(

+                        SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));

+    }

+

+    public void testRandomSOAPHeader() {

+        SOAPFactory soapFac = OMAbstractFactory.getSOAP12Factory();

+        SOAPEnvelope defaultEnvelope = soapFac.getDefaultEnvelope();

+        defaultEnvelope.build();

+        defaultEnvelope.getHeader().detach();

+

+        soapFac.createSOAPHeader(defaultEnvelope);

+

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFactoryTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFactoryTest.java
new file mode 100644
index 0000000..44b77c0
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFactoryTest.java
@@ -0,0 +1,54 @@
+package org.apache.axiom.soap;

+

+import junit.framework.TestCase;

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;

+

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLStreamException;

+import java.io.FileInputStream;

+import java.io.FileNotFoundException;

+

+/*

+ * Copyright 2001-2004 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ *

+ */

+

+public class SOAPFactoryTest extends TestCase {

+

+    protected static final String SOAP11_FILE_NAME = "test-resources/soap/soap11/soap11message.xml";

+    protected static final String SOAP12_FILE_NAME = "test-resources/soap/soap12message.xml";

+    private Log log = LogFactory.getLog(getClass());

+

+    public void testSOAPFactory() {

+

+        try {

+            SOAPEnvelope soapEnvelope = (SOAPEnvelope) new StAXSOAPModelBuilder(XMLInputFactory.newInstance().

+                    createXMLStreamReader(new FileInputStream(SOAP11_FILE_NAME)), null).getDocumentElement();

+            assertTrue(soapEnvelope != null);

+

+            soapEnvelope = (SOAPEnvelope) new StAXSOAPModelBuilder(XMLInputFactory.newInstance().

+                    createXMLStreamReader(new FileInputStream(SOAP12_FILE_NAME)), null).getDocumentElement();

+            assertTrue(soapEnvelope != null);

+        } catch (XMLStreamException e) {

+            fail("Can not load soap envelope. Exception = "+ e);

+        } catch (FileNotFoundException e) {

+            fail("Given XML can not be found. Exception =  "+ e);

+        }

+

+    }

+

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultCodeTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultCodeTest.java
new file mode 100644
index 0000000..6a5f799
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultCodeTest.java
@@ -0,0 +1,163 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+

+public class SOAPFaultCodeTest extends SOAPFaultCodeTestCase {

+

+    public SOAPFaultCodeTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+    }

+

+    //SOAP 1.1 Fault Code Test (Programaticaly Created)

+    public void testSOAP11SetValue() {

+        soap11FaultCode.setValue(

+                soap11Factory.createSOAPFaultValue(soap11FaultCode));

+        assertFalse(

+                "SOAP 1.1 Fault Code Test :- After calling setValue method, getValue method returns null",

+                soap11FaultCode.getValue() == null);

+        try {

+            soap11FaultCode.setValue(

+                    soap12Factory.createSOAPFaultValue(soap12FaultCode));

+            fail("SOAP12FaultValue should not be inserted to SOAP11FaultCode");

+        } catch (SOAPProcessingException e) {

+            assertTrue(true);

+        }

+

+    }

+

+    public void testSOAP11GetValue() {

+        assertTrue(

+                "SOAP 1.1 Fault Code Test :- After creating soapfaultcode, it has a value",

+                soap11FaultCode.getValue() == null);

+        soap11FaultCode.setValue(

+                soap11Factory.createSOAPFaultValue(soap11FaultCode));

+        assertFalse(

+                "SOAP 1.1 Fault Code Test :- After calling setValue method, getValue method returns null",

+                soap11FaultCode.getValue() == null);

+    }

+

+    //SOAP 1.2 Fault Code Test (Programaticaly Created)

+    public void testSOAP12SetValue() {

+        soap12FaultCode.setValue(

+                soap12Factory.createSOAPFaultValue(soap12FaultCode));

+        assertFalse(

+                "SOAP 1.2 Fault Code Test :- After calling setValue method, getValue method returns null",

+                soap12FaultCode.getValue() == null);

+        try {

+            soap12FaultCode.setValue(

+                    soap11Factory.createSOAPFaultValue(soap11FaultCode));

+            fail("SOAP11FaultValue should not be inserted to SOAP12FaultCode");

+        } catch (SOAPProcessingException e) {

+            assertTrue(true);

+        }

+

+        try {

+            soap12FaultCode.setValue(

+                    soap12Factory.createSOAPFaultValue(

+                            soap12Factory.createSOAPFaultSubCode(

+                                    soap12FaultCode)));

+        } catch (Exception e) {

+            fail(

+                    "SOAP 1.2 Fault Code Test :- When calling setValue method, parent of value element mismatch");

+        }

+    }

+

+    public void testSOAP12GetValue() {

+        assertTrue(

+                "SOAP 1.2 Fault Code Test :- After creating soapfaultcode, it has a value",

+                soap12FaultCode.getValue() == null);

+        soap12FaultCode.setValue(

+                soap12Factory.createSOAPFaultValue(soap12FaultCode));

+        assertFalse(

+                "SOAP 1.2 Fault Code Test :- After calling setValue method, getValue method returns null",

+                soap12FaultCode.getValue() == null);

+    }

+

+    public void testSOAP12SetSubCode() {

+        soap12FaultCode.setSubCode(

+                soap12Factory.createSOAPFaultSubCode(soap12FaultCode));

+        assertFalse(

+                "SOAP 1.2 Fault Code Test :- After calling setSubCode method, getSubCode method returns null",

+                soap12FaultCode.getSubCode() == null);

+        try {

+            soap12FaultCode.setSubCode(

+                    soap11Factory.createSOAPFaultSubCode(soap11FaultCode));

+            fail(

+                    "SOAP11FaultSubCode should not be inserted to SOAP12FaultCode");

+        } catch (SOAPProcessingException e) {

+            assertTrue(true);

+        }

+

+        try {

+            soap12FaultCode.setSubCode(

+                    soap12Factory.createSOAPFaultSubCode(

+                            soap12Factory.createSOAPFaultSubCode(

+                                    soap12FaultCode)));

+        } catch (Exception e) {

+            fail(

+                    "SOAP 1.2 Fault Code Test :- When calling setSubCode method, parent of subcode element mismatch");

+        }

+    }

+

+    public void testSOAP12GetSubCode() {

+        assertTrue(

+                "SOAP 1.2 Fault Code Test :- After creating soapfaultcode, it has a subcode",

+                soap12FaultCode.getSubCode() == null);

+        soap12FaultCode.setSubCode(

+                soap12Factory.createSOAPFaultSubCode(soap12FaultCode));

+        assertFalse(

+                "SOAP 1.2 Fault Code Test :- After calling setSubCode method, getSubCode method returns null",

+                soap12FaultCode.getSubCode() == null);

+    }

+

+    //SOAP 1.1 Fault Code Test (With Parser)

+    public void testSOAP11GetValueWithParser() {

+        assertFalse(

+                "SOAP 1.1 Fault Code Test with parser : - getValue method returns null",

+                soap11FaultCodeWithParser.getValue() == null);

+        assertTrue(

+                "SOAP 1.1 Fault Code Test with parser : - Value local name mismatch",

+                soap11FaultCodeWithParser.getValue().getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME));

+    }

+

+    //SOAP 1.2 Fault Code Test (With Parser)

+    public void testSOAP12GetValueWithParser() {

+        assertFalse(

+                "SOAP 1.2 Fault Code Test with parser : - getValue method returns null",

+                soap12FaultCodeWithParser.getValue() == null);

+        assertTrue(

+                "SOAP 1.2 Fault Code Test with parser : - Value local name mismatch",

+                soap12FaultCodeWithParser.getValue().getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME));

+    }

+

+    public void testSOAP12GetSubCodeWithParser() {

+        assertFalse(

+                "SOAP 1.2 Fault Code Test with parser :- getSubCode method returns null",

+                soap12FaultCodeWithParser.getSubCode() == null);

+        assertTrue(

+                "SOAP 1.2 Fault Code Test with parser : - subcode local name mismatch",

+                soap12FaultCodeWithParser.getSubCode().getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME));

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultCodeTestCase.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultCodeTestCase.java
new file mode 100644
index 0000000..c0c0704
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultCodeTestCase.java
@@ -0,0 +1,41 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+public abstract class SOAPFaultCodeTestCase extends SOAPFaultTestCase {

+

+    protected SOAPFaultCode soap11FaultCode;

+    protected SOAPFaultCode soap12FaultCode;

+

+    protected SOAPFaultCode soap11FaultCodeWithParser;

+    protected SOAPFaultCode soap12FaultCodeWithParser;

+

+    public SOAPFaultCodeTestCase(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+

+        soap11FaultCode = soap11Factory.createSOAPFaultCode(soap11Fault);

+        soap12FaultCode = soap12Factory.createSOAPFaultCode(soap12Fault);

+

+        soap11FaultCodeWithParser = soap11FaultWithParser.getCode();

+        soap12FaultCodeWithParser = soap12FaultWithParser.getCode();

+    }

+

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultDetailTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultDetailTest.java
new file mode 100644
index 0000000..6b29cbc
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultDetailTest.java
@@ -0,0 +1,223 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMText;

+

+import java.util.Iterator;

+

+public class SOAPFaultDetailTest extends SOAPFaultTestCase {

+    protected SOAPFaultDetail soap11FaultDetail;

+    protected SOAPFaultDetail soap12FaultDetail;

+    protected SOAPFaultDetail soap11FaultDetailWithParser;

+    protected SOAPFaultDetail soap12FaultDetailWithParser;

+    protected OMNamespace omNamespace;

+

+    public SOAPFaultDetailTest(String testName) {

+        super(testName);

+        omNamespace =

+                omFactory.createOMNamespace("http://www.test.org", "test");

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+        soap11FaultDetail = soap11Factory.createSOAPFaultDetail(soap11Fault);

+        soap12FaultDetail = soap12Factory.createSOAPFaultDetail(soap12Fault);

+        soap11FaultDetailWithParser = soap11FaultWithParser.getDetail();

+        soap12FaultDetailWithParser = soap12FaultWithParser.getDetail();

+    }

+

+    //SOAP 1.1 Fault Detail Test (Programaticaly Created)

+    public void testSOAP11AddDetailEntry() {

+        soap11FaultDetail.addDetailEntry(

+                omFactory.createOMElement("DetailEntry1", omNamespace));

+        soap11FaultDetail.addDetailEntry(

+                omFactory.createOMElement("DetailEntry2", omNamespace));

+        Iterator iterator = soap11FaultDetail.getAllDetailEntries();

+        OMElement detailEntry1 = (OMElement) iterator.next();

+        assertFalse(

+                "SOAP 1.1 Fault Detail Test : - After calling addDetailEntry method twice, getAllDetailEntries method returns empty iterator",

+                detailEntry1 == null);

+        assertTrue(

+                "SOAP 1.1 Fault Detail Test : - detailEntry1 local name mismatch",

+                detailEntry1.getLocalName().equals("DetailEntry1"));

+        assertTrue(

+                "SOAP 1.1 Fault Detail Test : - detailEntry1 namespace uri mismatch",

+                detailEntry1.getNamespace().getNamespaceURI().equals(

+                        "http://www.test.org"));

+        OMElement detailEntry2 = (OMElement) iterator.next();

+        assertFalse(

+                "SOAP 1.1 Fault Detail Test : - After calling addDetailEntry method twice, getAllDetailEntries method returns an iterator with only one object",

+                detailEntry2 == null);

+        assertTrue(

+                "SOAP 1.1 Fault Detail Test : - detailEntry2 local name mismatch",

+                detailEntry2.getLocalName().equals("DetailEntry2"));

+        assertTrue(

+                "SOAP 1.1 Fault Detail Test : - detailEntry2 namespace uri mismatch",

+                detailEntry2.getNamespace().getNamespaceURI().equals(

+                        "http://www.test.org"));

+        assertTrue(

+                "SOAP 1.1 Fault Detail Test : - After calling addDetailEntry method twice, getAllDetailEntries method returns an iterator with three objects",

+                !iterator.hasNext());

+    }

+

+    public void testSOAP11GetAllDetailEntries() {

+        Iterator iterator = soap11FaultDetail.getAllDetailEntries();

+        assertTrue(

+                "SOAP 1.1 Fault Detail Test : - After creating SOAP11FaultDetail element, it has DetailEntries",

+                !iterator.hasNext());

+        soap11FaultDetail.addDetailEntry(

+                omFactory.createOMElement("DetailEntry", omNamespace));

+        iterator = soap11FaultDetail.getAllDetailEntries();

+        OMElement detailEntry = (OMElement) iterator.next();

+        assertFalse(

+                "SOAP 1.1 Fault Detail Test : - After calling addDetailEntry method, getAllDetailEntries method returns empty iterator",

+                detailEntry == null);

+        assertTrue(

+                "SOAP 1.1 Fault Detail Test : - detailEntry local name mismatch",

+                detailEntry.getLocalName().equals("DetailEntry"));

+        assertTrue(

+                "SOAP 1.1 Fault Detail Test : - detailEntry namespace uri mismatch",

+                detailEntry.getNamespace().getNamespaceURI().equals(

+                        "http://www.test.org"));

+        assertTrue(

+                "SOAP 1.1 Fault Detail Test : - After calling addDetailEntry method once, getAllDetailEntries method returns an iterator with two objects",

+                !iterator.hasNext());

+    }

+

+    //SOAP 1.2 Fault Detail Test (Programaticaly Created)

+    public void testSOAP12AddDetailEntry() {

+        soap12FaultDetail.addDetailEntry(

+                omFactory.createOMElement("DetailEntry1", omNamespace));

+        soap12FaultDetail.addDetailEntry(

+                omFactory.createOMElement("DetailEntry2", omNamespace));

+        Iterator iterator = soap12FaultDetail.getAllDetailEntries();

+        OMElement detailEntry1 = (OMElement) iterator.next();

+        assertFalse(

+                "SOAP 1.2 Fault Detail Test : - After calling addDetailEntry method twice, getAllDetailEntries method returns empty iterator",

+                detailEntry1 == null);

+        assertTrue(

+                "SOAP 1.2 Fault Detail Test : - detailEntry1 local name mismatch",

+                detailEntry1.getLocalName().equals("DetailEntry1"));

+        assertTrue(

+                "SOAP 1.2 Fault Detail Test : - detailEntry1 namespace uri mismatch",

+                detailEntry1.getNamespace().getNamespaceURI().equals(

+                        "http://www.test.org"));

+        OMElement detailEntry2 = (OMElement) iterator.next();

+        assertFalse(

+                "SOAP 1.2 Fault Detail Test : - After calling addDetailEntry method twice, getAllDetailEntries method returns an iterator with only one object",

+                detailEntry2 == null);

+        assertTrue(

+                "SOAP 1.2 Fault Detail Test : - detailEntry2 local name mismatch",

+                detailEntry2.getLocalName().equals("DetailEntry2"));

+        assertTrue(

+                "SOAP 1.2 Fault Detail Test : - detailEntry2 namespace uri mismatch",

+                detailEntry2.getNamespace().getNamespaceURI().equals(

+                        "http://www.test.org"));

+        assertTrue(

+                "SOAP 1.2 Fault Detail Test : - After calling addDetailEntry method twice, getAllDetailEntries method returns an iterator with three objects",

+                !iterator.hasNext());

+    }

+

+    public void testSOAP12GetAllDetailEntries() {

+        Iterator iterator = soap12FaultDetail.getAllDetailEntries();

+        assertTrue(

+                "SOAP 1.2 Fault Detail Test : - After creating SOAP11FaultDetail element, it has DetailEntries",

+                !iterator.hasNext());

+        soap12FaultDetail.addDetailEntry(

+                omFactory.createOMElement("DetailEntry", omNamespace));

+        iterator = soap12FaultDetail.getAllDetailEntries();

+        OMElement detailEntry = (OMElement) iterator.next();

+        assertFalse(

+                "SOAP 1.2 Fault Detail Test : - After calling addDetailEntry method, getAllDetailEntries method returns empty iterator",

+                detailEntry == null);

+        assertTrue(

+                "SOAP 1.2 Fault Detail Test : - detailEntry local name mismatch",

+                detailEntry.getLocalName().equals("DetailEntry"));

+        assertTrue(

+                "SOAP 1.2 Fault Detail Test : - detailEntry namespace uri mismatch",

+                detailEntry.getNamespace().getNamespaceURI().equals(

+                        "http://www.test.org"));

+        assertTrue(

+                "SOAP 1.2 Fault Detail Test : - After calling addDetailEntry method once, getAllDetailEntries method returns an iterator with two objects",

+                !iterator.hasNext());

+    }

+

+    //SOAP 1.1 Fault Detail Test (With Parser)

+    public void testSOAP11GetAllDetailEntriesWithParser() {

+        Iterator iterator = soap11FaultDetailWithParser.getAllDetailEntries();

+        OMText textEntry = (OMText) iterator.next();

+        assertFalse(

+                "SOAP 1.1 Fault Detail Test With Parser : - getAllDetailEntries method returns empty iterator",

+                textEntry == null);

+        assertTrue(

+                "SOAP 1.1 Fault Detail Test With Parser : - text value mismatch",

+                textEntry.getText().trim().equals("Details of error"));

+        OMElement detailEntry1 = (OMElement) iterator.next();

+        assertFalse(

+                "SOAP 1.1 Fault Detail Test With Parser : - getAllDetailEntries method returns an itrator without detail entries",

+                detailEntry1 == null);

+        assertTrue(

+                "SOAP 1.1 Fault Detail Test With Parser : - detailEntry1 localname mismatch",

+                detailEntry1.getLocalName().equals("MaxTime"));

+        iterator.next();

+        OMElement detailEntry2 = (OMElement) iterator.next();

+        assertFalse(

+                "SOAP 1.1 Fault Detail Test With Parser : - getAllDetailEntries method returns an itrator with only one detail entries",

+                detailEntry2 == null);

+        assertTrue(

+                "SOAP 1.1 Fault Detail Test With Parser : - detailEntry2 localname mismatch",

+                detailEntry2.getLocalName().equals("AveTime"));

+        iterator.next();

+        assertTrue(

+                "SOAP 1.1 Fault Detail Test With Parser : - getAllDetailEntries method returns an itrator with more than two detail entries",

+                !iterator.hasNext());

+    }

+

+    //SOAP 1.2 Fault Detail Test (With Parser)

+    public void testSOAP12GetAllDetailEntriesWithParser() {

+        Iterator iterator = soap12FaultDetailWithParser.getAllDetailEntries();

+        OMText textEntry = (OMText) iterator.next();

+        assertFalse(

+                "SOAP 1.2 Fault Detail Test With Parser : - getAllDetailEntries method returns empty iterator",

+                textEntry == null);

+        assertTrue(

+                "SOAP 1.2 Fault Detail Test With Parser : - text value mismatch",

+                textEntry.getText().trim().equals("Details of error"));

+        OMElement detailEntry1 = (OMElement) iterator.next();

+        assertFalse(

+                "SOAP 1.2 Fault Detail Test With Parser : - getAllDetailEntries method returns an itrator without detail entries",

+                detailEntry1 == null);

+        assertTrue(

+                "SOAP 1.2 Fault Detail Test With Parser : - detailEntry1 localname mismatch",

+                detailEntry1.getLocalName().equals("MaxTime"));

+        iterator.next();

+        OMElement detailEntry2 = (OMElement) iterator.next();

+        assertFalse(

+                "SOAP 1.2 Fault Detail Test With Parser : - getAllDetailEntries method returns an itrator with only one detail entries",

+                detailEntry2 == null);

+        assertTrue(

+                "SOAP 1.2 Fault Detail Test With Parser : - detailEntry2 localname mismatch",

+                detailEntry2.getLocalName().equals("AveTime"));

+        iterator.next();

+        assertTrue(

+                "SOAP 1.2 Fault Detail Test With Parser : - getAllDetailEntries method returns an itrator with more than two detail entries",

+                !iterator.hasNext());

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultNodeTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultNodeTest.java
new file mode 100644
index 0000000..ea8dd2a
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultNodeTest.java
@@ -0,0 +1,78 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+public class SOAPFaultNodeTest extends SOAPFaultTestCase {

+    protected SOAPFaultNode soap11FaultNode;

+    protected SOAPFaultNode soap12FaultNode;

+    protected SOAPFaultNode soap12FaultNodeWithParser;

+

+    public SOAPFaultNodeTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+        soap11FaultNode = soap11Factory.createSOAPFaultNode(soap11Fault);

+        soap12FaultNode = soap12Factory.createSOAPFaultNode(soap12Fault);

+        soap12FaultNodeWithParser = soap12FaultWithParser.getNode();

+    }

+

+    //SOAP 1.1 Fault Node Test (Programaticaly Created)

+    public void testSOAP11SetNodeValue() {

+        soap11FaultNode.setNodeValue("This is only a test");

+        assertTrue(

+                "SOAP 1.1 Fault Node Test : - After calling setNodeValue method, getNodeValue method returns incorrect value",

+                soap11FaultNode.getNodeValue().equals("This is only a test"));

+    }

+

+    public void testSOAP11GetNodeValue() {

+        assertTrue(

+                "SOAP 1.1 Fault Node Test : - After creating SOAPFaultNode, it has a value",

+                soap11FaultNode.getNodeValue().equals(""));

+        soap11FaultNode.setNodeValue("This is only a test");

+        assertTrue(

+                "SOAP 1.1 Fault Node Test : - After calling setNodeValue method, getNodeValue method returns incorrect value",

+                soap11FaultNode.getNodeValue().equals("This is only a test"));

+    }

+

+    //SOAP 1.2 Fault Node Test (Programaticaly Created)

+    public void testSOAP12SetNodeValue() {

+        soap12FaultNode.setNodeValue("This is only a test");

+        assertTrue(

+                "SOAP 1.2 Fault Node Test : - After calling setNodeValue method, getNodeValue method returns incorrect value",

+                soap12FaultNode.getNodeValue().equals("This is only a test"));

+    }

+

+    public void testSOAP12GetNodeValue() {

+        assertTrue(

+                "SOAP 1.2 Fault Node Test : - After creating SOAPFaultNode, it has a value",

+                soap12FaultNode.getNodeValue().equals(""));

+        soap12FaultNode.setNodeValue("This is only a test");

+        assertTrue(

+                "SOAP 1.2 Fault Node Test : - After calling setNodeValue method, getNodeValue method returns incorrect value",

+                soap12FaultNode.getNodeValue().equals("This is only a test"));

+    }

+

+    //SOAP 1.2 Fault Node Test (With Parser)

+    public void testSOAP12GetNodeValueWithParser() {

+        assertTrue(

+                "SOAP 1.2 Fault Node Test With Parser : - getNodeValue method returns incorrect value",

+                soap12FaultNodeWithParser.getNodeValue().trim().equals(

+                        "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"));

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultReasonTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultReasonTest.java
new file mode 100644
index 0000000..a9bb2a6
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultReasonTest.java
@@ -0,0 +1,106 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMAbstractFactory;

+

+public class SOAPFaultReasonTest extends SOAPFaultReasonTestCase {

+

+    public SOAPFaultReasonTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+    }

+

+    //SOAP 1.1 Fault Reason Test (Programaticaly Created)

+    public void testSOAP11SetSOAPText() {

+        soap11FaultReason.addSOAPText(

+                soap11Factory.createSOAPFaultText(soap11FaultReason));

+        assertFalse(

+                "SOAP 1.1 FaultReason Test : - After calling addSOAPText, getFirstSOAPText returns null",

+                soap11FaultReason.getFirstSOAPText() == null);

+        try {

+            soap11FaultReason.addSOAPText(

+                    soap12Factory.createSOAPFaultText(soap12FaultReason));

+            fail("SOAP12FaultText should not be added to SOAP11FaultReason");

+

+        } catch (Exception e) {

+            assertTrue(true);

+        }

+    }

+

+    public void testSOAP11GetSOAPText() {

+        assertTrue(

+                "SOAP 1.1 FaultReason Test : - After creating SOAP11FaultReason, it has a SOAPFaultText",

+                soap11FaultReason.getFirstSOAPText() == null);

+        soap11FaultReason.addSOAPText(

+                soap11Factory.createSOAPFaultText(soap11FaultReason));

+        assertFalse(

+                "SOAP 1.1 FaultReason Test : - After calling addSOAPText, getFirstSOAPText returns null",

+                soap11FaultReason.getFirstSOAPText() == null);

+    }

+

+    //SOAP 1.2 Fault Reason Test (Programaticaly Created)

+    public void testSOAP12SetSOAPText() {

+        soap12FaultReason.addSOAPText(

+                soap12Factory.createSOAPFaultText(soap12FaultReason));

+        assertFalse(

+                "SOAP 1.2 FaultReason Test : - After calling addSOAPText, getFirstSOAPText returns null",

+                soap12FaultReason.getFirstSOAPText() == null);

+        try {

+            soap12FaultReason.addSOAPText(

+                    soap11Factory.createSOAPFaultText(soap11FaultReason));

+            fail("SOAP11FaultText should not be added to SOAP12FaultReason");

+        } catch (Exception e) {

+            assertTrue(true);

+        }

+    }

+

+    public void testSOAP12GetSOAPText() {

+        assertTrue(

+                "SOAP 1.2 FaultReason Test : - After creating SOAP12FaultReason, it has a SOAPFaultText",

+                soap12FaultReason.getFirstSOAPText() == null);

+        soap12FaultReason.addSOAPText(

+                soap12Factory.createSOAPFaultText(soap12FaultReason));

+        assertFalse(

+                "SOAP 1.2 FaultReason Test : - After calling addSOAPText, getFirstSOAPText returns null",

+                soap12FaultReason.getFirstSOAPText() == null);

+    }

+

+    //SOAP 1.1 Fault Reason Test (With Parser)

+    public void testSOAP11GetSOAPTextWithParser() {

+        assertFalse(

+                "SOAP 1.1 FaultReason Test With Parser : - getFirstSOAPText method returns null",

+                soap11FaultReasonWithParser.getFirstSOAPText() == null);

+    }

+

+    //SOAP 1.2 Fault Reason Test (With Parser)

+    public void testSOAP12GetSOAPTextWithParser() {

+        assertFalse(

+                "SOAP 1.2 FaultReason Test With Parser : - getFirstSOAPText method returns null",

+                soap12FaultReasonWithParser.getFirstSOAPText() == null);

+    }

+

+//    public void testMultipleSOAPReasonTexts() {

+//        SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();

+//

+//        SOAPFaultReason soapFaultReason = soapFactory.createSOAPFaultReason();

+////        soap

+//    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultReasonTestCase.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultReasonTestCase.java
new file mode 100644
index 0000000..947dabc
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultReasonTestCase.java
@@ -0,0 +1,38 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+public abstract class SOAPFaultReasonTestCase extends SOAPFaultTestCase {

+

+    protected SOAPFaultReason soap11FaultReason;

+    protected SOAPFaultReason soap12FaultReason;

+    protected SOAPFaultReason soap11FaultReasonWithParser;

+    protected SOAPFaultReason soap12FaultReasonWithParser;

+

+    public SOAPFaultReasonTestCase(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+        soap11FaultReason = soap11Factory.createSOAPFaultReason(soap11Fault);

+        soap12FaultReason = soap12Factory.createSOAPFaultReason(soap12Fault);

+        soap11FaultReasonWithParser = soap11FaultWithParser.getReason();

+        soap12FaultReasonWithParser = soap12FaultWithParser.getReason();

+    }

+

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultRoleTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultRoleTest.java
new file mode 100644
index 0000000..bb901ae
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultRoleTest.java
@@ -0,0 +1,89 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+public class SOAPFaultRoleTest extends SOAPFaultTestCase {

+

+    protected SOAPFaultRole soap11FaultRole;

+    protected SOAPFaultRole soap12FaultRole;

+    protected SOAPFaultRole soap11FaultRoleWithParser;

+    protected SOAPFaultRole soap12FaultRoleWithParser;

+

+    public SOAPFaultRoleTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+        soap11FaultRole = soap11Factory.createSOAPFaultRole(soap11Fault);

+        soap12FaultRole = soap12Factory.createSOAPFaultRole(soap12Fault);

+        soap11FaultRoleWithParser = soap11FaultWithParser.getRole();

+        soap12FaultRoleWithParser = soap12FaultWithParser.getRole();

+    }

+

+    //SOAP 1.1 Fault Role Test (Programaticaly Created)

+    public void testSOAP11SetRoleValue() {

+        soap11FaultRole.setRoleValue("This is only a test");

+        assertTrue(

+                "SOAP 1.1 Fault Role Test : - After calling setRoleValue method, getRoleValue method returns incorrect value",

+                soap11FaultRole.getRoleValue().trim().equals("This is only a test"));

+    }

+

+    public void testSOAP11GetRoleValue() {

+        assertTrue(

+                "SOAP 1.1 Fault Role Test : - After creating SOAPFaultRole, it has a value",

+                soap11FaultRole.getRoleValue().equals(""));

+        soap11FaultRole.setRoleValue("This is only a test");

+        assertTrue(

+                "SOAP 1.1 Fault Role Test : - After calling setRoleValue method, getRoleValue method returns incorrect value",

+                soap11FaultRole.getRoleValue().trim().equals("This is only a test"));

+    }

+

+    //SOAP 1.2 Fault Role Test (Programaticaly Created)

+    public void testSOAP12SetRoleValue() {

+        soap12FaultRole.setRoleValue("This is only a test");

+        assertTrue(

+                "SOAP 1.2 Fault Role Test : - After calling setRoleValue method, getRoleValue method returns incorrect value",

+                soap12FaultRole.getRoleValue().trim().equals("This is only a test"));

+    }

+

+    public void testSOAP12GetRoleValue() {

+        assertTrue(

+                "SOAP 1.2 Fault Role Test : - After creating SOAPFaultRole, it has a value",

+                soap12FaultRole.getRoleValue().trim().equals(""));

+        soap12FaultRole.setRoleValue("This is only a test");

+        assertTrue(

+                "SOAP 1.2 Fault Role Test : - After calling setRoleValue method, getRoleValue method returns incorrect value",

+                soap12FaultRole.getRoleValue().trim().equals("This is only a test"));

+    }

+

+    //SOAP 1.1 Fault Role Test (With Parser)

+    public void testSOAP11GetRoleValueWithParser() {

+        assertTrue(

+                "SOAP 1.1 Fault Role Test With Parser : - getRoleValue method returns incorrect value",

+                soap11FaultRoleWithParser.getRoleValue().trim().equals(

+                        "http://schemas.xmlsoap.org/soap/envelope/actor/ultimateReceiver"));

+    }

+

+    //SOAP 1.2 Fault Role Test (With Parser)

+    public void testSOAP12GetRoleValueWithParser() {

+        assertTrue(

+                "SOAP 1.2 Fault Role Test With Parser : - getRoleValue method returns incorrect value",

+                soap12FaultRoleWithParser.getRoleValue().trim().equals(

+                        "ultimateReceiver"));

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultSubCodeTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultSubCodeTest.java
new file mode 100644
index 0000000..184996a
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultSubCodeTest.java
@@ -0,0 +1,180 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+

+public class SOAPFaultSubCodeTest extends SOAPFaultSubCodeTestCase {

+

+    public SOAPFaultSubCodeTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+    }

+

+    //SOAP Fault SubCode(In Fault Code) Test (Programaticaly Created)

+    public void testSetValueInFaultCode() {

+        soap12FaultSubCodeInCode.setValue(

+                soap12Factory.createSOAPFaultValue(soap12FaultSubCodeInCode));

+        assertFalse(

+                "SOAP 1.2 Subcode Test In Fault Code : - After calling setValue method, getValue method returns null",

+                soap12FaultSubCodeInCode.getValue() == null);

+        try {

+            soap12FaultSubCodeInCode.setValue(

+                    soap12Factory.createSOAPFaultValue(soap12FaultCode));

+        } catch (SOAPProcessingException e) {

+            fail(

+                    "SOAP 1.2 SOAPFaultSubCode Test In FaultCode : - FaultValue whose parent is FaultCode should not be set in to FaultSubCode, as a child");

+        }

+    }

+

+    public void testGetValueInFaultCode() {

+        assertTrue(

+                "After creating SOAP12FaultSubCode In Fault Code, it has a FaultValue",

+                soap12FaultSubCodeInCode.getValue() == null);

+        soap12FaultSubCodeInCode.setValue(

+                soap12Factory.createSOAPFaultValue(soap12FaultSubCodeInCode));

+        assertFalse(

+                "SOAP 1.2 SOAPFaultSubCode Test In FaultCode : - After calling setValue method, getValue method returns null",

+                soap12FaultSubCodeInCode.getValue() == null);

+    }

+

+    public void testsetSubCodeInFaultCode() {

+        soap12FaultSubCodeInCode.setSubCode(

+                soap12Factory.createSOAPFaultSubCode(soap12FaultSubCodeInCode));

+        assertFalse(

+                "SOAP 1.2 Subcode Test In Fault Code : - After calling setSubCode method, getSubCode method returns null",

+                soap12FaultSubCodeInCode.getSubCode() == null);

+        try {

+            soap12FaultSubCodeInCode.setSubCode(

+                    soap12Factory.createSOAPFaultSubCode(soap12FaultCode));

+        } catch (SOAPProcessingException e) {

+            fail(

+                    "SOAP 1.2 SOAPFaultSubCode Test In FaultCode : - FaultSubCode whose parent is FaultCode should not be set in to FaultSubCode, as a child");

+        }

+    }

+

+    public void testGetSubCodeInFaultCode() {

+        //soap12FaultSubCodeInCode has a SubCode because a SubCode was created in setUp method of super class

+//        assertTrue("After creating SOAP12FaultSubCode In Fault Code, it has a FaultSubCode",soap12FaultSubCodeInCode.getSubCode() == null);

+        soap12FaultSubCodeInCode.setSubCode(

+                soap12Factory.createSOAPFaultSubCode(soap12FaultSubCodeInCode));

+        assertFalse(

+                "SOAP 1.2 SOAPFaultSubCode Test In FaultCode : - After calling setSubCode method, getSubCode method returns null",

+                soap12FaultSubCodeInCode.getSubCode() == null);

+    }

+

+    //SOAP Fault SubCode(In Fault SubCode) Test (Programaticaly Created)

+    public void testSetValueInFaultSubCode() {

+        soap12FaultSubCodeInSubCode.setValue(

+                soap12Factory.createSOAPFaultValue(soap12FaultSubCodeInSubCode));

+        assertFalse(

+                "SOAP 1.2 Subcode Test In Fault SubCode : - After calling setValue method, getValue method returns null",

+                soap12FaultSubCodeInSubCode.getValue() == null);

+        try {

+            soap12FaultSubCodeInSubCode.setValue(

+                    soap12Factory.createSOAPFaultValue(soap12FaultCode));

+        } catch (SOAPProcessingException e) {

+            fail(

+                    "SOAP 1.2 SOAPFaultSubCode Test In FaultCode : - FaultValue whose parent is FaultCode should not be set in to FaultSubCode, as a child");

+        }

+    }

+

+    public void testGetValueInFaultSubCode() {

+        assertTrue(

+                "After creating SOAP12FaultSubCode In Fault SubCode, it has a Fault Value",

+                soap12FaultSubCodeInSubCode.getValue() == null);

+        soap12FaultSubCodeInSubCode.setValue(

+                soap12Factory.createSOAPFaultValue(soap12FaultSubCodeInSubCode));

+        assertFalse(

+                "SOAP 1.2 SOAPFaultSubCode Test In FaultSubCode : - After calling setValue method, getValue method returns null",

+                soap12FaultSubCodeInSubCode.getValue() == null);

+    }

+

+    public void testsetSubCodeInFaultSubCode() {

+        soap12FaultSubCodeInSubCode.setSubCode(

+                soap12Factory.createSOAPFaultSubCode(

+                        soap12FaultSubCodeInSubCode));

+        assertFalse(

+                "SOAP 1.2 Subcode Test In Fault SubCode : - After calling setSubCode method, getSubCode method returns null",

+                soap12FaultSubCodeInSubCode.getSubCode() == null);

+        try {

+            soap12FaultSubCodeInSubCode.setSubCode(

+                    soap12Factory.createSOAPFaultSubCode(soap12FaultCode));

+        } catch (SOAPProcessingException e) {

+            fail(

+                    "SOAP 1.2 SOAPFaultSubCode Test In FaultSubCode : - FaultSubCode whose parent is FaultCode should not be set in to FaultSubCode, as a child");

+        }

+    }

+

+    public void testGetSubCodeInFaultSubCode() {

+        assertTrue(

+                "After creating SOAP12FaultSubCode In Fault SubCode, it has a FaultSubCode",

+                soap12FaultSubCodeInSubCode.getSubCode() == null);

+        soap12FaultSubCodeInSubCode.setSubCode(

+                soap12Factory.createSOAPFaultSubCode(

+                        soap12FaultSubCodeInSubCode));

+        assertFalse(

+                "SOAP 1.2 SOAPFaultSubCode Test In FaultSubCode : - After calling setSubCode method, getSubCode method returns null",

+                soap12FaultSubCodeInSubCode.getSubCode() == null);

+    }

+

+    //SOAP Fault SubCode(In Fault Code) Test (With Parser)

+    public void testGetValueInFaultCodeWithParser() {

+        assertFalse(

+                "SOAP 1.2 SOAPFaultSubCode Test In FaultCode With Parser : - getValue method returns null",

+                soap12FaultSubCodeInFaultCodeWithParser.getValue() == null);

+        assertTrue(

+                "SOAP 1.2 SOAPFaultSubCode Test In FaultCode With Parser : - Value text mismatch",

+                soap12FaultSubCodeInFaultCodeWithParser.getValue().getText()

+                .equals("m:MessageTimeout In First Subcode"));

+    }

+

+    public void testGetSubCodeInFaultCodeWithParser() {

+        assertFalse(

+                "SOAP 1.2 SOAPFaultSubCode Test In FaultCode With Parser : - getSubCode method returns null",

+                soap12FaultSubCodeInFaultCodeWithParser.getSubCode() == null);

+        assertTrue(

+                "SOAP 1.2 SOAPFaultSubCode Test In FaultCode With Parser : - SubCode local name mismatch",

+                soap12FaultSubCodeInFaultCodeWithParser.getSubCode()

+                .getLocalName()

+                .equals(SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME));

+    }

+

+    //SOAP Fault SubCode(In Fault SubCode) Test (With Parser)

+    public void testGetValueInFaultSubCodeWithParser() {

+        assertFalse(

+                "SOAP 1.2 SOAPFaultSubCode Test In FaultSubCode With Parser : - getValue method returns null",

+                soap12FaultSubCodeInSubCodeWithParser.getValue() == null);

+        assertTrue(

+                "SOAP 1.2 SOAPFaultSubCode Test In FaultSubCode With Parser : - Value text mismatch",

+                soap12FaultSubCodeInSubCodeWithParser.getValue().getText()

+                .equals("m:MessageTimeout In Second Subcode"));

+    }

+

+    public void testGetSubCodeInFaultSubCodeWithParser() {

+        assertFalse(

+                "SOAP 1.2 SOAPFaultSubCode Test In FaultSubCode With Parser : - getSubCode method returns null",

+                soap12FaultSubCodeInSubCodeWithParser.getSubCode() == null);

+        assertTrue(

+                "SOAP 1.2 SOAPFaultSubCode Test In FaultSubCode With Parser : - SubCode local name mismatch",

+                soap12FaultSubCodeInSubCodeWithParser.getSubCode()

+                .getLocalName()

+                .equals(SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME));

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultSubCodeTestCase.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultSubCodeTestCase.java
new file mode 100644
index 0000000..d0a00f9
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultSubCodeTestCase.java
@@ -0,0 +1,62 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+public abstract class SOAPFaultSubCodeTestCase extends SOAPFaultCodeTestCase {

+    protected SOAPFaultValue soap11FaultValue;

+    protected SOAPFaultValue soap12FaultValueInFaultCode;

+    protected SOAPFaultSubCode soap12FaultSubCodeInCode;

+

+    protected SOAPFaultValue soap12FaultValueInFaultSubCode;

+    protected SOAPFaultSubCode soap12FaultSubCodeInSubCode;

+

+    protected SOAPFaultValue soap11FaultValueWithParser;

+    protected SOAPFaultValue soap12FaultValueInFaultCodeWithParser;

+    protected SOAPFaultSubCode soap12FaultSubCodeInFaultCodeWithParser;

+

+    protected SOAPFaultValue soap12FaultValueInFaultSubCodeWithParser;

+    protected SOAPFaultSubCode soap12FaultSubCodeInSubCodeWithParser;

+

+    public SOAPFaultSubCodeTestCase(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+        soap11FaultValue = soap11Factory.createSOAPFaultValue(soap11FaultCode);

+

+        soap12FaultValueInFaultCode =

+                soap12Factory.createSOAPFaultValue(soap12FaultCode);

+        soap12FaultSubCodeInCode =

+                soap12Factory.createSOAPFaultSubCode(soap12FaultCode);

+

+

+        soap12FaultSubCodeInSubCode =

+                soap12Factory.createSOAPFaultSubCode(soap12FaultSubCodeInCode);

+

+        soap11FaultValueWithParser = soap11FaultCodeWithParser.getValue();

+        soap12FaultValueInFaultCodeWithParser =

+                soap12FaultCodeWithParser.getValue();

+        soap12FaultSubCodeInFaultCodeWithParser =

+                soap12FaultCodeWithParser.getSubCode();

+

+        soap12FaultValueInFaultSubCodeWithParser =

+                soap12FaultSubCodeInFaultCodeWithParser.getValue();

+        soap12FaultSubCodeInSubCodeWithParser =

+                soap12FaultSubCodeInFaultCodeWithParser.getSubCode();

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultTest.java
new file mode 100644
index 0000000..3e21644
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultTest.java
@@ -0,0 +1,416 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMAbstractFactory;

+

+public class SOAPFaultTest extends SOAPFaultTestCase {

+

+    public SOAPFaultTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+    }

+

+    //SOAP 1.1 Fault Test (Programaticaly created)-----------------------------------------------------------------------------------

+    public void testSOAP11SetCode() {

+        soap11Fault.setCode(soap11Factory.createSOAPFaultCode(soap11Fault));

+        assertNotNull(

+                "SOAP 1.1 Fault Test:- After calling setCode method, Fault has no code",

+                soap11Fault.getCode());

+        try {

+            soap11Fault.setCode(soap12Factory.createSOAPFaultCode(soap12Fault));

+            fail("SOAP12FaultCode should not not be set in to a SOAP11Fault");

+        } catch (Exception e) {

+        }

+    }

+

+    public void testSOAP11GetCode() {

+        assertTrue(

+                "SOAP 1.1 Fault Test:- After creating a SOAP11Fault, it has a code",

+                soap11Fault.getCode() == null);

+        soap11Fault.setCode(soap11Factory.createSOAPFaultCode(soap11Fault));

+        assertFalse(

+                "SOAP 1.1 Fault Test:- After calling setCode method, Fault has no code",

+                soap11Fault.getCode() == null);

+    }

+

+    public void testSOAP11SetReason() {

+        soap11Fault.setReason(soap11Factory.createSOAPFaultReason(soap11Fault));

+        assertFalse(

+                "SOAP 1.1 Fault Test:- After calling setReason method, Fault has no reason",

+                soap11Fault.getReason() == null);

+        try {

+            soap11Fault.setReason(

+                    soap12Factory.createSOAPFaultReason(soap12Fault));

+            fail("SOAP12FaultReason should not be set in to a SOAP11Fault");

+

+        } catch (Exception e) {

+            assertTrue(true);

+        }

+    }

+

+    public void testSOAP11GetReason() {

+        assertTrue(

+                "SOAP 1.1 Fault Test:- After creating a SOAP11Fault, it has a reason",

+                soap11Fault.getReason() == null);

+        soap11Fault.setReason(soap11Factory.createSOAPFaultReason(soap11Fault));

+        assertFalse(

+                "SOAP 1.1 Fault Test:- After calling setReason method, Fault has no reason",

+                soap11Fault.getReason() == null);

+    }

+

+    public void testSOAP11SetNode() {

+        soap11Fault.setNode(soap11Factory.createSOAPFaultNode(soap11Fault));

+        assertFalse(

+                "SOAP 1.1 Fault Test:- After calling setNode method, Fault has no node",

+                soap11Fault.getNode() == null);

+        try {

+            soap11Fault.setNode(soap12Factory.createSOAPFaultNode(soap12Fault));

+            fail("SOAP12FaultNode should not be set in to a SOAP11Fault");

+

+        } catch (Exception e) {

+            assertTrue(true);

+

+        }

+    }

+

+    public void testSOAP11GetNode() {

+        assertTrue(

+                "SOAP 1.1 Fault Test:- After creating a SOAP11Fault, it has a node",

+                soap11Fault.getNode() == null);

+        soap11Fault.setNode(soap11Factory.createSOAPFaultNode(soap11Fault));

+        assertFalse(

+                "SOAP 1.1 Fault Test:- After calling setNode method, Fault has no node",

+                soap11Fault.getNode() == null);

+    }

+

+    public void testSOAP11SetRole() {

+        soap11Fault.setRole(soap11Factory.createSOAPFaultRole(soap11Fault));

+        assertFalse(

+                "SOAP 1.1 Fault Test:- After calling setRole method, Fault has no role",

+                soap11Fault.getRole() == null);

+        try {

+            soap11Fault.setRole(soap12Factory.createSOAPFaultRole(soap12Fault));

+            fail("SOAP12FaultRole should not be set in to a SOAP11Fault");

+        } catch (Exception e) {

+            assertTrue(true);

+        }

+    }

+

+    public void testSOAP11GetRole() {

+        assertTrue(

+                "SOAP 1.1 Fault Test:- After creating a SOAP11Fault, it has a role",

+                soap11Fault.getRole() == null);

+        soap11Fault.setRole(soap11Factory.createSOAPFaultRole(soap11Fault));

+        assertFalse(

+                "SOAP 1.1 Fault Test:- After calling setRole method, Fault has no role",

+                soap11Fault.getRole() == null);

+    }

+

+    public void testSOAP11SetDetail() {

+        soap11Fault.setDetail(soap11Factory.createSOAPFaultDetail(soap11Fault));

+        assertFalse(

+                "SOAP 1.1 Fault Test:- After calling setDetail method, Fault has no detail",

+                soap11Fault.getDetail() == null);

+        try {

+            soap11Fault.setDetail(

+                    soap12Factory.createSOAPFaultDetail(soap12Fault));

+            fail("SOAP12FaultDetail should not be set in to a SOAP11Fault");

+        } catch (Exception e) {

+            assertTrue(true);

+        }

+    }

+

+    public void testSOAP11GetDetail() {

+        assertTrue(

+                "SOAP 1.1 Fault Test:- After creating a SOAP11Fault, it has a detail",

+                soap11Fault.getDetail() == null);

+        soap11Fault.setDetail(soap11Factory.createSOAPFaultDetail(soap11Fault));

+        assertFalse(

+                "SOAP 1.1 Fault Test:- After calling setDetail method, Fault has no detail",

+                soap11Fault.getDetail() == null);

+    }

+

+    //SOAP 1.2 Fault Test ((Programaticaly created)--------------------------------------------------------------------------------

+    public void testSOAP12SetCode() {

+        soap12Fault.setCode(soap12Factory.createSOAPFaultCode(soap12Fault));

+        assertFalse(

+                "SOAP 1.2 Fault Test:- After calling setCode method, Fault has no code",

+                soap12Fault.getCode() == null);

+        assertTrue("SOAP 1.2 Fault Test:- Code local name mismatch",

+                soap12Fault.getCode().getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME));

+        try {

+            soap12Fault.setCode(soap11Factory.createSOAPFaultCode(soap11Fault));

+            fail("SOAP11FaultCode should not be set in to a SOAP12Fault");

+        } catch (Exception e) {

+            assertTrue(true);

+        }

+    }

+

+    public void testSOAP12GetCode() {

+        assertTrue(

+                "SOAP 1.2 Fault Test:- After creating a SOAP12Fault, it has a code",

+                soap12Fault.getCode() == null);

+        soap12Fault.setCode(soap12Factory.createSOAPFaultCode(soap12Fault));

+        assertFalse(

+                "SOAP 1.2 Fault Test:- After calling setCode method, Fault has no code",

+                soap12Fault.getCode() == null);

+        assertTrue("SOAP 1.2 Fault Test:- Fault code local name mismatch",

+                soap12Fault.getCode().getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME));

+    }

+

+    public void testSOAP12SetReason() {

+        soap12Fault.setReason(soap12Factory.createSOAPFaultReason(soap12Fault));

+        assertFalse(

+                "SOAP 1.2 Fault Test:- After calling setReason method, Fault has no reason",

+                soap12Fault.getReason() == null);

+        assertTrue("SOAP 1.2 Fault Test:- Fault reason local name mismatch",

+                soap12Fault.getReason().getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME));

+        try {

+            soap12Fault.setReason(

+                    soap11Factory.createSOAPFaultReason(soap11Fault));

+            fail("SOAP11FaultReason should not be set in to a SOAP12Fault");

+

+        } catch (Exception e) {

+            assertTrue(true);

+        }

+    }

+

+    public void testSOAP12GetReason() {

+        assertTrue(

+                "SOAP 1.2 Fault Test:- After creating a SOAP12Fault, it has a reason",

+                soap12Fault.getReason() == null);

+        soap12Fault.setReason(soap12Factory.createSOAPFaultReason(soap12Fault));

+        assertFalse(

+                "SOAP 1.2 Fault Test:- After calling setReason method, Fault has no reason",

+                soap12Fault.getReason() == null);

+        assertTrue("SOAP 1.2 Fault Test:- Fault reason local name mismatch",

+                soap12Fault.getReason().getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME));

+    }

+

+    public void testSOAP12SetNode() {

+        soap12Fault.setNode(soap12Factory.createSOAPFaultNode(soap12Fault));

+        assertFalse(

+                "SOAP 1.2 Fault Test:- After calling setNode method, Fault has no node",

+                soap12Fault.getNode() == null);

+        assertTrue("SOAP 1.2 Fault Test:- Fault node local name mismatch",

+                soap12Fault.getNode().getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME));

+        try {

+            soap12Fault.setNode(soap11Factory.createSOAPFaultNode(soap11Fault));

+            fail("SOAP11FaultNode should nott be set in to a SOAP12Fault");

+

+        } catch (Exception e) {

+            assertTrue(true);

+        }

+    }

+

+    public void testSOAP12GetNode() {

+        assertTrue(

+                "SOAP 1.2 Fault Test:- After creating a SOAP12Fault, it has a node",

+                soap12Fault.getNode() == null);

+        soap12Fault.setNode(soap12Factory.createSOAPFaultNode(soap12Fault));

+        assertFalse(

+                "SOAP 1.2 Fault Test:- After calling setNode method, Fault has no node",

+                soap12Fault.getNode() == null);

+        assertTrue("SOAP 1.2 Fault Test:- Fault node local name mismatch",

+                soap12Fault.getNode().getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME));

+    }

+

+    public void testSOAP12SetRole() {

+        soap12Fault.setRole(soap12Factory.createSOAPFaultRole(soap12Fault));

+        assertFalse(

+                "SOAP 1.2 :- After calling setRole method, Fault has no role",

+                soap12Fault.getRole() == null);

+        assertTrue("SOAP 1.2 Fault Test:- Fault role local name mismatch",

+                soap12Fault.getRole().getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME));

+        try {

+            soap12Fault.setRole(soap11Factory.createSOAPFaultRole(soap11Fault));

+            fail("SOAP11FaultRole should not be set in to a SOAP12Fault");

+        } catch (Exception e) {

+            assertTrue(true);

+        }

+    }

+

+    public void testSOAP12GetRole() {

+        assertTrue(

+                "SOAP 1.2 Fault Test:- After creating a SOAP11Fault, it has a role",

+                soap12Fault.getRole() == null);

+        soap12Fault.setRole(soap12Factory.createSOAPFaultRole(soap12Fault));

+        assertFalse(

+                "SOAP 1.2 Fault Test:- After calling setRole method, Fault has no role",

+                soap12Fault.getRole() == null);

+        assertTrue("SOAP 1.2 Fault Test:- Fault role local name mismatch",

+                soap12Fault.getRole().getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME));

+    }

+

+    public void testSOAP12SetDetail() {

+        soap12Fault.setDetail(soap12Factory.createSOAPFaultDetail(soap12Fault));

+        assertFalse(

+                "SOAP 1.2 Fault Test:- After calling setDetaile method, Fault has no detail",

+                soap12Fault.getDetail() == null);

+        assertTrue("SOAP 1.2 Fault Test:- Fault detail local name mismatch",

+                soap12Fault.getDetail().getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME));

+        try {

+            soap12Fault.setDetail(

+                    soap11Factory.createSOAPFaultDetail(soap11Fault));

+            fail("SOAP11FaultDetail should not be set in to a SOAP12Fault");

+

+        } catch (Exception e) {

+            assertTrue(true);

+        }

+    }

+

+    public void testSOAP12GetDetail() {

+        assertTrue(

+                "SOAP 1.2 Fault Test:- After creating a SOAP12Fault, it has a detail",

+                soap12Fault.getDetail() == null);

+        soap12Fault.setDetail(soap12Factory.createSOAPFaultDetail(soap12Fault));

+        assertFalse(

+                "SOAP 1.2 Fault Test:- After calling setDetail method, Fault has no detail",

+                soap12Fault.getDetail() == null);

+        assertTrue("SOAP 1.2 Fault Test:- Fault detail local name mismatch",

+                soap12Fault.getDetail().getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME));

+    }

+

+    //SOAP 1.1 Fault Test (With parser)

+    public void testSOAP11GetCodeWithParser() {

+        assertFalse(

+                "SOAP 1.1 Fault Test with parser: - getCode method returns null",

+                soap11FaultWithParser.getCode() == null);

+    }

+

+    public void testSOAP11GetRoleWithParser() {

+        assertFalse(

+                "SOAP 1.1 Fault Test with parser: - getRole method returns null",

+                soap11FaultWithParser.getRole() == null);

+    }

+

+    public void testSOAP11GetDetailWithParser() {

+        assertFalse(

+                "SOAP 1.1 Fault Test with parser: - getDetail method returns null",

+                soap11FaultWithParser.getDetail() == null);

+    }

+

+    //SOAP 1.2 Fault Test (With parser)

+    public void testSOAP12GetCodeWithParser() {

+        assertFalse(

+                "SOAP 1.2 Fault Test with parser: - getCode method returns null",

+                soap12FaultWithParser.getCode() == null);

+        assertTrue(

+                "SOAP 1.2 Fault Test with parser: - Fault code local name mismatch",

+                soap12FaultWithParser.getCode().getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME));

+    }

+

+    public void testSOAP12GetReasonWithParser() {

+        assertFalse(

+                "SOAP 1.2 Fault Test with parser: - getReason method returns null",

+                soap12FaultWithParser.getReason() == null);

+        assertTrue(

+                "SOAP 1.2 Fault Test with parser: - Fault reason local name mismatch",

+                soap12FaultWithParser.getReason().getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME));

+    }

+

+    public void testSOAP12GetNodeWithParser() {

+        assertFalse(

+                "SOAP 1.2 Fault Test with parser: - getNode method returns null",

+                soap12FaultWithParser.getNode() == null);

+        assertTrue(

+                "SOAP 1.2 Fault Test with parser: - Fault node local name mismatch",

+                soap12FaultWithParser.getNode().getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME));

+    }

+

+    public void testSOAP12GetRoleWithParser() {

+        assertFalse(

+                "SOAP 1.2 Fault Test with parser: - getRole method returns null",

+                soap12FaultWithParser.getRole() == null);

+        assertTrue(

+                "SOAP 1.2 Fault Test with parser: - Fault role local name mismatch",

+                soap12FaultWithParser.getRole().getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME));

+    }

+

+    public void testSOAP12GetDetailWithParser() {

+        assertFalse(

+                "SOAP 1.2 Fault Test with parser: - getDetail method returns null",

+                soap12FaultWithParser.getDetail() == null);

+        assertTrue(

+                "SOAP 1.2 Fault Test with parser: - Fault detail local name mismatch",

+                soap12FaultWithParser.getDetail().getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME));

+    }

+

+    public void testMoreChildrenAddition() {

+        try {

+            SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory();

+            SOAPEnvelope envelope = soapFactory.getDefaultFaultEnvelope();

+

+            assertNotNull("Default FaultEnvelope must have a SOAPFault in it",

+                    envelope.getBody().getFault());

+            assertNotNull(

+                    "Default FaultEnvelope must have a SOAPFaultCode in it",

+                    envelope.getBody().getFault().getCode());

+            assertNotNull(

+                    "Default FaultEnvelope must have a SOAPFaultCodeValue in it",

+                    envelope.getBody().getFault().getCode().getValue());

+            assertNotNull(

+                    "Default FaultEnvelope must have a SOAPFaultReason in it",

+                    envelope.getBody().getFault().getReason());

+            assertNotNull(

+                    "Default FaultEnvelope must have a SOAPFaultText in it",

+                    envelope.getBody().getFault().getReason().getFirstSOAPText());

+

+            SOAPEnvelope soapEnvelope = soapFactory.getDefaultFaultEnvelope();

+            String errorCodeString = "Some Error occurred !!";

+            soapEnvelope.getBody().getFault().getCode().getValue().setText(

+                    errorCodeString);

+

+            SOAPFaultCode code = soapEnvelope.getBody().getFault().getCode();

+            envelope.getBody().getFault().setCode(code);

+

+            assertTrue("Parent Value of Code has not been set to new fault",

+                    code.getParent() == envelope.getBody().getFault());

+            assertTrue("Parent Value of Code is still pointing to old fault",

+                    code.getParent() != soapEnvelope.getBody().getFault());

+            assertNull("Old fault must not have a fault code",

+                    soapEnvelope.getBody().getFault().getCode());

+            assertEquals("The SOAP Code value must be " + errorCodeString,

+                    errorCodeString,

+                    envelope.getBody().getFault().getCode().getValue().getText());

+

+        } catch (Exception e) {

+            fail(e.getMessage());

+        }

+

+

+    }

+}
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultTestCase.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultTestCase.java
new file mode 100644
index 0000000..0d48485
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultTestCase.java
@@ -0,0 +1,42 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMAbstractFactory;

+

+public abstract class SOAPFaultTestCase extends SOAPBodyTestCase {

+    protected SOAPFault soap11Fault;

+    protected SOAPFault soap12Fault;

+    protected SOAPFault soap11FaultWithParser;

+    protected SOAPFault soap12FaultWithParser;

+

+    public SOAPFaultTestCase(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+        soap11Fault =

+                OMAbstractFactory.getSOAP11Factory().createSOAPFault(

+                        soap11Body);

+        soap12Fault =

+                OMAbstractFactory.getSOAP12Factory().createSOAPFault(

+                        soap12Body);

+        soap11FaultWithParser = soap11BodyWithParser.getFault();

+        soap12FaultWithParser = soap12BodyWithParser.getFault();

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultTextTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultTextTest.java
new file mode 100644
index 0000000..5ce0d12
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultTextTest.java
@@ -0,0 +1,177 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMAttribute;

+

+public class SOAPFaultTextTest extends SOAPFaultReasonTestCase {

+    protected SOAPFaultText soap11FaultText;

+    protected SOAPFaultText soap12FaultText;

+    protected SOAPFaultText soap11FaultTextWithParser;

+    protected SOAPFaultText soap12FaultTextWithParser;

+

+    public SOAPFaultTextTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+        soap11FaultText = soap11Factory.createSOAPFaultText(soap11FaultReason);

+        soap12FaultText = soap12Factory.createSOAPFaultText(soap12FaultReason);

+        soap11FaultTextWithParser = soap11FaultReasonWithParser.getFirstSOAPText();

+        soap12FaultTextWithParser = soap12FaultReasonWithParser.getFirstSOAPText();

+    }

+

+    //SOAP 1.1 Fault Text Test (Programaticaly Created)

+    public void testSOAP11SetLang() {

+        soap11FaultText.setLang("en");

+        assertTrue(

+                "SOAP 1.1 Fault Text Test : - After calling setLang method, Lang attribute value mismatch",

+                soap11FaultText.getLang().equals("en"));

+        OMAttribute langAttribute = (OMAttribute) soap11FaultText.getAllAttributes()

+                .next();

+        assertTrue(

+                "SOAP 1.1 Fault Text Test : - After calling setLang method, Lang attribute local name mismaatch",

+                langAttribute.getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME));

+        assertTrue(

+                "SOAP 1.1 Fault Text Test : - After calling setLang method, Lang attribute namespace prefix mismatch",

+                langAttribute.getNamespace().getPrefix().equals(

+                        SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX));

+        assertTrue(

+                "SOAP 1.1 Fault Text Test : - After calling setLang method, Lang attribute namespace uri mismatch",

+                langAttribute.getNamespace().getNamespaceURI().equals(

+                        SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI));

+    }

+

+    public void testSOAP11GetLang() {

+

+

+        assertNull(

+                "SOAP 1.1 Fault Text Test : - After creating SOAPFaultText, it has a Lnag attribute",

+                soap11FaultText.getLang());

+

+        soap11FaultText.setLang("en");

+        assertTrue(

+                "SOAP 1.1 Fault Text Test : - After calling setLang method, Lang attribute value mismatch",

+                soap11FaultText.getLang().equals("en"));

+    }

+

+    public void testSOAP11SetText() {

+        soap11FaultText.setText("This is only a test");

+        assertTrue(

+                "SOAP 1.1 Fault Text Test : - After calling setText method, getText method return incorrect string",

+                soap11FaultText.getText().equals("This is only a test"));

+    }

+

+    public void testSOAP11GetText() {

+        assertTrue(

+                "SOAP 1.1 Fault Text Test : - After creating SOAPFaultText, it has a text",

+                soap11FaultText.getText().equals(""));

+        soap11FaultText.setText("This is only a test");

+        assertTrue(

+                "SOAP 1.1 Fault Text Test : - After calling setText method, getText method return incorrect string",

+                soap11FaultText.getText().equals("This is only a test"));

+    }

+

+    //SOAP 1.2 Fault Text Test (Programaticaly Created)

+    public void testSOAP12SetLang() {

+        soap12FaultText.setLang("en");

+        assertTrue(

+                "SOAP 1.2 Fault Text Test : - After calling setLang method, Lang attribute value mismatch",

+                soap12FaultText.getLang().equals("en"));

+        OMAttribute langAttribute = (OMAttribute) soap12FaultText.getAllAttributes()

+                .next();

+        assertTrue(

+                "SOAP 1.2 Fault Text Test : - After calling setLang method, Lang attribute local name mismaatch",

+                langAttribute.getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME));

+        assertTrue(

+                "SOAP 1.2 Fault Text Test : - After calling setLang method, Lang attribute namespace prefix mismatch",

+                langAttribute.getNamespace().getPrefix().equals(

+                        SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX));

+        assertTrue(

+                "SOAP 1.2 Fault Text Test : - After calling setLang method, Lang attribute namespace uri mismatch",

+                langAttribute.getNamespace().getNamespaceURI().equals(

+                        SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI));

+    }

+

+    public void testSOAP12GetLang() {

+

+        assertNull(

+                "SOAP 1.2 Fault Text Test : - After creating SOAPFaultText, it has a Lnag attribute",

+                soap12FaultText.getLang());

+

+        soap12FaultText.setLang("en");

+        assertTrue(

+                "SOAP 1.2 Fault Text Test : - After calling setLang method, Lang attribute value mismatch",

+                soap12FaultText.getLang().equals("en"));

+    }

+

+    public void testSOAP12SetText() {

+        soap12FaultText.setText("This is only a test");

+        assertTrue(

+                "SOAP 1.2 Fault Text Test : - After calling setText method, getText method return incorrect string",

+                soap12FaultText.getText().equals("This is only a test"));

+    }

+

+    public void testSOAP12GetText() {

+        assertTrue(

+                "SOAP 1.2 Fault Text Test : - After creating SOAPFaultText, it has a text",

+                soap12FaultText.getText().equals(""));

+        soap12FaultText.setText("This is only a test");

+        assertTrue(

+                "SOAP 1.2 Fault Text Test : - After calling setText method, getText method return incorrect string",

+                soap12FaultText.getText().equals("This is only a test"));

+    }

+

+    //SOAP 1.1 Fault Text Test (With Parser)

+    public void testSOAP11GetTextWithParser() {

+        assertTrue(

+                "SOAP 1.1 Fault Text Test With Parser : - getText method returns incorrect string",

+                soap11FaultTextWithParser.getText().trim().equals("Sender Timeout"));

+    }

+

+    //SOAP 1.2 Fault Text Test (With Parser)

+    public void testSOAP12GetLangWithParser() {

+        assertTrue(

+                "SOAP 1.2 Fault Text Test With Parser : - getLang method returns incorrect string",

+                soap12FaultTextWithParser.getLang().equals("en"));

+        OMAttribute langAttribute = (OMAttribute) soap12FaultTextWithParser.getAllAttributes()

+                .next();

+        assertTrue(

+                "SOAP 1.2 Fault Text Test With Parser : - Lang attribute local name mismaatch",

+                langAttribute.getLocalName().equals(

+                        SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME));

+        assertTrue(

+                "SOAP 1.2 Fault Text Test With Parser : - Lang attribute namespace prefix mismatch",

+                langAttribute.getNamespace().getPrefix().equals(

+                        SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX));

+        assertTrue(

+                "SOAP 1.2 Fault Text Test With Parser : - Lang attribute namespace uri mismatch",

+                langAttribute.getNamespace().getNamespaceURI().equals(

+                        SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI));

+    }

+

+    public void testSOAP12GetTextWithParser() {

+    	

+        assertTrue(

+                "SOAP 1.2 Fault Text Test With Parser : - getText method returns incorrect string",

+                soap12FaultTextWithParser.getText().equals("Sender Timeout"));

+        													

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultValueTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultValueTest.java
new file mode 100644
index 0000000..44ab9f4
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPFaultValueTest.java
@@ -0,0 +1,118 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+public class SOAPFaultValueTest extends SOAPFaultSubCodeTestCase {

+

+    public SOAPFaultValueTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+        soap12FaultValueInFaultSubCode =

+                soap12Factory.createSOAPFaultValue(soap12FaultSubCodeInCode);

+    }

+

+    //SOAP 1.1 Fault Value Test (Programaticaly Created)

+    public void testSOAP11setText() {

+        soap11FaultValue.setText("This is only Test");

+        assertTrue("SOAP 1.1 Fault Value Test : - value text mismatch",

+                soap11FaultValue.getText().equals("This is only Test"));

+    }

+

+    public void testSOAP11GetText() {

+        assertTrue(

+                "SOAP 1.1 Fault Value Test : - After creating Fault Value, it has a text",

+                soap11FaultValue.getText().equals(""));

+        soap11FaultValue.setText("This is only Test");

+        assertFalse(

+                "SOAP 1.1 Fault Value Test : - After calling setText method, getText method returns null",

+                soap11FaultValue.getText().equals(""));

+        assertTrue("SOAP 1.1 Fault Value Test : - value text mismatch",

+                soap11FaultValue.getText().equals("This is only Test"));

+    }

+

+    //SOAP 1.2 Fault Value(In Fault Code) Test (Programaticaly Created)

+    public void testSOAP12setTextInFaultCode() {

+        soap12FaultValueInFaultCode.setText("This is only Test");

+        assertTrue(

+                "SOAP 1.2 Fault Value Test in Fault Code : - value text mismatch",

+                soap12FaultValueInFaultCode.getText().equals(

+                        "This is only Test"));

+    }

+

+    public void testSOAP12GetTextInFaultCode() {

+        assertTrue(

+                "SOAP 1.2 Fault Value Test in Fault Code : - After creating Fault Value, it has a text",

+                soap12FaultValueInFaultCode.getText().equals(""));

+        soap12FaultValueInFaultCode.setText("This is only Test");

+        assertFalse(

+                "SOAP 1.2 Fault Value Test in Fault Code : - After calling setText method, getText method returns null",

+                soap12FaultValueInFaultCode.getText().equals(""));

+        assertTrue(

+                "SOAP 1.2 Fault Value Test in Fault Code : - value text mismatch",

+                soap12FaultValueInFaultCode.getText().equals(

+                        "This is only Test"));

+    }

+

+    //SOAP 1.2 Fault Value(In Fault SubCode) Test (Programaticaly Created)

+    public void testSOAP12setTextInFaultSubCode() {

+        soap12FaultValueInFaultSubCode.setText("This is only Test");

+        assertTrue(

+                "SOAP 1.2 Fault Value Test in Fault SubCode : - value text mismatch",

+                soap12FaultValueInFaultSubCode.getText().equals(

+                        "This is only Test"));

+    }

+

+    public void testSOAP12GetTextInFaultSubCode() {

+        assertTrue(

+                "SOAP 1.2 Fault Value Test in Fault SubCode : - After creating Fault Value, it has a text",

+                soap12FaultValueInFaultSubCode.getText().equals(""));

+        soap12FaultValueInFaultSubCode.setText("This is only Test");

+        assertFalse(

+                "SOAP 1.2 Fault Value Test in Fault SubCode : - After calling setText method, getText method returns null",

+                soap12FaultValueInFaultSubCode.getText().equals(""));

+        assertTrue(

+                "SOAP 1.2 Fault Value Test in Fault SubCode : - value text mismatch",

+                soap12FaultValueInFaultSubCode.getText().equals(

+                        "This is only Test"));

+    }

+

+    //SOAP 1.1 Fault Value Test (With Parser)

+    public void testSOAP11GetTextWithParser() {

+        assertTrue(

+                "SOAP 1.1 Fault Value Test with parser : - value text mismatch",

+                soap11FaultValueWithParser.getText().trim().equals("env:Sender"));

+    }

+

+    //SOAP 1.2 Fault Value(In Fault Code) Test (With Parser)

+    public void testSOAP12setTextWithParserInFaultCode() {

+        assertTrue(

+                "SOAP 1.2 Fault Value Test with parser in Fault Code : - value text mismatch",

+                soap12FaultValueInFaultCodeWithParser.getText().equals(

+                        "env:Sender"));

+    }

+

+    //SOAP 1.2 Fault Value(In Fault SubCode) Test (With Parser)

+    public void testSOAP12setTextWithParserInFaultSubCode() {

+        assertTrue(

+                "SOAP 1.2 Fault Value Test with parser in Fault SubCode : - value text mismatch",

+                soap12FaultValueInFaultSubCodeWithParser.getText().equals(

+                        "m:MessageTimeout In First Subcode"));

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPHeaderBlockTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPHeaderBlockTest.java
new file mode 100644
index 0000000..66725cd
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPHeaderBlockTest.java
@@ -0,0 +1,238 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import java.util.Iterator;

+

+public class SOAPHeaderBlockTest extends SOAPHeaderTestCase {

+    protected SOAPHeaderBlock soap11HeaderBlock;

+    protected SOAPHeaderBlock soap12HeaderBlock;

+    protected SOAPHeaderBlock soap11HeaderBlock1WithParser;

+    protected SOAPHeaderBlock soap12HeaderBlock1WithParser;

+    protected SOAPHeaderBlock soap11HeaderBlock2WithParser;

+    protected SOAPHeaderBlock soap12HeaderBlock2WithParser;

+    protected SOAPHeaderBlock soap11HeaderBlock3WithParser;

+    protected SOAPHeaderBlock soap12HeaderBlock3WithParser;

+

+    public SOAPHeaderBlockTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+        soap11HeaderBlock =

+                soap11Factory.createSOAPHeaderBlock("testHeaderBlock",

+                        namespace,

+                        soap11Header);

+        soap12HeaderBlock =

+                soap12Factory.createSOAPHeaderBlock("testHeaderBlock",

+                        namespace,

+                        soap12Header);

+        Iterator iterator = soap11HeaderWithParser.examineAllHeaderBlocks();

+        iterator.next();

+        soap11HeaderBlock1WithParser = (SOAPHeaderBlock) iterator.next();

+        iterator.next();

+        soap11HeaderBlock2WithParser = (SOAPHeaderBlock) iterator.next();

+        iterator.next();

+        soap11HeaderBlock3WithParser = (SOAPHeaderBlock) iterator.next();

+

+        iterator = soap12HeaderWithParser.examineAllHeaderBlocks();

+        iterator.next();

+        soap12HeaderBlock1WithParser = (SOAPHeaderBlock) iterator.next();

+        iterator.next();

+        soap12HeaderBlock2WithParser = (SOAPHeaderBlock) iterator.next();

+        iterator.next();

+        soap12HeaderBlock3WithParser = (SOAPHeaderBlock) iterator.next();

+    }

+

+    //SOAP 1.1 SOAPHeaderBlock Test (Programaticaly Created)

+    public void testSOAP11SetRole() {

+        soap11HeaderBlock.setRole(

+                "http://schemas.xmlsoap.org/soap/envelope/actor/next");

+        assertTrue(

+                "SOAP 1.1 HeaderBlock Test : - After calling setRole method, getRole method returns incorrect role value",

+                soap11HeaderBlock.getRole().equals(

+                        "http://schemas.xmlsoap.org/soap/envelope/actor/next"));

+        try {

+            soap11HeaderBlock.setRole("Any Value");

+        } catch (Exception e) {

+            fail(

+                    "SOAP 1.1 HeaderBlock Test : - role value can not be set to any value");

+        }

+    }

+

+    public void testSOAP11GetRole() {

+        assertTrue(

+                "SOAP 1.1 HeaderBlock Test : - After creating SOAPHeaderBlock, it has a role",

+                soap11HeaderBlock.getRole() == null);

+        soap11HeaderBlock.setRole(

+                "http://schemas.xmlsoap.org/soap/envelope/actor/next");

+        assertTrue(

+                "SOAP 1.1 HeaderBlock Test : - After calling setRole method, getRole method returns incorrect role value",

+                soap11HeaderBlock.getRole().equals(

+                        "http://schemas.xmlsoap.org/soap/envelope/actor/next"));

+    }

+

+    public void testSOAP11SetMustUnderstand() {

+        soap11HeaderBlock.setMustUnderstand(true);

+        assertTrue(

+                "SOAP 1.1 HeaderBlock Test : - After setting MustUnderstand true calling setMustUnderstand method , getMustUnderstand method returns false",

+                soap11HeaderBlock.getMustUnderstand());

+        soap11HeaderBlock.setMustUnderstand(false);

+        assertFalse(

+                "SOAP 1.1 HeaderBlock Test : - After setting MustUnderstand false calling setMustUnderstand method , getMustUnderstand method returns true",

+                soap11HeaderBlock.getMustUnderstand());

+        soap11HeaderBlock.setMustUnderstand("1");

+        assertTrue(

+                "SOAP 1.1 HeaderBlock Test : - After setting MustUnderstand \"1\" calling setMustUnderstand method , getMustUnderstand method returns false",

+                soap11HeaderBlock.getMustUnderstand());

+        soap11HeaderBlock.setMustUnderstand("0");

+        assertFalse(

+                "SOAP 1.1 HeaderBlock Test : - After setting MustUnderstand \"0\" calling setMustUnderstand method , getMustUnderstand method returns true",

+                soap11HeaderBlock.getMustUnderstand());

+        try {

+            soap11HeaderBlock.setMustUnderstand("true");

+        } catch (Exception e) {

+            fail(

+                    "SOAP 1.1 HeaderBlock Test : - MustUnderstatnd value can not be set to any value rather than 1 or 0");

+        }

+    }

+

+    public void testSOAP11GetMustUnderstand() {

+        assertFalse(

+                "SOAP 1.1 HeaderBlock Test : - After creating SOAPHeaderBlock, default MustUnderstand value true",

+                soap11HeaderBlock.getMustUnderstand());

+        soap11HeaderBlock.setMustUnderstand(true);

+        assertTrue(

+                "SOAP 1.1 HeaderBlock Test : - After setting MustUnderstand true calling setMustUnderstand method , getMustUnderstand method returns false",

+                soap11HeaderBlock.getMustUnderstand());

+    }

+

+    //SOAP 1.2 SOAPHeaderBlock Test (Programaticaly Created)

+    public void testSOAP12SetRole() {

+        soap12HeaderBlock.setRole(

+                "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver");

+        assertTrue(

+                "SOAP 1.2 HeaderBlock Test : - After calling setRole method, getRole method returns incorrect role value",

+                soap12HeaderBlock.getRole().equals(

+                        "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"));

+        try {

+            soap12HeaderBlock.setRole("Any Value");

+        } catch (Exception e) {

+            fail(

+                    "SOAP 1.2 HeaderBlock Test : - role value can not be set to any value");

+        }

+    }

+

+    public void testSOAP12GetRole() {

+        assertTrue(

+                "SOAP 1.2 HeaderBlock Test : - After creating SOAPHeaderBlock, it has a role",

+                soap12HeaderBlock.getRole() == null);

+        soap12HeaderBlock.setRole(

+                "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver");

+        assertTrue(

+                "SOAP 1.2 HeaderBlock Test : - After calling setRole method, getRole method returns incorrect role value",

+                soap12HeaderBlock.getRole().equals(

+                        "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"));

+    }

+

+    public void testSOAP12SetMustUnderstand() {

+        soap12HeaderBlock.setMustUnderstand(true);

+        assertTrue(

+                "SOAP 1.2 HeaderBlock Test : - After setting MustUnderstand true calling setMustUnderstand method , getMustUnderstand method returns false",

+                soap12HeaderBlock.getMustUnderstand());

+        soap12HeaderBlock.setMustUnderstand(false);

+        assertFalse(

+                "SOAP 1.2 HeaderBlock Test : - After setting MustUnderstand false calling setMustUnderstand method , getMustUnderstand method returns true",

+                soap12HeaderBlock.getMustUnderstand());

+        soap12HeaderBlock.setMustUnderstand("true");

+        assertTrue(

+                "SOAP 1.2 HeaderBlock Test : - After setting MustUnderstand \"true\" calling setMustUnderstand method , getMustUnderstand method returns false",

+                soap12HeaderBlock.getMustUnderstand());

+        soap12HeaderBlock.setMustUnderstand("false");

+        assertFalse(

+                "SOAP 1.2 HeaderBlock Test : - After setting MustUnderstand \"false\" calling setMustUnderstand method , getMustUnderstand method returns true",

+                soap12HeaderBlock.getMustUnderstand());

+        soap12HeaderBlock.setMustUnderstand("1");

+        assertTrue(

+                "SOAP 1.2 HeaderBlock Test : - After setting MustUnderstand \"1\" calling setMustUnderstand method , getMustUnderstand method returns false",

+                soap12HeaderBlock.getMustUnderstand());

+        soap12HeaderBlock.setMustUnderstand("0");

+        assertFalse(

+                "SOAP 1.2 HeaderBlock Test : - After setting MustUnderstand \"0\" calling setMustUnderstand method , getMustUnderstand method returns true",

+                soap12HeaderBlock.getMustUnderstand());

+        try {

+            soap12HeaderBlock.setMustUnderstand("otherValue");

+            fail(

+                    "SOAP 1.2 HeaderBlock Test : - MustUnderstatnd value can not be set to any value rather than 1 , 0 , true , false");

+

+        } catch (Exception e) {

+            assertTrue(true);

+        }

+    }

+

+    public void testSOAP12GetMustUnderstand() {

+        assertFalse(

+                "SOAP 1.2 HeaderBlock Test : - After creating SOAPHeaderBlock, default MustUnderstand value true",

+                soap12HeaderBlock.getMustUnderstand());

+        soap12HeaderBlock.setMustUnderstand(true);

+        assertTrue(

+                "SOAP 1.2 HeaderBlock Test : - After setting MustUnderstand true calling setMustUnderstand method , getMustUnderstand method returns false",

+                soap12HeaderBlock.getMustUnderstand());

+    }

+

+    //SOAP 1.1 SOAPHeaderBlock Test (With Parser)

+    public void testSOAP11GetRoleWithParser() {

+        assertTrue(

+                "SOAP 1.1 HeaderBlock Test Wiht Parser : - getRole method returns incorrect role value",

+                soap11HeaderBlock1WithParser.getRole().equals(

+                        "http://schemas.xmlsoap.org/soap/actor/next"));

+    }

+

+    public void testSOAP11GetMustUnderstandWithParser() {

+        assertTrue(

+                "SOAP 1.1 HeaderBlock Test Wiht Parser : - getMustUnderstatnd method returns incorrect value",

+                soap11HeaderBlock2WithParser.getMustUnderstand());

+        assertFalse(

+                "SOAP 1.1 HeaderBlock Test Wiht Parser : - getMustUnderstatnd method returns incorrect value",

+                soap11HeaderBlock3WithParser.getMustUnderstand());

+

+    }

+

+    //SOAP 1.2 SOAPHeaderBlock Test (With Parser)

+    public void testSOAP12GetRoleWithParser() {

+        assertTrue(

+                "SOAP 1.2 HeaderBlock Test Wiht Parser : - getRole method returns incorrect role value",

+                soap12HeaderBlock1WithParser.getRole().equals(

+                        "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"));

+    }

+

+    public void testSOAP12GetMustUnderstandWithParser() {

+        assertTrue(

+                "SOAP 1.2 HeaderBlock Test Wiht Parser : - getMustUnderstatnd method returns incorrect value",

+                soap12HeaderBlock1WithParser.getMustUnderstand());

+        assertFalse(

+                "SOAP 1.2 HeaderBlock Test Wiht Parser : - getMustUnderstatnd method returns incorrect value",

+                soap12HeaderBlock2WithParser.getMustUnderstand());

+        try {

+            soap12HeaderBlock3WithParser.getMustUnderstand();

+        } catch (Exception e) {

+            fail(

+                    "SOAP 1.2 HeaderBlock Test Wiht Parser : - getMustUnderstatnd method should returns exception when mustunderstand value is incorrect");

+        }

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPHeaderTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPHeaderTest.java
new file mode 100644
index 0000000..2d0798e
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPHeaderTest.java
@@ -0,0 +1,464 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import java.util.ArrayList;

+import java.util.Iterator;

+

+public class SOAPHeaderTest extends SOAPHeaderTestCase {

+    protected boolean isThereException;

+

+    public SOAPHeaderTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+    }

+

+    //SOAP 1.1 Header Test (Programaticaly Created)--------------------------------------------------------------------------------

+    public void testSOAP11AddHeadearBlock() {

+        soap11Header.addHeaderBlock("echoOk1", namespace);

+        soap11Header.addHeaderBlock("echoOk2", namespace);

+        Iterator iterator = soap11Header.getChildren();

+        SOAPHeaderBlock headerBlock1 = (SOAPHeaderBlock) iterator.next();

+        assertFalse(

+                "SOAP 1.1 Header Test : - After calling addHeaderBlock method twice, getChildren method returns empty iterator",

+                headerBlock1 == null);

+        assertTrue("SOAP 1.1 Header Test : - HeaderBlock1 local name mismatch",

+                headerBlock1.getLocalName().equals("echoOk1"));

+        assertTrue(

+                "SOAP 1.1 Header Test : - HeaderBlock1 namespace uri mismatch",

+                headerBlock1.getNamespace().getNamespaceURI().equals(

+                        "http://www.example.org"));

+

+        SOAPHeaderBlock headerBlock2 = (SOAPHeaderBlock) iterator.next();

+        assertFalse(

+                "SOAP 1.1 Header Test : - After calling addHeaderBlock method twice, getChildren method returns an iterator with only one object",

+                headerBlock2 == null);

+        assertTrue("SOAP 1.1 Header Test : - HeaderBlock2 local name mismatch",

+                headerBlock2.getLocalName().equals("echoOk2"));

+        assertTrue(

+                "SOAP 1.1 Header Test : - HeaderBlock2 namespace uri mismatch",

+                headerBlock2.getNamespace().getNamespaceURI().equals(

+                        "http://www.example.org"));

+

+        assertTrue(

+                "SOAP 1.1 Header Test : - After calling addHeaderBlock method twice, getChildren method returns an iterator with more than two object",

+                !iterator.hasNext());

+    }

+

+    public void testSOAP11ExamineHeaderBlocks() {

+        soap11Header.addHeaderBlock("echoOk1", namespace).setRole(

+                "http://schemas.xmlsoap.org/soap/envelope/actor/ultimateReceiver");

+        soap11Header.addHeaderBlock("echoOk2", namespace).setRole(

+                "http://schemas.xmlsoap.org/soap/envelope/actor/next");

+        Iterator iterator = soap11Header.examineHeaderBlocks(

+                "http://schemas.xmlsoap.org/soap/envelope/actor/next");

+        iterator.hasNext();

+        SOAPHeaderBlock headerBlockWithRole1 = (SOAPHeaderBlock) iterator.next();

+        assertTrue(

+                "SOAP 1.1 Header Test : - headerBlockWithRole local name mismatch",

+                headerBlockWithRole1.getLocalName().equals("echoOk2"));

+        assertTrue(

+                "SOAP 1.1 Header Test : - headerBlockWithRole role value mismatch",

+                headerBlockWithRole1.getRole().equals(

+                        "http://schemas.xmlsoap.org/soap/envelope/actor/next"));

+

+

+        assertFalse(

+                "SOAP 1.1 Header Test : - header has three headerBlocks with the given role, but examineHeaderBlocks(String role) method returns an iterator with more than three objects",

+                iterator.hasNext());

+    }

+

+//    public void testSOAP11ExtractHeaderBlocks() {

+

+//    }

+

+

+    public void testSOAP11ExamineAllHeaderBlocks() {

+        soap11Header.addHeaderBlock("echoOk1", namespace);

+        soap11Header.addHeaderBlock("echoOk2", namespace);

+        Iterator iterator = soap11Header.examineAllHeaderBlocks();

+        iterator.hasNext();

+        SOAPHeaderBlock headerBlock1 = (SOAPHeaderBlock) iterator.next();

+        assertFalse(

+                "SOAP 1.1 Header Test : - After calling addHeaderBlock method twice, examineAllHeaderBlocks method returns empty iterator",

+                headerBlock1 == null);

+        assertTrue("SOAP 1.1 Header Test : - HeaderBlock1 local name mismatch",

+                headerBlock1.getLocalName().equals("echoOk1"));

+        assertTrue(

+                "SOAP 1.1 Header Test : - HeaderBlock1 namespace uri mismatch",

+                headerBlock1.getNamespace().getNamespaceURI().equals(

+                        "http://www.example.org"));

+

+        iterator.hasNext();

+        SOAPHeaderBlock headerBlock2 = (SOAPHeaderBlock) iterator.next();

+        assertFalse(

+                "SOAP 1.1 Header Test : - After calling addHeaderBlock method twice, examineAllHeaderBlocks method returns an iterator with only one object",

+                headerBlock2 == null);

+        assertTrue("SOAP 1.1 Header Test : - HeaderBlock2 local name mismatch",

+                headerBlock2.getLocalName().equals("echoOk2"));

+        assertTrue(

+                "SOAP 1.1 Header Test : - HeaderBlock2 namespace uri mismatch",

+                headerBlock2.getNamespace().getNamespaceURI().equals(

+                        "http://www.example.org"));

+

+        assertFalse(

+                "SOAP 1.1 Header Test : - After calling addHeaderBlock method twice, examineAllHeaderBlocks method returns an iterator with more than two object",

+                iterator.hasNext());

+

+    }

+

+//    public void testSOAP11ExtractAllHeaderBlocks() {

+//

+//    }

+

+

+    public void testSOAP11getHeaderBlocksWithNSURI() {

+        soap11Header.addHeaderBlock("echoOk1", namespace);

+        soap11Header.addHeaderBlock("echoOk2",

+                omFactory.createOMNamespace("http://www.test1.org", "test1"));

+        ArrayList arrayList = soap11Header.getHeaderBlocksWithNSURI(

+                "http://www.test1.org");

+        assertTrue(

+                "SOAP 1.1 Header Test : - getHeaderBlocksWithNSURI returns an arrayList of incorrect size",

+                arrayList.size() == 1);

+        assertTrue(

+                "SOAP 1.1 Header Test : - headerBlock of given namespace uri mismatch",

+                ((SOAPHeaderBlock) arrayList.get(0)).getNamespace().getNamespaceURI()

+                        .equals("http://www.test1.org"));

+    }

+

+    //SOAP 1.2 Header Test (Programaticaly Created)----------------------------------------------------------------------------------

+    public void testSOAP12AddHeadearBlock() {

+        soap12Header.addHeaderBlock("echoOk1", namespace);

+        soap12Header.addHeaderBlock("echoOk2", namespace);

+        Iterator iterator = soap12Header.getChildren();

+        SOAPHeaderBlock headerBlock1 = (SOAPHeaderBlock) iterator.next();

+        assertFalse(

+                "SOAP 1.2 Header Test : - After calling addHeaderBlock method, getChildren method returns empty iterator",

+                headerBlock1 == null);

+        assertTrue("SOAP 1.2 Header Test : - HeaderBlock1 local name mismatch",

+                headerBlock1.getLocalName().equals("echoOk1"));

+        assertTrue(

+                "SOAP 1.2 Header Test : - HeaderBlock1 namespace uri mismatch",

+                headerBlock1.getNamespace().getNamespaceURI().equals(

+                        "http://www.example.org"));

+

+        SOAPHeaderBlock headerBlock2 = (SOAPHeaderBlock) iterator.next();

+        assertFalse(

+                "SOAP 1.2 Header Test : - After calling addHeaderBlock method, getChildren method returns an iterator with only one object",

+                headerBlock2 == null);

+        assertTrue("SOAP 1.2 Header Test : - HeaderBlock2 local name mismatch",

+                headerBlock2.getLocalName().equals("echoOk2"));

+        assertTrue(

+                "SOAP 1.2 Header Test : - HeaderBlock2 namespace uri mismatch",

+                headerBlock2.getNamespace().getNamespaceURI().equals(

+                        "http://www.example.org"));

+

+        assertTrue(

+                "SOAP 1.2 Header Test : - After calling addHeaderBlock method twice, getChildren method returns an iterator with more than two elements",

+                !iterator.hasNext());

+    }

+

+    public void testSOAP12ExamineHeaderBlocks() {

+        soap12Header.addHeaderBlock("echoOk1", namespace);

+        soap12Header.addHeaderBlock("echoOk2", namespace).setRole(

+                "http://schemas.xmlsoap.org/soap/envelope/actor/ultimateReceiver");

+        Iterator iterator = soap12Header.examineHeaderBlocks(

+                "http://schemas.xmlsoap.org/soap/envelope/actor/ultimateReceiver");

+        iterator.hasNext();

+        SOAPHeaderBlock headerBlockWithRole = (SOAPHeaderBlock) iterator.next();

+        assertTrue(

+                "SOAP 1.2 Header Test : - headerBlockWithRole local name mismatch",

+                headerBlockWithRole.getLocalName().equals("echoOk2"));

+        assertTrue(

+                "SOAP 1.2 Header Test : - headerBlockWithRole role value mismatch",

+                headerBlockWithRole.getRole().equals(

+                        "http://schemas.xmlsoap.org/soap/envelope/actor/ultimateReceiver"));

+

+        assertFalse(

+                "SOAP 1.2 Header Test : - header has one headerBlock with role, but examineHeaderBlocks(String role) method returns an iterator with more than one object",

+                iterator.hasNext());

+

+    }

+

+

+    public void testSOAP12ExamineMustUnderstandHeaderBlocks() {

+        soap12Header.addHeaderBlock("echoOk1", namespace).setRole(

+                "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver");

+

+        SOAPHeaderBlock headerBlock1 = soap12Header.addHeaderBlock("echoOk2",

+                namespace);

+        headerBlock1.setRole(

+                "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver");

+        headerBlock1.setMustUnderstand(true);

+

+        soap12Header.addHeaderBlock("echoOk3", namespace).setMustUnderstand(

+                true);

+

+        Iterator iterator = soap12Header.examineMustUnderstandHeaderBlocks(

+                "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver");

+        iterator.hasNext();

+        SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) iterator.next();

+        assertFalse(

+                "SOAP 1.2 Header Test : - examineMustUnderstandHeaderBlocks method returns empty iterator",

+                headerBlock == null);

+        assertTrue("SOAP 1.2 Header Test : - HeaderBlock local name mismatch",

+                headerBlock.getLocalName().equals("echoOk2"));

+        assertTrue("SOAP 1.2 Header Test : - HeaderBlock role value mismatch",

+                headerBlock.getRole().equals(

+                        "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"));

+        assertFalse(

+                "SOAP 1.2 Header Test : - examineMustUnderstandHeaderBlocks method returns an iterator with more than one object",

+                iterator.hasNext());

+    }

+

+    public void testSOAP12ExamineAllHeaderBlocks() {

+        soap12Header.addHeaderBlock("echoOk1", namespace);

+        soap12Header.addHeaderBlock("echoOk2", namespace);

+        Iterator iterator = soap12Header.examineAllHeaderBlocks();

+        iterator.hasNext();

+        SOAPHeaderBlock headerBlock1 = (SOAPHeaderBlock) iterator.next();

+        assertFalse(

+                "SOAP 1.2 Header Test : - After calling addHeaderBlock method twice, examineAllHeaderBlocks method returns empty iterator",

+                headerBlock1 == null);

+        assertTrue("SOAP 1.2 Header Test : - HeaderBlock1 local name mismatch",

+                headerBlock1.getLocalName().equals("echoOk1"));

+        assertTrue(

+                "SOAP 1.2 Header Test : - HeaderBlock1 namespace uri mismatch",

+                headerBlock1.getNamespace().getNamespaceURI().equals(

+                        "http://www.example.org"));

+

+        SOAPHeaderBlock headerBlock2 = (SOAPHeaderBlock) iterator.next();

+        assertFalse(

+                "SOAP 1.2 Header Test : - After calling addHeaderBlock method twice, examineAllHeaderBlocks method returns an iterator with only one object",

+                headerBlock2 == null);

+        assertTrue("SOAP 1.2 Header Test : - HeaderBlock2 local name mismatch",

+                headerBlock2.getLocalName().equals("echoOk2"));

+        assertTrue(

+                "SOAP 1.2 Header Test : - HeaderBlock2 namespace uri mismatch",

+                headerBlock2.getNamespace().getNamespaceURI().equals(

+                        "http://www.example.org"));

+

+        assertFalse(

+                "SOAP 1.2 Header Test : - After calling addHeaderBlock method twice, examineAllHeaderBlocks method returns an iterator with more than two object",

+                iterator.hasNext());

+    }

+//    public void testSOAP12ExtractAllHeaderBlocks() {

+//

+//    }

+

+    public void testSOAP12getHeaderBlocksWithNSURI() {

+        soap12Header.addHeaderBlock("echoOk1", namespace);

+        soap12Header.addHeaderBlock("echoOk2",

+                omFactory.createOMNamespace("http://www.test1.org", "test1"));

+        ArrayList arrayList = soap12Header.getHeaderBlocksWithNSURI(

+                "http://www.test1.org");

+        assertTrue(

+                "SOAP 1.2 Header Test : - getHeaderBlocksWithNSURI returns an arrayList of incorrect size",

+                arrayList.size() == 1);

+        assertTrue(

+                "SOAP 1.2 Header Test : - headerBlock of given namespace uri, mismatch",

+                ((SOAPHeaderBlock) arrayList.get(0)).getNamespace().getNamespaceURI()

+                        .equals("http://www.test1.org"));

+    }

+

+    //SOAP 1.1 Header Test (With Parser)---------------------------------------------------------------------------------------------

+    public void testSOAP11ExamineHeaderBlocksWithParser() {

+        Iterator iterator = soap11HeaderWithParser.examineHeaderBlocks(

+                "http://schemas.xmlsoap.org/soap/actor/next");

+        iterator.hasNext();

+        SOAPHeaderBlock headerBlock1 = (SOAPHeaderBlock) iterator.next();

+        assertEquals(

+                "SOAP 1.1 Header Test With Parser : - headerBlock1 localname mismatch",

+                headerBlock1.getLocalName(),

+                "From");

+        assertTrue(

+                "SOAP 1.1 Header Test With Parser : - headerBlock1 role value mismatch",

+                headerBlock1.getRole().equals(

+                        "http://schemas.xmlsoap.org/soap/actor/next"));

+        iterator.hasNext();

+        SOAPHeaderBlock headerBlock2 = (SOAPHeaderBlock) iterator.next();

+        assertTrue(

+                "SOAP 1.1 Header Test With Parser : - headerBlock2 localname mmismatch",

+                headerBlock2.getLocalName().equals("MessageID"));

+        assertTrue(

+                "SOAP 1.1 Header Test With Parser : - headerBlock2 role value mmismatch",

+                headerBlock2.getRole().equals(

+                        "http://schemas.xmlsoap.org/soap/actor/next"));

+

+        assertFalse(

+                "SOAP 1.1 Header Test With Parser : - examineHeaderBlocks(String role) method returns an iterator with more than two objects",

+                iterator.hasNext());

+    }

+

+    public void testSOAP11ExamineMustUnderstandHeaderBlocksWithParser() {

+        Iterator iterator = soap11HeaderWithParser.examineMustUnderstandHeaderBlocks(

+                "http://schemas.xmlsoap.org/soap/actor/next");

+        iterator.hasNext();

+        SOAPHeaderBlock headerBlock1 = (SOAPHeaderBlock) iterator.next();

+        assertTrue(

+                "SOAP 1.1 Header Test With Parser : - headerBlock1 localname mmismatch",

+                headerBlock1.getLocalName().equals("MessageID"));

+        assertTrue(

+                "SOAP 1.1 Header Test With Parser : - headerBlock1 role value mmismatch",

+                headerBlock1.getRole().equals(

+                        "http://schemas.xmlsoap.org/soap/actor/next"));

+

+        assertFalse(

+                "SOAP 1.1 Header Test With Parser : - examineMustUnderstandHeaderBlocks(String role) method returns an iterator with more than one objects",

+                iterator.hasNext());

+    }

+

+    public void testSOAP11ExamineAllHeaderBlocksWithParser() {

+        Iterator iterator = soap11HeaderWithParser.examineAllHeaderBlocks();

+        iterator.hasNext();

+        SOAPHeaderBlock headerBlock1 = (SOAPHeaderBlock) iterator.next();

+        assertTrue(

+                "SOAP 1.1 Header Test With Parser : - headerBlock1 localname mmismatch",

+                headerBlock1.getLocalName().equals("From"));

+        iterator.hasNext();

+        SOAPHeaderBlock headerBlock2 = (SOAPHeaderBlock) iterator.next();

+        assertTrue(

+                "SOAP 1.1 Header Test With Parser : - headerBlock1 localname mmismatch",

+                headerBlock2.getLocalName().equals("MessageID"));

+        iterator.hasNext();

+        SOAPHeaderBlock headerBlock3 = (SOAPHeaderBlock) iterator.next();

+        assertTrue(

+                "SOAP 1.1 Header Test With Parser : - headerBlock1 localname mmismatch",

+                headerBlock3.getLocalName().equals("To"));

+

+        assertFalse(

+                "SOAP 1.1 Header Test With Parser : - examineAllHeaderBlocks method returns an iterator with more than three objects",

+                iterator.hasNext());

+    }

+

+    public void testSOAP11getHeaderBlocksWithNSURIWithParser() {

+        ArrayList arrayList = soap11HeaderWithParser.getHeaderBlocksWithNSURI(

+                "http://example.org/ts-tests");

+        assertTrue(

+                "SOAP 1.1 Header Test With Parser : - getHeaderBlocksWithNSURI returns an arrayList of incorrect size",

+                arrayList.size() == 1);

+        assertTrue(

+                "SOAP 1.1 Header Test With Parser : - headerBlock of given namespace uri, local name mismatch",

+                ((SOAPHeaderBlock) arrayList.get(0)).getLocalName().equals(

+                        "MessageID"));

+        assertTrue(

+                "SOAP 1.1 Header Test With Parser : - headerBlock of given namespace uri, mismatch",

+                ((SOAPHeaderBlock) arrayList.get(0)).getNamespace().getNamespaceURI()

+                        .equals("http://example.org/ts-tests"));

+    }

+

+    //SOAP 1.2 Header Test (With Parser)-------------------------------------------------------------------------------------------

+    public void testSOAP12ExamineHeaderBlocksWithParser() {

+        Iterator iterator = soap12HeaderWithParser.examineHeaderBlocks(

+                "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver");

+        iterator.hasNext();

+        SOAPHeaderBlock headerBlock1 = (SOAPHeaderBlock) iterator.next();

+        assertTrue(

+                "SOAP 1.2 Header Test With Parser : - headerBlock1 localname mmismatch",

+                headerBlock1.getLocalName().equals("echoOk"));

+        assertTrue(

+                "SOAP 1.2 Header Test With Parser : - headerBlock1 role value mmismatch",

+                headerBlock1.getRole().equals(

+                        "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"));

+        iterator.hasNext();

+        SOAPHeaderBlock headerBlock2 = (SOAPHeaderBlock) iterator.next();

+        assertTrue(

+                "SOAP 1.2 Header Test With Parser : - headerBlock2 localname mmismatch",

+                headerBlock2.getLocalName().equals("echoOk2"));

+        assertTrue(

+                "SOAP 1.2 Header Test With Parser : - headerBlock2 role value mmismatch",

+                headerBlock2.getRole().equals(

+                        "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"));

+

+        assertFalse(

+                "SOAP 1.2 Header Test With Parser : - examineHeaderBlocks(String role) method returns an iterator with more than two objects",

+                iterator.hasNext());

+    }

+

+    public void testSOAP12ExamineMustUnderstandHeaderBlocksWithParser() {

+        Iterator iterator = soap12HeaderWithParser.examineMustUnderstandHeaderBlocks(

+                "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver");

+        iterator.hasNext();

+        SOAPHeaderBlock headerBlock1 = (SOAPHeaderBlock) iterator.next();

+        assertEquals(

+                "SOAP 1.2 Header Test With Parser : - headerBlock localname mmismatch",

+                headerBlock1.getLocalName(),

+                "echoOk");

+        assertEquals(

+                "SOAP 1.2 Header Test With Parser : - headerBlock role value mmismatch",

+                headerBlock1.getRole(),

+                "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver");

+

+        iterator.hasNext();

+        SOAPHeaderBlock headerBlock2 = (SOAPHeaderBlock) iterator.next();

+        assertEquals(

+                "SOAP 1.2 Header Test With Parser : - headerBlock localname mmismatch",

+                headerBlock2.getLocalName(),

+                "echoOk2");

+        assertEquals(

+                "SOAP 1.2 Header Test With Parser : - headerBlock role value mmismatch",

+                headerBlock1.getRole(),

+                "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver");

+

+        assertFalse(

+                "SOAP 1.2 Header Test With Parser : - examineMustUnderstandHeaderBlocks(String role) method returns an iterator with more than one objects",

+                iterator.hasNext());

+    }

+

+    public void testSOAP12ExamineAllHeaderBlocksWithParser() {

+        Iterator iterator = soap12HeaderWithParser.examineAllHeaderBlocks();

+        iterator.next();

+        SOAPHeaderBlock headerBlock1 = (SOAPHeaderBlock) iterator.next();

+        assertTrue(

+                "SOAP 1.2 Header Test With Parser : - headerBlock1 localname mmismatch",

+                headerBlock1.getLocalName().equals("echoOk"));

+        iterator.next();

+        SOAPHeaderBlock headerBlock2 = (SOAPHeaderBlock) iterator.next();

+        assertTrue(

+                "SOAP 1.2 Header Test With Parser : - headerBlock1 localname mmismatch",

+                headerBlock2.getLocalName().equals("echoOk1"));

+        iterator.next();

+        SOAPHeaderBlock headerBlock3 = (SOAPHeaderBlock) iterator.next();

+        assertTrue(

+                "SOAP 1.2 Header Test With Parser : - headerBlock1 localname mmismatch",

+                headerBlock3.getLocalName().equals("echoOk2"));

+

+        assertFalse(

+                "SOAP 1.2 Header Test With Parser : - examineAllHeaderBlocks method returns an iterator with more than three objects",

+                iterator.hasNext());

+    }

+

+    public void testSOAP12getHeaderBlocksWithNSURIWithParser() {

+        ArrayList arrayList = soap12HeaderWithParser.getHeaderBlocksWithNSURI(

+                "http://example.org/ts-tests");

+        assertTrue(

+                "SOAP 1.2 Header Test With Parser : - getHeaderBlocksWithNSURI returns an arrayList of incorrect size",

+                arrayList.size() == 1);

+        assertTrue(

+                "SOAP 1.2 Header Test With Parser : - headerBlock of given namespace uri, local name mismatch",

+                ((SOAPHeaderBlock) arrayList.get(0)).getLocalName().equals(

+                        "echoOk"));

+        assertTrue(

+                "SOAP 1.2 Header Test With Parser : - headerBlock of given namespace uri, mismatch",

+                ((SOAPHeaderBlock) arrayList.get(0)).getNamespace().getNamespaceURI()

+                        .equals("http://example.org/ts-tests"));

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPHeaderTestCase.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPHeaderTestCase.java
new file mode 100644
index 0000000..c8f63a9
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPHeaderTestCase.java
@@ -0,0 +1,41 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMNamespace;

+

+public abstract class SOAPHeaderTestCase extends SOAPTestCase {

+    protected SOAPHeader soap11Header;

+    protected SOAPHeader soap12Header;

+    protected SOAPHeader soap11HeaderWithParser;

+    protected SOAPHeader soap12HeaderWithParser;

+    protected OMNamespace namespace;

+

+    public SOAPHeaderTestCase(String testName) {

+        super(testName);

+        namespace =

+                omFactory.createOMNamespace("http://www.example.org", "test");

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+        soap11Header = soap11Factory.createSOAPHeader(soap11Envelope);

+        soap12Header = soap12Factory.createSOAPHeader(soap12Envelope);

+        soap11HeaderWithParser = soap11EnvelopeWithParser.getHeader();

+        soap12HeaderWithParser = soap12EnvelopeWithParser.getHeader();

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPMessageTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPMessageTest.java
new file mode 100644
index 0000000..d1a4a4a
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPMessageTest.java
@@ -0,0 +1,38 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.OMTestCase;

+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;

+

+public class SOAPMessageTest extends OMTestCase {

+

+    public SOAPMessageTest(String testName) {

+        super(testName);

+    }

+

+    public void testSOAPMessageCreation(){

+        try {

+            StAXSOAPModelBuilder soapBuilder = getOMBuilder("");

+            SOAPMessage soapMessage = soapBuilder.getSoapMessage();

+            assertNotNull(soapMessage);

+            assertNotNull(soapMessage.getSOAPEnvelope());

+        } catch (Exception e) {

+            fail("Exception thrown "+ e);

+        }

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPTestCase.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPTestCase.java
new file mode 100644
index 0000000..10c74b8
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPTestCase.java
@@ -0,0 +1,84 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import org.apache.axiom.om.AbstractTestCase;

+import org.apache.axiom.om.OMAbstractFactory;

+import org.apache.axiom.om.OMFactory;

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;

+

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLStreamException;

+import javax.xml.stream.XMLStreamReader;

+import java.io.FileNotFoundException;

+import java.io.FileReader;

+

+public abstract class SOAPTestCase extends AbstractTestCase {

+    protected SOAPFactory soap11Factory;

+    protected SOAPFactory soap12Factory;

+    protected OMFactory omFactory;

+

+    protected SOAPEnvelope soap11Envelope;

+    protected SOAPEnvelope soap12Envelope;

+

+    protected SOAPEnvelope soap11EnvelopeWithParser;

+    protected SOAPEnvelope soap12EnvelopeWithParser;

+

+    protected static final String SOAP11_FILE_NAME = "soap/soap11/soap11message.xml";

+    protected static final String SOAP12_FILE_NAME = "soap/soap12message.xml";

+    private Log log = LogFactory.getLog(getClass());

+    /**

+     * @param testName

+     */

+    public SOAPTestCase(String testName) {

+        super(testName);

+        soap11Factory = OMAbstractFactory.getSOAP11Factory();

+        soap12Factory = OMAbstractFactory.getSOAP12Factory();

+        omFactory = OMAbstractFactory.getOMFactory();

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+

+        soap11Envelope = soap11Factory.createSOAPEnvelope();

+        soap12Envelope = soap12Factory.createSOAPEnvelope();

+

+        soap11EnvelopeWithParser =

+                (SOAPEnvelope) this.getSOAPBuilder(SOAP11_FILE_NAME)

+                .getDocumentElement();

+        soap12EnvelopeWithParser =

+                (SOAPEnvelope) this.getSOAPBuilder(SOAP12_FILE_NAME)

+                .getDocumentElement();

+    }

+

+    protected StAXSOAPModelBuilder getSOAPBuilder(String fileName) {

+        XMLStreamReader parser = null;

+        try {

+            parser =

+                    XMLInputFactory.newInstance().createXMLStreamReader(

+                            new FileReader(getTestResourceFile(fileName)));

+        } catch (XMLStreamException e) {

+            log.info(e.getMessage());

+        } catch (FileNotFoundException e) {

+            log.info(e.getMessage());

+        }

+        return new StAXSOAPModelBuilder(parser, null);

+    }

+

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/WrongEnvelopeNamespaceTester.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/WrongEnvelopeNamespaceTester.java
new file mode 100644
index 0000000..4645d7d
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/WrongEnvelopeNamespaceTester.java
@@ -0,0 +1,49 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap;

+

+import junit.framework.TestCase;

+import org.apache.axiom.om.impl.builder.StAXBuilder;

+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;

+

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLStreamReader;

+import java.io.FileInputStream;

+import java.io.FileNotFoundException;

+

+public class WrongEnvelopeNamespaceTester extends TestCase {

+    public void testCode() {

+        try {

+            String filename = "test-resources/soap/wrongEnvelopeNamespace.xml";

+            XMLStreamReader xmlr = XMLInputFactory.newInstance()

+                    .createXMLStreamReader(new FileInputStream(filename));

+            StAXBuilder builder = new StAXSOAPModelBuilder(xmlr, null); //exception here

+            fail("Builder must fail here due to wrong SOAP namespace");

+        } catch (SOAPProcessingException e) {

+            assertTrue(true);

+        } catch (FileNotFoundException e) {

+            fail("Only SOAPProcessingException can be thrown here");

+        }catch (Exception e) {

+            fail("Only SOAPProcessingException can be thrown here");

+        }

+    }

+

+    public static void main(String[] args) {

+        WrongEnvelopeNamespaceTester tester = new WrongEnvelopeNamespaceTester();

+        tester.testCode();

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilderTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilderTest.java
new file mode 100644
index 0000000..feba3e4
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilderTest.java
@@ -0,0 +1,563 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+package org.apache.axiom.soap.impl.builder;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPConstants;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAPFaultDetail;
+import org.apache.axiom.soap.SOAPFaultNode;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPFaultRole;
+import org.apache.axiom.soap.SOAPFaultSubCode;
+import org.apache.axiom.soap.SOAPFaultText;
+import org.apache.axiom.soap.SOAPFaultValue;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.io.StringReader;
+import java.util.Iterator;
+
+public class StAXSOAPModelBuilderTest extends TestCase {
+
+    private Log log = LogFactory.getLog(getClass());
+
+    public void setUp() {
+
+    }
+
+
+    public void testStAXSOAPModelBuilder() {
+        String soap12Message =
+                "<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\">\n" +
+                        "   <env:Header>\n" +
+                        "       <test:echoOk xmlns:test=\"http://example.org/ts-tests\"\n" +
+                        "                    env:role=\"http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver\"\n" +
+                        "                    env:mustUnderstand=\"true\">\n" +
+                        "                       foo\n" +
+                        "       </test:echoOk>\n" +
+                        "   </env:Header>\n" +
+                        "   <env:Body>\n" +
+                        "       <env:Fault>\n" +
+                        "           <env:Code>\n" +
+                        "               <env:Value>env:Sender</env:Value>\n" +
+                        "               <env:Subcode>\n" +
+                        "                   <env:Value>m:MessageTimeout</env:Value>\n" +
+                        "                   <env:Subcode>\n" +
+                        "                       <env:Value>m:MessageTimeout</env:Value>\n" +
+                        "                   </env:Subcode>\n" +
+                        "               </env:Subcode>\n" +
+                        "           </env:Code>\n" +
+                        "           <env:Reason>\n" +
+                        "               <env:Text>Sender Timeout</env:Text>\n" +
+                        "           </env:Reason>\n" +
+                        "           <env:Node>\n" +
+                        "               http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver\n" +
+                        "           </env:Node>\n" +
+                        "           <env:Role>\n" +
+                        "               ultimateReceiver\n" +
+                        "           </env:Role>\n" +
+                        "           <env:Detail xmlns:m=\"http:www.sample.org\">\n" +
+                        "               Details of error\n" +
+                        "               <m:MaxTime m:detail=\"This is only a test\">\n" +
+                        "                   P5M\n" +
+                        "               </m:MaxTime>\n" +
+                        "               <m:AveTime>\n" +
+                        "                   <m:Time>\n" +
+                        "                       P3M\n" +
+                        "                   </m:Time>\n" +
+                        "               </m:AveTime>\n" +
+                        "           </env:Detail>\n" +
+                        "       </env:Fault>\n" +
+                        "   </env:Body>\n" +
+                        "</env:Envelope>";
+
+        String soap11Message =
+                "<?xml version='1.0' ?>" +
+                        "<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
+                        "   <env:Header>\n" +
+                        "       <test:echoOk xmlns:test=\"http://example.org/ts-tests\"\n" +
+                        "                    env:actor=\"http://schemas.xmlsoap.org/soap/actor/next\"\n" +
+                        "                    env:mustUnderstand=\"1\"" +
+                        "       >\n" +
+                        "                       foo\n" +
+                        "       </test:echoOk>\n" +
+                        "   </env:Header>\n" +
+                        "   <env:Body>\n" +
+                        "       <env:Fault>\n" +
+                        "           <faultcode>\n" +
+                        "               env:Sender\n" +
+                        "           </faultcode>\n" +
+                        "           <faultstring>\n" +
+                        "               Sender Timeout\n" +
+                        "           </faultstring>\n" +
+                        "           <faultactor>\n" +
+                        "               http://schemas.xmlsoap.org/soap/envelope/actor/ultimateReceiver\n" +
+                        "           </faultactor>\n" +
+                        "           <detail xmlns:m=\"http:www.sample.org\">\n" +
+                        "               Details of error\n" +
+                        "               <m:MaxTime m:detail=\"This is only a test\">\n" +
+                        "                   P5M\n" +
+                        "               </m:MaxTime>\n" +
+                        "               <m:AveTime>\n" +
+                        "                   <m:Time>\n" +
+                        "                       P3M\n" +
+                        "                   </m:Time>\n" +
+                        "               </m:AveTime>\n" +
+                        "           </detail>\n" +
+                        "           <n:Test xmlns:n=\"http:www.Test.org\">\n" +
+                        "               <n:TestElement>\n" +
+                        "                   This is only a test\n" +
+                        "               </n:TestElement>\n" +
+                        "           </n:Test>\n" +
+                        "       </env:Fault>\n" +
+                        "   </env:Body>\n" +
+                        "</env:Envelope>";
+
+
+        try {
+            XMLStreamReader sopa12Parser = XMLInputFactory.newInstance()
+                    .createXMLStreamReader(new StringReader(soap12Message));
+            OMXMLParserWrapper soap12Builder = new StAXSOAPModelBuilder(sopa12Parser, null);
+            SOAPEnvelope soap12Envelope = (SOAPEnvelope) soap12Builder.getDocumentElement();
+
+            assertTrue("SOAP 1.2 :- envelope local name mismatch",
+                    soap12Envelope.getLocalName().equals(
+                            SOAPConstants.SOAPENVELOPE_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- envelope namespace uri mismatch",
+                    soap12Envelope.getNamespace().getNamespaceURI().equals(
+                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            SOAPHeader header = soap12Envelope.getHeader();
+            assertTrue("SOAP 1.2 :- Header local name mismatch",
+                    header.getLocalName().equals(
+                            SOAPConstants.HEADER_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Header namespace uri mismatch",
+                    header.getNamespace().getNamespaceURI().equals(
+                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) header.getFirstElement();
+            assertTrue("SOAP 1.2 :- Header block name mismatch",
+                    headerBlock.getLocalName().equals("echoOk"));
+            assertTrue("SOAP 1.2 :- Header block name space uri mismatch",
+                    headerBlock.getNamespace().getNamespaceURI().equals(
+                            "http://example.org/ts-tests"));
+            assertEquals("SOAP 1.2 :- Header block text mismatch", headerBlock.getText().trim(), "foo");
+
+            // Attribute iteration is not in any guaranteed order.
+            // Use QNames to get the OMAttributes.
+            QName roleQName = new QName(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP12Constants.SOAP_ROLE);
+            QName mustUnderstandQName = new QName(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP12Constants.ATTR_MUSTUNDERSTAND);
+
+            OMAttribute roleAttribute = headerBlock.getAttribute(roleQName);
+            OMAttribute mustUnderstandAttribute = headerBlock.getAttribute(mustUnderstandQName);
+
+
+            assertTrue("SOAP 1.2 :- Role attribute name not found",
+                    roleAttribute != null);
+
+
+            assertTrue("SOAP 1.2 :- Role value mismatch",
+                    roleAttribute.getAttributeValue().trim().equals(
+                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI + "/" +
+                                    SOAP12Constants.SOAP_ROLE +
+                                    "/" +
+                                    "ultimateReceiver"));
+
+            assertTrue("SOAP 1.2 :- Mustunderstand attribute not found",
+                    mustUnderstandAttribute != null);
+
+            assertTrue("SOAP 1.2 :- Mustunderstand value mismatch",
+                    mustUnderstandAttribute.getAttributeValue().equals(
+                            SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE));
+
+
+            SOAPBody body = soap12Envelope.getBody();
+            assertTrue("SOAP 1.2 :- Body local name mismatch",
+                    body.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Body namespace uri mismatch",
+                    body.getNamespace().getNamespaceURI().equals(
+                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            SOAPFault fault = body.getFault();
+            assertTrue("SOAP 1.2 :- Fault local name mismatch",
+                    fault.getLocalName().equals(
+                            SOAPConstants.SOAPFAULT_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault namespace uri mismatch",
+                    fault.getNamespace().getNamespaceURI().equals(
+                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            Iterator iteratorInFault = fault.getChildren();
+
+            iteratorInFault.next();
+            SOAPFaultCode code = (SOAPFaultCode) iteratorInFault.next();
+            assertTrue("SOAP 1.2 :- Fault code local name mismatch",
+                    code.getLocalName().equals(
+                            SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault code namespace uri mismatch",
+                    code.getNamespace().getNamespaceURI().equals(
+                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            Iterator iteratorInCode = code.getChildren();
+
+            iteratorInCode.next();
+            SOAPFaultValue value1 = (SOAPFaultValue) iteratorInCode.next();
+            assertTrue("SOAP 1.2 :- Fault code value local name mismatch",
+                    value1.getLocalName().equals(
+                            SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault code namespace uri mismatch",
+                    value1.getNamespace().getNamespaceURI().equals(
+                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+            assertTrue("SOAP 1.2 :- Value1 text mismatch",
+                    value1.getText().equals("env:Sender"));
+
+            iteratorInCode.next();
+            SOAPFaultSubCode subCode1 = (SOAPFaultSubCode) iteratorInCode.next();
+            assertTrue("SOAP 1.2 :- Fault sub code local name mismatch",
+                    subCode1.getLocalName().equals(
+                            SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault subcode namespace uri mismatch",
+                    subCode1.getNamespace().getNamespaceURI().equals(
+                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            Iterator iteratorInSubCode1 = subCode1.getChildren();
+
+            iteratorInSubCode1.next();
+            SOAPFaultValue value2 = (SOAPFaultValue) iteratorInSubCode1.next();
+            assertTrue("SOAP 1.2 :- Fault code value local name mismatch",
+                    value2.getLocalName().equals(
+                            SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault code namespace uri mismatch",
+                    value2.getNamespace().getNamespaceURI().equals(
+                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+            assertTrue("SOAP 1.2 :- Value2 text mismatch",
+                    value2.getText().equals("m:MessageTimeout"));
+
+            iteratorInSubCode1.next();
+            SOAPFaultSubCode subCode2 = (SOAPFaultSubCode) iteratorInSubCode1.next();
+            assertTrue("SOAP 1.2 :- Fault sub code local name mismatch",
+                    subCode2.getLocalName().equals(
+                            SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault subcode namespace uri mismatch",
+                    subCode2.getNamespace().getNamespaceURI().equals(
+                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            Iterator iteratorInSubCode2 = subCode2.getChildren();
+
+            iteratorInSubCode2.next();
+            SOAPFaultValue value3 = (SOAPFaultValue) iteratorInSubCode2.next();
+            assertTrue("SOAP 1.2 :- Fault code value local name mismatch",
+                    value3.getLocalName().equals(
+                            SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault code namespace uri mismatch",
+                    value3.getNamespace().getNamespaceURI().equals(
+                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+            assertTrue("SOAP 1.2 :- Value2 text mismatch",
+                    value3.getText().equals("m:MessageTimeout"));
+
+            iteratorInFault.next();
+            SOAPFaultReason reason = (SOAPFaultReason) iteratorInFault.next();
+            assertTrue("SOAP 1.2 :- Fault reason local name mismatch",
+                    reason.getLocalName().equals(
+                            SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault reason namespace uri mismatch",
+                    reason.getNamespace().getNamespaceURI().equals(
+                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            Iterator iteratorInReason = reason.getChildren();
+
+            iteratorInReason.next();
+            SOAPFaultText text = (SOAPFaultText) iteratorInReason.next();
+            assertTrue("SOAP 1.2 :- Fault text local name mismatch",
+                    text.getLocalName().equals(
+                            SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Text namespace uri mismatch",
+                    text.getNamespace().getNamespaceURI().equals(
+                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+            assertTrue("SOAP 1.2 :- Text value mismatch",
+                    text.getText().equals("Sender Timeout"));
+
+            iteratorInFault.next();
+            SOAPFaultNode node = (SOAPFaultNode) iteratorInFault.next();
+            assertTrue("SOAP 1.2 :- Fault node local name mismatch",
+                    node.getLocalName().equals(
+                            SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault node namespace uri mismatch",
+                    node.getNamespace().getNamespaceURI().equals(
+                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+            assertTrue("SOAP 1.2 :- Node value mismatch",
+                    node.getText().trim().equals(
+                            "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"));
+
+            iteratorInFault.next();
+            SOAPFaultRole role = (SOAPFaultRole) iteratorInFault.next();
+            assertTrue("SOAP 1.2 :- Fault role local name mismatch",
+                    role.getLocalName().equals(
+                            SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault role namespace uri mismatch",
+                    role.getNamespace().getNamespaceURI().equals(
+                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+            assertTrue("SOAP 1.2 :- Role value mismatch",
+                    role.getText().trim().equals("ultimateReceiver"));
+
+            iteratorInFault.next();
+            SOAPFaultDetail detail = (SOAPFaultDetail) iteratorInFault.next();
+            assertTrue("SOAP 1.2 :- Fault detail local name mismatch",
+                    detail.getLocalName().equals(
+                            SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault detail namespace uri mismatch",
+                    detail.getNamespace().getNamespaceURI().equals(
+                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            assertTrue("SOAP 1.2 :- Text in detail mismatch",
+                    detail.getText().trim().equals("Details of error"));
+
+            Iterator iteratorInDetail = detail.getChildren();
+
+            iteratorInDetail.next();
+            OMElement element1 = (OMElement) iteratorInDetail.next();
+            assertTrue("SOAP 1.2 :- MaxTime element mismatch",
+                    element1.getLocalName().equals("MaxTime"));
+            assertTrue("SOAP 1.2 :- MaxTime element namespace mismatch",
+                    element1.getNamespace().getNamespaceURI().equals(
+                            "http:www.sample.org"));
+            assertTrue("SOAP 1.2 :- Text value in MaxTime element mismatch",
+                    element1.getText().trim().equals("P5M"));
+
+            Iterator attributeIterator = element1.getAllAttributes();
+            OMAttribute attributeInMaxTime = (OMAttribute) attributeIterator.next();
+            assertTrue("SOAP 1.2 :- Attribute local name mismatch",
+                    attributeInMaxTime.getLocalName().equals("detail"));
+            assertTrue("SOAP 1.2 :- Attribute namespace mismatch",
+                    attributeInMaxTime.getNamespace().getNamespaceURI().equals(
+                            "http:www.sample.org"));
+            assertTrue("SOAP 1.2 :- Attribute value mismatch",
+                    attributeInMaxTime.getAttributeValue().trim().equals("This is only a test"));
+
+            iteratorInDetail.next();
+            OMElement element2 = (OMElement) iteratorInDetail.next();
+            assertTrue("SOAP 1.2 :- AveTime element mismatch",
+                    element2.getLocalName().equals("AveTime"));
+            assertTrue("SOAP 1.2 :- AveTime element namespace mismatch",
+                    element2.getNamespace().getNamespaceURI().equals(
+                            "http:www.sample.org"));
+
+            Iterator iteratorInAveTimeElement = element2.getChildren();
+
+            iteratorInAveTimeElement.next();
+            OMElement element21 = (OMElement) iteratorInAveTimeElement.next();
+            assertTrue("SOAP 1.2 :- Time element mismatch",
+                    element21.getLocalName().equals("Time"));
+            assertTrue("SOAP 1.2 :- Time element namespace mismatch",
+                    element21.getNamespace().getNamespaceURI().equals(
+                            "http:www.sample.org"));
+            assertTrue("SOAP 1.2 :- Text value in Time element mismatch",
+                    element21.getText().trim().equals("P3M"));
+
+            XMLStreamReader sopa11Parser = XMLInputFactory.newInstance()
+                    .createXMLStreamReader(new StringReader(soap11Message));
+            OMXMLParserWrapper soap11Builder = new StAXSOAPModelBuilder(sopa11Parser, null);
+            SOAPEnvelope soap11Envelope = (SOAPEnvelope) soap11Builder.getDocumentElement();
+//            soap11Envelope.build();
+//            writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
+//            soap11Envelope.internalSerializeAndConsume(writer);
+//		    writer.flush();
+
+            assertTrue("SOAP 1.1 :- envelope local name mismatch",
+                    soap11Envelope.getLocalName().equals(
+                            SOAPConstants.SOAPENVELOPE_LOCAL_NAME));
+            assertTrue("SOAP 1.1 :- envelope namespace uri mismatch",
+                    soap11Envelope.getNamespace().getNamespaceURI().equals(
+                            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            header = soap11Envelope.getHeader();
+            assertTrue("SOAP 1.1 :- Header local name mismatch",
+                    header.getLocalName().equals(
+                            SOAPConstants.HEADER_LOCAL_NAME));
+            assertTrue("SOAP 1.1 :- Header namespace uri mismatch",
+                    header.getNamespace().getNamespaceURI().equals(
+                            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            headerBlock = (SOAPHeaderBlock) header.getFirstElement();
+            assertTrue("SOAP 1.1 :- Header block name mismatch",
+                    headerBlock.getLocalName().equals("echoOk"));
+            assertTrue("SOAP 1.1 :- Header block name space uri mismatch",
+                    headerBlock.getNamespace().getNamespaceURI().equals(
+                            "http://example.org/ts-tests"));
+            assertTrue("SOAP 1.1 :- Headaer block text mismatch",
+                    headerBlock.getText().trim().equals("foo"));
+
+            // Attribute iteration is not in any guaranteed order.
+            // Use QNames to get the OMAttributes.
+            QName actorQName = new QName(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP11Constants.ATTR_ACTOR);
+            mustUnderstandQName = new QName(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP11Constants.ATTR_MUSTUNDERSTAND);
+
+            OMAttribute actorAttribute = headerBlock.getAttribute(actorQName);
+            mustUnderstandAttribute = headerBlock.getAttribute(mustUnderstandQName);
+
+            assertTrue("SOAP 1.1 :- Mustunderstand attribute not found",
+                    mustUnderstandAttribute != null);
+            assertTrue("SOAP 1.1 :- Mustunderstand value mismatch",
+                    mustUnderstandAttribute.getAttributeValue().equals(
+                            SOAPConstants.ATTR_MUSTUNDERSTAND_1));
+            assertTrue(
+                    "SOAP 1.1 :- Mustunderstand attribute namespace uri mismatch",
+                    mustUnderstandAttribute.getNamespace().getNamespaceURI().equals(
+                            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            assertTrue("SOAP 1.1 :- Actor attribute name not found",
+                    actorAttribute != null);
+            assertTrue("SOAP 1.1 :- Actor value mismatch",
+                    actorAttribute.getAttributeValue().trim().equals(
+                            "http://schemas.xmlsoap.org/soap/" +
+                                    SOAP11Constants.ATTR_ACTOR +
+                                    "/" +
+                                    "next"));
+            assertTrue("SOAP 1.1 :- Actor attribute namespace uri mismatch",
+                    actorAttribute.getNamespace().getNamespaceURI().equals(
+                            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            body = soap11Envelope.getBody();
+            assertTrue("SOAP 1.1 :- Body local name mismatch",
+                    body.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME));
+            assertTrue("SOAP 1.1 :- Body namespace uri mismatch",
+                    body.getNamespace().getNamespaceURI().equals(
+                            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            fault = body.getFault();
+            assertTrue("SOAP 1.1 :- Fault namespace uri mismatch",
+                    fault.getNamespace().getNamespaceURI().equals(
+                            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            iteratorInFault = fault.getChildren();
+
+            iteratorInFault.next();
+            code = (SOAPFaultCode) iteratorInFault.next();
+            assertEquals("SOAP Fault code local name mismatch",
+                    code.getLocalName(),
+                    (SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME));
+
+            assertEquals("SOAP 1.1 :- Fault code value mismatch", code.getValue().getText().trim(),
+                    "env:Sender");
+
+            iteratorInFault.next();
+            reason = (SOAPFaultReason) iteratorInFault.next();
+            assertTrue("SOAP 1.1 :- Fault string local name mismatch",
+                    reason.getLocalName().equals(
+                            SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME));
+            assertTrue("SOAP 1.1 :- Fault string value mismatch",
+                    reason.getFirstSOAPText().getText().trim().equals("Sender Timeout"));
+
+            iteratorInFault.next();
+            role = (SOAPFaultRole) iteratorInFault.next();
+            assertTrue("SOAP 1.1 :- Fault actor local name mismatch",
+                    role.getLocalName().equals(
+                            SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME));
+            assertTrue("SOAP 1.1 :- Actor value mismatch",
+                    role.getText().trim().equals(
+                            "http://schemas.xmlsoap.org/soap/envelope/actor/ultimateReceiver"));
+
+            iteratorInFault.next();
+            detail = (SOAPFaultDetail) iteratorInFault.next();
+            assertTrue("SOAP 1.1 :- Fault detail local name mismatch",
+                    detail.getLocalName().equals(
+                            SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Text in detail mismatch",
+                    detail.getText().trim().equals("Details of error"));
+
+            iteratorInDetail = detail.getChildren();
+
+            iteratorInDetail.next();
+            element1 = (OMElement) iteratorInDetail.next();
+            assertTrue("SOAP 1.1 :- MaxTime element mismatch",
+                    element1.getLocalName().equals("MaxTime"));
+            assertTrue("SOAP 1.1 :- MaxTime element namespace mismatch",
+                    element1.getNamespace().getNamespaceURI().equals(
+                            "http:www.sample.org"));
+            assertTrue("SOAP 1.1 :- Text value in MaxTime element mismatch",
+                    element1.getText().trim().equals("P5M"));
+
+            attributeIterator = element1.getAllAttributes();
+            attributeInMaxTime = (OMAttribute) attributeIterator.next();
+            assertTrue("SOAP 1.1 :- Attribute local name mismatch",
+                    attributeInMaxTime.getLocalName().equals("detail"));
+            assertTrue("SOAP 1.1 :- Attribute namespace mismatch",
+                    attributeInMaxTime.getNamespace().getNamespaceURI().equals(
+                            "http:www.sample.org"));
+            assertTrue("SOAP 1.1 :- Attribute value mismatch",
+                    attributeInMaxTime.getAttributeValue().equals("This is only a test"));
+
+            iteratorInDetail.next();
+            element2 = (OMElement) iteratorInDetail.next();
+            assertTrue("SOAP 1.1 :- AveTime element mismatch",
+                    element2.getLocalName().equals("AveTime"));
+            assertTrue("SOAP 1.1 :- AveTime element namespace mismatch",
+                    element2.getNamespace().getNamespaceURI().equals(
+                            "http:www.sample.org"));
+
+            iteratorInAveTimeElement = element2.getChildren();
+
+            iteratorInAveTimeElement.next();
+            element21 = (OMElement) iteratorInAveTimeElement.next();
+            assertTrue("SOAP 1.1 :- Time element mismatch",
+                    element21.getLocalName().equals("Time"));
+            assertTrue("SOAP 1.1 :- Time element namespace mismatch",
+                    element21.getNamespace().getNamespaceURI().equals(
+                            "http:www.sample.org"));
+            assertTrue("SOAP 1.1 :- Text value in Time element mismatch",
+                    element21.getText().trim().equals("P3M"));
+
+            iteratorInFault.next();
+            OMElement testElement = (OMElement) iteratorInFault.next();
+            assertTrue("SOAP 1.1 :- Test element mismatch",
+                    testElement.getLocalName().equals("Test"));
+            assertTrue("SOAP 1.1 :- Test element namespace mismatch",
+                    testElement.getNamespace().getNamespaceURI().equals(
+                            "http:www.Test.org"));
+
+            OMElement childOfTestElement = testElement.getFirstElement();
+            assertTrue("SOAP 1.1 :- Test element child local name mismatch",
+                    childOfTestElement.getLocalName().equals("TestElement"));
+            assertTrue("SOAP 1.1 :- Test element child namespace mismatch",
+                    childOfTestElement.getNamespace().getNamespaceURI().equals(
+                            "http:www.Test.org"));
+            assertTrue("SOAP 1.1 :- Test element child value mismatch",
+                    childOfTestElement.getText().trim().equals("This is only a test"));
+
+        } catch (XMLStreamException e) {
+            log.info(e.getMessage());
+            fail("Test failed. Reason -> " + e.getMessage());
+        } catch (Exception e) {
+            log.info(e.getMessage());
+            fail("Test failed. Reason -> " + e.getMessage());
+
+        }
+    }
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/CharacterEncodingTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/CharacterEncodingTest.java
new file mode 100644
index 0000000..c35f8fc
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/CharacterEncodingTest.java
@@ -0,0 +1,140 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom;

+import junit.framework.TestCase;

+import org.apache.axiom.om.OMAbstractFactory;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMOutputFormat;

+import org.apache.axiom.soap.SOAPEnvelope;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;

+

+import javax.xml.stream.FactoryConfigurationError;

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLStreamException;

+import java.io.ByteArrayInputStream;

+import java.io.ByteArrayOutputStream;

+import java.io.IOException;

+

+

+/**

+ * Test for serialization and deserialization using UTF-16

+ * character encoding 

+ */

+public class CharacterEncodingTest extends TestCase {

+

+	public static final String UTF_16 = "utf-16";

+	

+	public CharacterEncodingTest(String name) {

+		super(name);

+	}

+	

+	public void runTest(String value, String expected) throws XMLStreamException, FactoryConfigurationError, IOException {

+		

+		SOAPFactory factory = OMAbstractFactory.getSOAP12Factory();

+		SOAPEnvelope envelope = factory.getDefaultEnvelope();

+		String ns = "http://testuri.org";

+		OMNamespace namespace = factory.createOMNamespace(ns,"tst");

+		

+		String ln = "Child";

+		

+		OMElement bodyChild = factory.createOMElement(ln,namespace);

+		bodyChild.addChild(factory.createOMText(value));

+		

+		envelope.getBody().addChild(bodyChild);

+

+

+		ByteArrayOutputStream byteOutStr = new ByteArrayOutputStream();

+		

+		OMOutputFormat outputFormat = new OMOutputFormat();

+        outputFormat.setCharSetEncoding(UTF_16);

+		envelope.serialize(byteOutStr, outputFormat);

+		

+		ByteArrayInputStream byteInStr = new ByteArrayInputStream(byteOutStr.toByteArray());

+		

+		StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(XMLInputFactory.newInstance().createXMLStreamReader(byteInStr, UTF_16),null);

+

+		SOAPEnvelope resultEnv = builder.getSOAPEnvelope();

+		

+		OMElement bodyChildResult = resultEnv.getBody().getFirstElement();

+		

+		assertNotNull("No child in body element", bodyChildResult);

+		

+		String result = bodyChildResult.getText();

+		

+		assertNotNull("No value for testParam param", result);

+		

+		assertEquals("Expected result not received.", expected, result);

+	

+		

+	}

+	

+    private void runtest(String value) throws Exception {

+        runTest(value, value);

+    }

+    

+    public void testSimpleString() throws Exception {

+        runtest("a simple string");

+    }

+    

+    public void testStringWithApostrophes() throws Exception {

+        runtest("this isn't a simple string");

+    }

+    

+    public void testStringWithEntities() throws Exception {

+        runTest("&amp;&lt;&gt;&apos;&quot;", "&amp;&lt;&gt;&apos;&quot;");

+    }

+    

+    public void testStringWithRawEntities() throws Exception {

+        runTest("&<>'\"", "&<>'\"");

+    }

+    public void testStringWithLeadingAndTrailingSpaces() throws Exception {

+        runtest("          centered          ");

+    }

+    

+    public void testWhitespace() throws Exception {

+        runtest(" \n \t "); // note: \r fails

+    }

+    

+    public void testFrenchAccents() throws Exception {

+        runtest("\u00e0\u00e2\u00e4\u00e7\u00e8\u00e9\u00ea\u00eb\u00ee\u00ef\u00f4\u00f6\u00f9\u00fb\u00fc");

+    }

+    

+    public void testGermanUmlauts() throws Exception {

+        runtest(" Some text \u00df with \u00fc special \u00f6 chars \u00e4.");

+    }

+    

+    public void testWelcomeUnicode() throws Exception {

+        // welcome in several languages

+        runtest(

+          "Chinese (trad.) : \u6b61\u8fce  ");

+    }

+

+    public void testWelcomeUnicode2() throws Exception {

+        // welcome in several languages

+        runtest(

+          "Greek : \u03ba\u03b1\u03bb\u03ce\u03c2 \u03bf\u03c1\u03af\u03c3\u03b1\u03c4\u03b5");

+    }

+

+    public void testWelcomeUnicode3() throws Exception {

+        // welcome in several languages

+        runtest(

+          "Japanese : \u3088\u3046\u3053\u305d");

+    }

+	

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMElementTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMElementTest.java
new file mode 100644
index 0000000..429eaa8
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMElementTest.java
@@ -0,0 +1,166 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom;

+

+import org.apache.axiom.om.OMAbstractFactory;

+import org.apache.axiom.om.OMConstants;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.om.OMFactory;

+import org.apache.axiom.om.OMNamespace;

+import org.apache.axiom.om.OMTestCase;

+import org.apache.axiom.om.OMText;

+import org.apache.axiom.om.impl.builder.StAXOMBuilder;

+import org.apache.axiom.om.impl.dom.DOOMAbstractFactory;

+import org.apache.axiom.soap.SOAPEnvelope;

+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+

+import javax.xml.namespace.QName;

+import javax.xml.stream.XMLStreamException;

+

+import java.util.Iterator;

+

+public class OMElementTest extends OMTestCase implements OMConstants {

+    private static final String WSA_URI = "http://schemas.xmlsoap.org/ws/2004/03/addressing";

+    private static final String WSA_TO = "To";

+    private Log log = LogFactory.getLog(getClass());

+

+    OMFactory factory = OMAbstractFactory.getOMFactory();

+    private OMElement firstElement;

+    private OMElement secondElement;

+

+

+    public OMElementTest(String testName) {

+        super(testName);

+    }

+

+    /*

+     * @see TestCase#setUp()

+     */

+    protected void setUp() throws Exception {

+       OMNamespace testingNamespace = factory.createOMNamespace(

+                        "http://testing.ws.org", "ws");

+        firstElement = factory.createOMElement("FirstElement", testingNamespace);

+        secondElement = factory.createOMElement("SecondElement", factory.createOMNamespace(

+                                "http://moretesting.ws.org", "ws"), firstElement);

+    }

+

+    public void testGetText() {

+        try {

+            StAXSOAPModelBuilder soapBuilder = getOMBuilder(

+                    "soap/OMElementTest.xml");

+            SOAPEnvelope soapEnvelope = (SOAPEnvelope) soapBuilder.getDocumentElement();

+            OMElement wsaTo = soapEnvelope.getHeader().getFirstChildWithName(

+                    new QName(WSA_URI, WSA_TO));

+

+            String expectedString = "http://localhost:8081/axis/services/BankPort";

+            assertEquals("getText is not returning the correct value",

+                    wsaTo.getText().trim(),

+                    expectedString);

+        } catch (Exception e) {

+            log.info(e.getMessage());

+        }

+    }

+

+    public void testConstructors(){

+

+        try {

+            factory.createOMElement("", null);

+            fail("This should fail as OMElement should not be allowed to create without a local name ");

+        } catch (Exception e) {

+            assertTrue(true);

+        }

+

+        assertTrue("Namespace having same information, declared in the same context, should share" +

+                " the same namespace object",firstElement.getNamespace() != secondElement.getNamespace());

+        assertEquals("OMElement children addition has not worked properly", secondElement, firstElement.getFirstElement());

+

+        OMNamespace testNamespace2 = factory.createOMNamespace("ftp://anotherTest.ws.org", "ws");

+        firstElement.declareNamespace(testNamespace2);

+

+        OMNamespace inheritedSecondNamespace = secondElement.findNamespace(testNamespace2.getNamespaceURI(),

+                testNamespace2.getPrefix());

+        assertNotNull("Children should inherit namespaces declared in parent", inheritedSecondNamespace);

+        assertEquals("inherited namespace uri should be equal", inheritedSecondNamespace.getNamespaceURI(), testNamespace2.getNamespaceURI());

+        assertEquals("inherited namespace prefix should be equal", inheritedSecondNamespace.getPrefix(), testNamespace2.getPrefix());

+

+

+    }

+

+    public void testChildDetachment() {

+        OMNamespace testNamespace2 = factory.createOMNamespace("ftp://anotherTest.ws.org", "ws");

+        

+        secondElement.detach();

+        assertTrue("OMElement children detachment has not worked properly", !secondElement.equals(firstElement.getFirstElement()));

+        assertNull("First Element should not contain elements after detaching. ", firstElement.getFirstElement());

+        assertNull("First Element should not contain elements after detaching. ", firstElement.getFirstOMChild());

+        assertNull(secondElement.findNamespace(testNamespace2.getNamespaceURI(), testNamespace2.getPrefix()));

+

+        firstElement.addChild(secondElement);

+        firstElement.setText("Some Sample Text");

+

+        assertTrue("First added child must be the first child", secondElement.equals(firstElement.getFirstOMChild()));

+        Iterator children = firstElement.getChildren();

+        int childCount = 0;

+        while (children.hasNext()) {

+        	children.next();

+            childCount++;

+        }

+        assertEquals("Children count should be two", childCount, 2);

+

+        secondElement.detach();

+        assertTrue("First child should be the text child", firstElement.getFirstOMChild() instanceof OMText);

+

+    }

+

+    public void testAddDOOMElementAsChild() throws XMLStreamException {

+    	OMFactory doomFactory = DOOMAbstractFactory.getOMFactory();

+    	OMFactory llomFactory = OMAbstractFactory.getOMFactory();

+    	String text = "This was a DOOM Text";

+    	

+    	OMElement llomRoot = llomFactory.createOMElement("root",null);

+    	

+    	OMElement doomElement = doomFactory.createOMElement("second","test","a");

+    	doomElement.setText(text);

+    	llomRoot.addChild(doomElement);

+    	

+    	OMElement newElement = (new StAXOMBuilder(this.factory, llomRoot

+				.getXMLStreamReader())).getDocumentElement();

+		newElement.build();

+		OMElement secondElement = newElement.getFirstElement();

+		assertNotNull(secondElement);

+		assertEquals(secondElement.getText(),text);		

+    }

+    

+    public void testAddDOOMTextAsChild() throws XMLStreamException {

+    	OMFactory doomFactory = DOOMAbstractFactory.getOMFactory();

+    	OMFactory llomFactory = OMAbstractFactory.getOMFactory();

+    	String text = "This was a DOOM Text";

+    	

+    	OMElement llomRoot = llomFactory.createOMElement("root",null);

+    	

+    	OMText doomText = doomFactory.createOMText(text);

+    	llomRoot.addChild(doomText);

+    	

+    	OMElement newElement = (new StAXOMBuilder(this.factory, llomRoot

+				.getXMLStreamReader())).getDocumentElement();

+		newElement.build();

+		assertEquals(newElement.getText(),text);		

+    }

+    

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMEnvelopeTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMEnvelopeTest.java
new file mode 100644
index 0000000..7da3147
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMEnvelopeTest.java
@@ -0,0 +1,82 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom;

+

+import org.apache.axiom.om.OMAbstractFactory;

+import org.apache.axiom.om.OMTestCase;

+import org.apache.axiom.om.OMTestUtils;

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+import org.apache.axiom.soap.SOAPBody;

+import org.apache.axiom.soap.SOAPEnvelope;

+import org.apache.axiom.soap.SOAPHeader;

+import org.apache.axiom.soap.SOAPProcessingException;

+

+public class OMEnvelopeTest extends OMTestCase {

+    private Log log = LogFactory.getLog(getClass());

+    public OMEnvelopeTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+    }

+

+    public void testGetHeader1() {

+        SOAPHeader header = soapEnvelope.getHeader();

+        assertTrue("Header information retrieved not correct",

+                (header != null &&

+                header.getLocalName().equalsIgnoreCase("Header")));

+    }

+

+    public void testGetBody1() {

+        SOAPBody body = soapEnvelope.getBody();

+        assertTrue("Header information retrieved not correct",

+                (body != null && body.getLocalName().equalsIgnoreCase("Body")));

+    }

+

+    private SOAPEnvelope getSecondEnvelope() throws Exception {

+        return (SOAPEnvelope) OMTestUtils.getOMBuilder(

+                getTestResourceFile("soap/sample1.xml"))

+                .getDocumentElement();

+    }

+

+    public void testGetHeader2() throws Exception {

+        SOAPHeader header = getSecondEnvelope().getHeader();

+        assertTrue("Header information retrieved not correct",

+                (header != null &&

+                header.getLocalName().equalsIgnoreCase("Header")));

+    }

+

+    public void testGetBody2() throws Exception {

+        SOAPBody body = getSecondEnvelope().getBody();

+        assertTrue("Header information retrieved not correct",

+                (body != null && body.getLocalName().equalsIgnoreCase("Body")));

+    }

+

+    public void testDefaultEnveleope() {

+        SOAPEnvelope env = null;

+        try {

+            env = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();

+        } catch (SOAPProcessingException e) {

+            log.info(e.getMessage());

+            fail(e.getMessage());

+        }

+        assertNotNull(env);

+        assertNotNull("Body should not be null", env.getBody());

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMHeaderBlockTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMHeaderBlockTest.java
new file mode 100644
index 0000000..47b4c6d
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMHeaderBlockTest.java
@@ -0,0 +1,59 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom;

+

+import org.apache.axiom.om.OMTestCase;

+import org.apache.axiom.soap.SOAPHeader;

+import org.apache.axiom.soap.SOAPHeaderBlock;

+

+import java.util.Iterator;

+

+public class OMHeaderBlockTest extends OMTestCase {

+    SOAPHeader soapHeader;

+    SOAPHeaderBlock soapHeaderElement;

+

+    public OMHeaderBlockTest(String testName) {

+        super(testName);

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+        soapHeader = soapEnvelope.getHeader();

+        Iterator headerElementIter = soapHeader.examineAllHeaderBlocks();

+        if (headerElementIter.hasNext()) {

+            soapHeaderElement = (SOAPHeaderBlock) headerElementIter.next();

+        }

+    }

+

+    public void testSetAndGetActor() {

+        String newActorURI = "http://newActor.org";

+        soapHeaderElement.setRole(newActorURI);

+        assertTrue("Actor was not properly set",

+                soapHeaderElement.getRole().equalsIgnoreCase(newActorURI));

+    }

+

+    public void testSetAndGetMustUnderstand() {

+        soapHeaderElement.setMustUnderstand(false);

+        assertTrue("MustUnderstand was not properly set",

+                !soapHeaderElement.getMustUnderstand());

+    }

+

+    public void testGetMustUnderstand() {

+        //TODO Implement getMustUnderstand().

+    }

+

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMHeaderTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMHeaderTest.java
new file mode 100644
index 0000000..fefe700
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/OMHeaderTest.java
@@ -0,0 +1,85 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom;

+

+import org.apache.axiom.om.OMTestCase;

+import org.apache.axiom.om.impl.OMNamespaceImpl;

+import org.apache.axiom.soap.SOAPHeader;

+import org.apache.axiom.soap.SOAPHeaderBlock;

+

+import java.util.Iterator;

+

+public class OMHeaderTest extends OMTestCase {

+    SOAPHeader soapHeader;

+

+    public OMHeaderTest(String testName) {

+        super(testName);

+    }

+

+    public static void main(String[] args) {

+    }

+

+    /*

+     * @see TestCase#setUp()

+     */

+    protected void setUp() throws Exception {

+        super.setUp();

+        soapHeader = soapEnvelope.getHeader();

+    }

+

+    public void testAddHeaderElement() {

+        String newElementName = "MyHeaderElement";

+        SOAPHeaderBlock soapHeaderElement = soapHeader.addHeaderBlock(

+                newElementName,

+                new OMNamespaceImpl("http://opensource.lk", "lsf"));

+        assertTrue(

+                "Header Element added has different parent than it should have",

+                soapHeaderElement.getParent() == soapHeader);

+        assertTrue(

+                "Header Element added has different localname than it was given",

+                soapHeaderElement.getLocalName().equalsIgnoreCase(

+                        newElementName));

+    }

+

+    public void testExamineHeaderElements() {

+    }

+

+    public void testExtractHeaderElements() {

+        //TODO Implement extractHeaderBlocks().

+    }

+

+    public void testExamineMustUnderstandHeaderElements() {

+        //TODO Implement examineMustUnderstandHeaderBlocks().

+    }

+

+    public void testExamineAllHeaderElements() {

+        Iterator iterator = soapHeader.examineAllHeaderBlocks();

+        int headerElementCount = 0;

+        while (iterator.hasNext()) {

+            iterator.next();

+            headerElementCount++;

+        }

+        assertTrue(

+                "Number of header elements in the header differs from expected value of 3",

+                headerElementCount == 3);

+    }

+

+    public void testExtractAllHeaderElements() {

+        //TODO Implement extractAllHeaderBlocks().

+    }

+

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11SerializerTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11SerializerTest.java
new file mode 100644
index 0000000..1863a40
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11SerializerTest.java
@@ -0,0 +1,54 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+package org.apache.axiom.soap.impl.llom.soap11;

+

+import org.apache.axiom.om.OMTestCase;

+import org.apache.axiom.soap.SOAPEnvelope;

+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;

+

+import javax.xml.stream.XMLStreamException;

+

+public class SOAP11SerializerTest extends OMTestCase {

+

+    public SOAP11SerializerTest(String testName) {

+        super(testName);

+    }

+

+    protected StAXSOAPModelBuilder getOMBuilder(String fileName) throws Exception {

+        return super.getOMBuilder(fileName);

+    }

+

+    protected void setUp() throws Exception {

+        super.setUp();

+        soapEnvelope =

+                (SOAPEnvelope) getOMBuilder("soap/soap11/soap11fault.xml")

+                .getDocumentElement();

+    }

+

+    /**

+     * This will check whether we can call the serialize method two times, if the first calls makes the object model.

+     * @throws Exception

+     */

+    public void testSerialize() throws Exception {

+        try {

+            soapEnvelope.toString();

+            soapEnvelope.toStringWithConsume();

+        } catch (XMLStreamException e) {

+            fail("This test should not fail as one must be able to serialize twice if the object model is built in the first time");

+        }

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/xpath/AXIOMXPathTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/xpath/AXIOMXPathTest.java
new file mode 100644
index 0000000..8268129
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/xpath/AXIOMXPathTest.java
@@ -0,0 +1,56 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+

+

+package org.apache.axiom.xpath;

+

+import junit.framework.Test;

+import junit.framework.TestSuite;

+import org.apache.axiom.om.impl.builder.StAXOMBuilder;

+import org.apache.axiom.om.xpath.DocumentNavigator;

+import org.jaxen.FunctionCallException;

+import org.jaxen.Navigator;

+

+import javax.xml.stream.XMLInputFactory;

+import javax.xml.stream.XMLStreamReader;

+import java.io.FileInputStream;

+

+public class AXIOMXPathTest extends XPathTestBase {

+    public AXIOMXPathTest(String name) {

+        super(name);

+    }

+

+    public static Test suite() {

+        return new TestSuite(AXIOMXPathTest.class);

+    }

+

+    public Navigator getNavigator() {

+        return new DocumentNavigator();

+    }

+

+    public Object getDocument(String uri) throws Exception {

+        try {

+            XMLStreamReader parser =

+                    XMLInputFactory.newInstance().createXMLStreamReader(

+                            new FileInputStream(uri));

+            StAXOMBuilder builder =

+                    new StAXOMBuilder(parser);

+            return builder.getDocumentElement();

+        } catch (Exception e) {

+            throw new FunctionCallException(e);

+        }

+    }

+}

diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/xpath/XPathAppliedToSOAPEnvelopeTest.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/xpath/XPathAppliedToSOAPEnvelopeTest.java
new file mode 100644
index 0000000..96daaaf
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/xpath/XPathAppliedToSOAPEnvelopeTest.java
@@ -0,0 +1,73 @@
+package org.apache.axiom.xpath;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class XPathAppliedToSOAPEnvelopeTest extends TestCase {
+
+    public void testDocumentNotAdded () throws Exception {
+		SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
+
+		OMElement elem1 = factory.createOMElement("elem1",null);
+		OMElement elem2 = factory.createOMElement("elem2",null);
+		OMElement elem3 = factory.createOMElement("elem3",null);
+		elem2.addChild(elem3);
+		elem1.addChild(elem2);
+		SOAPEnvelope envelope = factory.getDefaultEnvelope();
+		envelope.getBody().addChild(elem1);
+
+		//The only difference of the two test methods is the following line.
+//		factory.createOMDocument().addChild(envelope);
+
+		String XPathString = "//elem1";
+
+		AXIOMXPath XPath = new AXIOMXPath (XPathString);
+		OMNode node = (OMNode) XPath.selectSingleNode(envelope);
+
+
+		assertNotNull(node);
+	}
+
+	public void testDocumentAdded () throws Exception {
+		SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
+
+		OMElement elem1 = factory.createOMElement("elem1",null);
+		OMElement elem2 = factory.createOMElement("elem2",null);
+		OMElement elem3 = factory.createOMElement("elem3",null);
+		elem2.addChild(elem3);
+		elem1.addChild(elem2);
+		SOAPEnvelope envelope = factory.getDefaultEnvelope();
+		envelope.getBody().addChild(elem1);
+
+		//The only difference of the two test methods is the following line.
+		factory.createOMDocument().addChild(envelope);
+
+		String XPathString = "//elem1";
+
+		AXIOMXPath XPath = new AXIOMXPath (XPathString);
+		OMNode node = (OMNode) XPath.selectSingleNode(envelope);
+
+
+		assertNotNull(node);
+	}
+}
diff --git a/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/xpath/XPathTestBase.java b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/xpath/XPathTestBase.java
new file mode 100644
index 0000000..efab06c
--- /dev/null
+++ b/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/xpath/XPathTestBase.java
@@ -0,0 +1,1801 @@
+/*

+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/test/org/jaxen/XPathTestBase.java,v 1.36 2005/06/17 13:22:31 elharo Exp $

+ * $Revision: 1.36 $

+ * $Date: 2005/06/17 13:22:31 $

+ *

+ * ====================================================================

+ *

+ * Copyright (C) 2000-2002 bob mcwhirter & James Strachan.

+ * All rights reserved.

+ *

+ * Redistribution and use in source and binary forms, with or without

+ * modification, are permitted provided that the following conditions

+ * are met:

+ *

+ * 1. Redistributions of source code must retain the above copyright

+ *    notice, this list of conditions, and the following disclaimer.

+ *

+ * 2. Redistributions in binary form must reproduce the above copyright

+ *    notice, this list of conditions, and the disclaimer that follows

+ *    these conditions in the documentation and/or other materials

+ *    provided with the distribution.

+ *

+ * 3. The name "Jaxen" must not be used to endorse or promote products

+ *    derived from this software without prior written permission.  For

+ *    written permission, please contact license@jaxen.org.

+ *

+ * 4. Products derived from this software may not be called "Jaxen", nor

+ *    may "Jaxen" appear in their name, without prior written permission

+ *    from the Jaxen Project Management (pm@jaxen.org).

+ *

+ * In addition, we request (but do not require) that you include in the

+ * end-user documentation provided with the redistribution and/or in the

+ * software itself an acknowledgement equivalent to the following:

+ *     "This product includes software developed by the

+ *      Jaxen Project (http://www.jaxen.org/)."

+ * Alternatively, the acknowledgment may be graphical using the logos

+ * available at http://www.jaxen.org/

+ *

+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED

+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES

+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE

+ * DISCLAIMED.  IN NO EVENT SHALL THE Jaxen AUTHORS OR THE PROJECT

+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,

+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT

+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF

+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND

+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,

+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT

+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF

+ * SUCH DAMAGE.

+ *

+ * ====================================================================

+ * This software consists of voluntary contributions made by many

+ * individuals on behalf of the Jaxen Project and was originally

+ * created by bob mcwhirter <bob@werken.com> and

+ * James Strachan <jstrachan@apache.org>.  For more information on the

+ * Jaxen Project, please see <http://www.jaxen.org/>.

+ *

+ * $Id: XPathTestBase.java,v 1.36 2005/06/17 13:22:31 elharo Exp $

+ */

+

+

+package org.apache.axiom.xpath;

+

+import junit.framework.TestCase;

+import org.apache.commons.logging.Log;

+import org.apache.commons.logging.LogFactory;

+import org.jaxen.*;

+import org.jaxen.function.StringFunction;

+import org.jaxen.pattern.Pattern;

+import org.jaxen.saxpath.helpers.XPathReaderFactory;

+

+import java.util.ArrayList;

+import java.util.Iterator;

+import java.util.List;

+

+public abstract class XPathTestBase extends TestCase

+{

+    protected static String VAR_URI   = "http://jaxen.org/test-harness/var";

+    protected static String TESTS_ROOT = "test-resources/";

+    protected static String TESTS_XML = TESTS_ROOT + "xml/test/tests.xml";

+

+    protected static boolean verbose = false;

+    protected static boolean debug = false;

+    private ContextSupport contextSupport;

+    private Log log = LogFactory.getLog(getClass());

+

+    public XPathTestBase(String name)

+    {

+        super(name);

+    }

+

+    public void setUp()

+    {

+        this.contextSupport = null;

+        System.setProperty(XPathReaderFactory.DRIVER_PROPERTY,

+                "");

+        log("-----------------------------");

+    }

+

+    public void log(String text)

+    {

+        log(verbose,

+                text);

+    }

+

+    public void log(boolean actualVerbose,

+                    String text)

+    {

+        if (actualVerbose) log.info(text);

+    }

+

+    protected void assertCountXPath(int expectedSize, Object context, String xpathStr) throws JaxenException

+    {

+        assertCountXPath2(expectedSize, context, xpathStr);

+    }

+

+    protected Object assertCountXPath2(int expectedSize, Object context,String xpathStr) throws JaxenException

+    {

+        log(debug,

+                "  Select :: " + xpathStr);

+        BaseXPath xpath = new BaseXPath(xpathStr, getNavigator());

+        List results = xpath.selectNodes(getContext(context));

+        log(debug,

+                "    Expected Size :: " + expectedSize);

+        log(debug,

+                "    Result Size   :: " + results.size());

+        if (expectedSize != results.size())

+        {

+            log(debug,

+                    "      ## FAILED");

+            log(debug,

+                    "      ## xpath: " + xpath + " = " + xpath.debug());

+            Iterator resultIter = results.iterator();

+            while (resultIter.hasNext())

+            {

+                log(debug,

+                        "      --> " + resultIter.next());

+            }

+        }

+        assertEquals(xpathStr,

+                expectedSize,

+                results.size());

+        if (expectedSize > 0)

+        {

+            return results.get(0);

+        }

+        return null;

+    }

+

+    protected void assertInvalidXPath(Object context, String xpathStr)

+    {

+        try

+        {

+            log(debug,

+                    "  Select :: " + xpathStr);

+            BaseXPath xpath = new BaseXPath(xpathStr, getNavigator());

+            List results = xpath.selectNodes(getContext(context));

+            log(debug,

+                    "    Result Size   :: " + results.size());

+            fail("An exception was expected.");

+        }

+        catch (UnsupportedAxisException e)

+        {

+            log(debug,

+                    "      ## SKIPPED -- Unsupported Axis");

+        }

+        catch (JaxenException e)

+        {

+            log(debug, "    Caught expected exception " + e.getMessage());

+        }

+    }

+

+    protected void assertValueOfXPath(String expected, Object context, String xpathStr) throws JaxenException

+    {

+        try

+        {

+            BaseXPath xpath = new BaseXPath(xpathStr, getNavigator());

+            Object node = xpath.evaluate(getContext(context));

+            String result = StringFunction.evaluate(node,

+                    getNavigator());

+            log(debug,

+                    "  Select :: " + xpathStr);

+            log(debug,

+                    "    Expected :: " + expected);

+            log(debug,

+                    "    Result   :: " + result);

+            if (!expected.equals(result))

+            {

+                log(debug,

+                        "      ## FAILED");

+                log(debug,

+                        "      ## xpath: " + xpath + " = " + xpath.debug());

+            }

+            assertEquals(xpathStr,

+                    expected,

+                    result);

+        }

+        catch (UnsupportedAxisException e)

+        {

+            log(debug,

+                    "      ## SKIPPED -- Unsupported Axis ");

+        }

+    }

+

+    protected Context getContext(Object contextNode)

+    {

+        Context context = new Context(getContextSupport());

+        List list = new ArrayList(1);

+        list.add(contextNode);

+        context.setNodeSet(list);

+        return context;

+    }

+

+    public ContextSupport getContextSupport()

+    {

+        if (this.contextSupport == null)

+        {

+            this.contextSupport = new ContextSupport(new SimpleNamespaceContext(),

+                    XPathFunctionContext.getInstance(),

+                    new SimpleVariableContext(),

+                    getNavigator());

+        }

+        return this.contextSupport;

+    }

+

+    public abstract Navigator getNavigator();

+

+    public abstract Object getDocument(String url) throws Exception;

+

+    public void testGetNodeType() throws FunctionCallException, UnsupportedAxisException

+    {

+        Navigator nav = getNavigator();

+        Object document = nav.getDocument(TESTS_ROOT + "xml/testNamespaces.xml");

+        int count = 0;

+        Iterator descendantOrSelfAxisIterator = nav.getDescendantOrSelfAxisIterator(document);

+        while (descendantOrSelfAxisIterator.hasNext())

+        {

+            Object node = descendantOrSelfAxisIterator.next();

+            Iterator namespaceAxisIterator = nav.getNamespaceAxisIterator(node);

+            while (namespaceAxisIterator.hasNext())

+            {

+                count++;

+                Object o = namespaceAxisIterator.next();

+                assertEquals("Node type mismatch", Pattern.NAMESPACE_NODE, nav.getNodeType(o));

+            }

+        }

+        assertEquals(25, count);

+    }

+

+

+    /* test for jaxen-24

+    */

+    public void testid53371() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/jaxen24.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/body/div", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(1, context, "preceding::*[1]");

+            assertValueOfXPath("span", context, "local-name(preceding::*[1])");

+        }

+    }

+

+    /* jaxen-58

+    */

+    public void testid53391() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/jaxen24.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(0, context, "//preceding::x");

+            assertCountXPath(0, context, "//following::x");

+            assertCountXPath(0, context, "/descendant::*/preceding::x");

+            assertCountXPath(0, context, "/descendant::node()/preceding::x");

+        }

+    }

+

+    /* test for jaxen-3

+    */

+    public void testid53430() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/simple.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertValueOfXPath("abd", context, "string()");

+        }

+    }

+

+    public void testid53441() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/simple.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/root", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertValueOfXPath("abd", context, "string()");

+        }

+    }

+

+    public void testid53452() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/simple.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/root/a", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertValueOfXPath("a", context, "string()");

+        }

+    }

+

+    public void testid53463() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/simple.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/root/c", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertValueOfXPath("d", context, "string()");

+        }

+    }

+

+    /* test for jaxen-3

+    */

+    public void testid53482() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/jaxen3.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(1, context, "/Configuration/hostname/attrlist/hostname[. = 'CE-A'] ");

+        }

+    }

+

+    /* parser test cases all of which should fail

+    */

+    public void testid53502() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/numbers.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            /* repeated xpaths, jaxen-35

+            */

+            assertInvalidXPath(context, "/numbers numbers");

+            /* invalid xpath, jaxen-34

+            */

+            assertInvalidXPath(context, "/a/b[c > d]efg");

+            /* invalid xpath, jaxen-27

+            */

+            assertInvalidXPath(context, "/inv/child::");

+            /* invalid xpath, jaxen-26

+            */

+            assertInvalidXPath(context, "/invoice/@test[abcd");

+            assertInvalidXPath(context, "/invoice/@test[abcd > x");

+            /* unterminated string

+            */

+            assertInvalidXPath(context, "string-length('a");

+            /* various edge cases where code threw no exception

+            */

+            assertInvalidXPath(context, "/descendant::()");

+            assertInvalidXPath(context, "(1 + 1");

+        }

+    }

+

+    /* test cases for the use of underscores in names

+    */

+    public void testid53602() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/underscore.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(1, context, "/root/@a");

+            assertCountXPath(1, context, "/root/@_a");

+            assertCountXPath(1, context, "/root/b");

+            assertCountXPath(1, context, "/root/_b");

+            assertValueOfXPath("1", context, "/root/@a");

+            assertValueOfXPath("2", context, "/root/@_a");

+            assertValueOfXPath("1", context, "/root/b");

+            assertValueOfXPath("2", context, "/root/_b");

+        }

+    }

+

+    /* test cases for the use of = with node-sets

+    */

+    public void testid53662() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/web.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertValueOfXPath("true", context, "/web-app/servlet/servlet-name = 'file'");

+            assertValueOfXPath("true", context, "/web-app/servlet/servlet-name = 'snoop'");

+        }

+    }

+

+    public void testid53685() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/numbers.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertValueOfXPath("true", context, "/numbers/set/nr = '-3'");

+            assertValueOfXPath("true", context, "/numbers/set/nr = -3");

+            assertValueOfXPath("true", context, "/numbers/set/nr = 24");

+            assertValueOfXPath("true", context, "/numbers/set/nr/@value = '9999'");

+            assertValueOfXPath("true", context, "/numbers/set/nr/@value = 9999.0");

+            assertValueOfXPath("true", context, "/numbers/set/nr/@value = 66");

+        }

+    }

+

+    /* test basic math...

+    */

+    public void testid53733() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/numbers.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertValueOfXPath("true", context, "(8 * 2 + 1) = 17");

+            assertValueOfXPath("true", context, "(1 + 8 * 2) = 17");

+            assertValueOfXPath("true", context, "(7 - 3 + 1) = 5");

+            assertValueOfXPath("true", context, "(8 - 4 + 5 - 6) = 3");

+            /* left-assoc tests, comments show WRONG evaluation

+            */

+            /* 3 - 2 - 1 != 2

+            */

+            assertValueOfXPath("0", context, "3 - 2 - 1");

+            /* 8 div 4 div 2 != 4

+            */

+            assertValueOfXPath("1", context, "8 div 4 div 2");

+            /* 3 mod 5 mod 7 != 1

+            */

+            assertValueOfXPath("3", context, "3 mod 7 mod 5");

+            /* 1=(2=2) is true

+            */

+            assertValueOfXPath("false", context, "1 = 2 = 2");

+            /*  2!=(3!=1) => 2!=1 => true, (2!=3)!=1 => 1!=1 => false

+            */

+            assertValueOfXPath("false", context, "2 != 3 != 1");

+            /* 3 > (2 > 1) is true

+            */

+            assertValueOfXPath("false", context, "3 > 2 > 1");

+            /* 3 >= (2 >= 2) is true

+            */

+            assertValueOfXPath("false", context, "3 >= 2 >= 2");

+            /* 1 < (2 < 3) is false

+            */

+            assertValueOfXPath("true", context, "1 < 2 < 3");

+            /* 0 <= (2 <= 3) is true

+            */

+            assertValueOfXPath("true", context, "2 <= 2 <= 3");

+        }

+    }

+

+    /* test cases for preceding axis with different node types

+    */

+    public void testid53850() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/pi2.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/a/c", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(1, context, "//processing-instruction()");

+            assertCountXPath(1, context, "preceding-sibling::*");

+            assertCountXPath(5, context, "preceding-sibling::node()");

+            assertCountXPath(1, context, "preceding-sibling::*[1]");

+            assertCountXPath(1, context, "preceding-sibling::processing-instruction()");

+            assertValueOfXPath("order-by=\"x\"", context, "preceding-sibling::processing-instruction()");

+            assertValueOfXPath("foo", context, "preceding-sibling::*[1]");

+            assertValueOfXPath("order-by=\"x\"", context, "preceding-sibling::node()[2]");

+        }

+    }

+

+    public void testid53911() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/id.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        SimpleVariableContext varContext = new SimpleVariableContext();

+        varContext.setVariableValue(null, "foobar", "foobar");

+        varContext.setVariableValue(null, "foo", "foo");

+        getContextSupport().setVariableContext(varContext);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertValueOfXPath("foobar", context, "$foobar");

+            assertCountXPath(1, context, "/foo[@id=$foobar]");

+            assertCountXPath(0, context, "/foo[@id='$foobar']");

+            assertCountXPath(1, context, "/foo[concat($foo, 'bar')=@id]");

+            assertCountXPath(0, context, "CD_Library/artist[@name=$artist]");

+        }

+    }

+

+    public void testid53957() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/id.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            /* attributes have a parent: their element

+            */

+            assertCountXPath(1, context, "/foo/@id/parent::foo");

+        }

+    }

+

+    /* attributes can also be used as context nodes

+    */

+    public void testid53975() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/id.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/foo/@id", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(1, context, "parent::foo");

+        }

+    }

+

+    public void testid53992() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/pi.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(3, context, "//processing-instruction()");

+            assertCountXPath(2, context, "//processing-instruction('cheese')");

+            try

+            {

+                Object result = assertCountXPath2(1, context, "//processing-instruction('toast')");

+                assertValueOfXPath("is tasty", result, "string()");

+            }

+            catch (UnsupportedAxisException e)

+            {

+                log(debug, "      ## SKIPPED -- Unsupported Axis");

+            }

+        }

+    }

+

+    /* test evaluate() extension function

+    */

+    public void testid54032() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/evaluate.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(3, context, "evaluate('//jumps/*')");

+            assertCountXPath(1, context, "evaluate('//jumps/object/dog')");

+            assertCountXPath(0, context, "evaluate('//jumps/object')/evaluate");

+            assertCountXPath(1, context, "evaluate('//jumps/object')/dog");

+            assertCountXPath(1, context, "evaluate('//jumps/*')/dog");

+            assertCountXPath(1, context, "//metatest[ evaluate(@select) = . ]");

+        }

+    }

+

+    public void testid54082() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/numbers.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/numbers/set[1]", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(1, context, "*[-3 = .]");

+            assertValueOfXPath("true", context, "54 < *");

+            assertValueOfXPath("true", context, "55 <= *");

+            assertValueOfXPath("false", context, "69 < *");

+            assertValueOfXPath("true", context, "-2 > *");

+            assertValueOfXPath("true", context, "-3 >= *");

+            assertValueOfXPath("false", context, "-4 >= *");

+        }

+    }

+

+    /* TODO

+    This context should work, but needs a fixed version of saxpath to parse the right-hand side

+    of the greater-than expression.

+    <context select="/numbers/set[2]">

+      <valueOf select="1 &gt; nr/@value">false</valueOf>

+      <valueOf select="55 &gt; nr/@value">false</valueOf>

+      <valueOf select="55 &gt;= nr/@value">true</valueOf>

+      <valueOf select="1000000 &gt; nr/@value">true</valueOf>

+    </context>

+    

+    */

+    /* test sibling axes 

+    */

+    public void testid54145() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/axis.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/root", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(0, context, "preceding-sibling::*");

+        }

+    }

+

+    public void testid54156() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/axis.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/root/a/a.3", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(2, context, "preceding::*");

+        }

+    }

+

+    public void testid54168() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/axis.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/root/a/a.3", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(2, context, "preceding-sibling::*");

+        }

+    }

+

+    public void testid54180() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/axis.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertValueOfXPath("a.2", context, "name(/root/a/a.3/preceding-sibling::*[1])");

+            assertValueOfXPath("a.1", context, "name(/root/a/a.3/preceding-sibling::*[2])");

+        }

+    }

+

+    public void testid54197() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/axis.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertValueOfXPath("a.4", context, "name(/root/a/a.3/following-sibling::*[1])");

+            assertValueOfXPath("a.5", context, "name(/root/a/a.3/following-sibling::*[2])");

+        }

+    }

+

+    public void testid54219() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/web.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertValueOfXPath("snoop", context, "/web-app/servlet[1]/servlet-name");

+            assertValueOfXPath("snoop", context, "/web-app/servlet[1]/servlet-name/text()");

+            assertValueOfXPath("file", context, "/web-app/servlet[2]/servlet-name");

+            assertValueOfXPath("file", context, "/web-app/servlet[2]/servlet-name/text()");

+        }

+    }

+

+    public void testid54249() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/web.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/web-app/servlet[1]", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertValueOfXPath("snoop", context, "servlet-name");

+            assertValueOfXPath("snoop", context, "servlet-name/text()");

+        }

+    }

+

+    public void testid54266() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/web.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/web-app/servlet[2]/servlet-name", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(3, context, "preceding::*");

+        }

+    }

+

+    public void testid54278() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/web.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/web-app/servlet[2]/servlet-name", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(13, context, "following::*");

+        }

+    }

+

+    /* test name

+    */

+    public void testid54298() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/web.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            try

+            {

+                Object result = assertCountXPath2(1, context, "*");

+                assertValueOfXPath("web-app", result, "name()");

+            }

+            catch (UnsupportedAxisException e)

+            {

+                log(debug, "      ## SKIPPED -- Unsupported Axis");

+            }

+            /* NOTE that the child::node() tests only work if the

+              XML document does not comments or PIs

+

+            */

+            try

+            {

+                Object result = assertCountXPath2(1, context, "./*");

+                assertValueOfXPath("web-app", result, "name()");

+            }

+            catch (UnsupportedAxisException e)

+            {

+                log(debug, "      ## SKIPPED -- Unsupported Axis");

+            }

+            try

+            {

+                Object result = assertCountXPath2(1, context, "child::*");

+                assertValueOfXPath("web-app", result, "name()");

+            }

+            catch (UnsupportedAxisException e)

+            {

+                log(debug, "      ## SKIPPED -- Unsupported Axis");

+            }

+            try

+            {

+                Object result = assertCountXPath2(1, context, "/*");

+                assertValueOfXPath("web-app", result, "name()");

+            }

+            catch (UnsupportedAxisException e)

+            {

+                log(debug, "      ## SKIPPED -- Unsupported Axis");

+            }

+            try

+            {

+                Object result = assertCountXPath2(1, context, "/child::node()");

+                assertValueOfXPath("web-app", result, "name(.)");

+            }

+            catch (UnsupportedAxisException e)

+            {

+                log(debug, "      ## SKIPPED -- Unsupported Axis");

+            }

+            try

+            {

+                Object result = assertCountXPath2(1, context, "child::node()");

+                assertValueOfXPath("web-app", result, "name(.)");

+            }

+            catch (UnsupportedAxisException e)

+            {

+                log(debug, "      ## SKIPPED -- Unsupported Axis");

+            }

+            /* empty names

+            */

+            assertValueOfXPath("", context, "name()");

+            assertValueOfXPath("", context, "name(.)");

+            assertValueOfXPath("", context, "name(parent::*)");

+            assertValueOfXPath("", context, "name(/)");

+            assertValueOfXPath("", context, "name(/.)");

+            assertValueOfXPath("", context, "name(/self::node())");

+            /* name of root elemet

+            */

+            assertValueOfXPath("web-app", context, "name(node())");

+            assertValueOfXPath("web-app", context, "name(/node())");

+            assertValueOfXPath("web-app", context, "name(/*)");

+            assertValueOfXPath("web-app", context, "name(/child::*)");

+            assertValueOfXPath("web-app", context, "name(/child::node())");

+            assertValueOfXPath("web-app", context, "name(/child::node())");

+            assertValueOfXPath("web-app", context, "name(child::node())");

+            assertValueOfXPath("web-app", context, "name(./*)");

+            assertValueOfXPath("web-app", context, "name(*)");

+        }

+    }

+

+    public void testid54467() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/web.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/*", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            /* empty names

+            */

+            assertValueOfXPath("", context, "name(..)");

+            assertValueOfXPath("", context, "name(parent::node())");

+            assertValueOfXPath("", context, "name(parent::*)");

+            /* name of root elemet

+            */

+            assertValueOfXPath("web-app", context, "name()");

+            assertValueOfXPath("web-app", context, "name(.)");

+            assertValueOfXPath("web-app", context, "name(../*)");

+            assertValueOfXPath("web-app", context, "name(../child::node())");

+        }

+    }

+

+    /* test predicates

+    */

+    public void testid54522() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/nitf.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/nitf/head/docdata", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(1, context, "doc-id[@regsrc='AP' and @id-string='D76UIMO80']");

+        }

+    }

+

+    public void testid54534() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/nitf.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/nitf/head", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(1, context, "meta[@name='ap-cycle']");

+            assertCountXPath(1, context, "meta[@content='AP']");

+            assertCountXPath(8, context, "meta[@name and @content]");

+            assertCountXPath(1, context, "meta[@name='ap-cycle' and @content='AP']");

+            assertCountXPath(7, context, "meta[@name != 'ap-cycle']");

+        }

+    }

+

+    public void testid54570() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/nitf.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(1, context, "/nitf/head/meta[@name='ap-cycle']");

+            assertCountXPath(1, context, "/nitf/head/meta[@content='AP']");

+            assertCountXPath(8, context, "/nitf/head/meta[@name and @content]");

+            assertCountXPath(1, context, "/nitf/head/meta[@name='ap-cycle' and @content='AP']");

+            assertCountXPath(7, context, "/nitf/head/meta[@name != 'ap-cycle']");

+        }

+    }

+

+    public void testid54614() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/moreover.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(1, context, "/child::node()");

+            assertCountXPath(1, context, "/*");

+            assertCountXPath(20, context, "/*/article");

+            assertCountXPath(221, context, "//*");

+            assertCountXPath(20, context, "//*[local-name()='article']");

+            assertCountXPath(20, context, "//article");

+            assertCountXPath(20, context, "/*/*[@code]");

+            assertCountXPath(1, context, "/moreovernews/article[@code='13563275']");

+            try

+            {

+                BaseXPath xpath = new BaseXPath("/moreovernews/article[@code='13563275']", getNavigator());

+                List results = xpath.selectNodes(getContext(context));

+                Object result = results.get(0);

+                assertValueOfXPath("http://c.moreover.com/click/here.pl?x13563273", result, "url");

+            }

+            catch (UnsupportedAxisException e)

+            {

+                log(debug, "      ## SKIPPED -- Unsupported Axis");

+            }

+            try

+            {

+                BaseXPath xpath = new BaseXPath("/*/article[@code='13563275']", getNavigator());

+                List results = xpath.selectNodes(getContext(context));

+                Object result = results.get(0);

+                assertValueOfXPath("http://c.moreover.com/click/here.pl?x13563273", result, "url");

+            }

+            catch (UnsupportedAxisException e)

+            {

+                log(debug, "      ## SKIPPED -- Unsupported Axis");

+            }

+            try

+            {

+                BaseXPath xpath = new BaseXPath("//article[@code='13563275']", getNavigator());

+                List results = xpath.selectNodes(getContext(context));

+                Object result = results.get(0);

+                assertValueOfXPath("http://c.moreover.com/click/here.pl?x13563273", result, "url");

+            }

+            catch (UnsupportedAxisException e)

+            {

+                log(debug, "      ## SKIPPED -- Unsupported Axis");

+            }

+            try

+            {

+                BaseXPath xpath = new BaseXPath("//*[@code='13563275']", getNavigator());

+                List results = xpath.selectNodes(getContext(context));

+                Object result = results.get(0);

+                assertValueOfXPath("http://c.moreover.com/click/here.pl?x13563273", result, "url");

+            }

+            catch (UnsupportedAxisException e)

+            {

+                log(debug, "      ## SKIPPED -- Unsupported Axis");

+            }

+            try

+            {

+                BaseXPath xpath = new BaseXPath("/child::node()/child::node()[@code='13563275']", getNavigator());

+                List results = xpath.selectNodes(getContext(context));

+                Object result = results.get(0);

+                assertValueOfXPath("http://c.moreover.com/click/here.pl?x13563273", result, "url");

+            }

+            catch (UnsupportedAxisException e)

+            {

+                log(debug, "      ## SKIPPED -- Unsupported Axis");

+            }

+            try

+            {

+                BaseXPath xpath = new BaseXPath("/*/*[@code='13563275']", getNavigator());

+                List results = xpath.selectNodes(getContext(context));

+                Object result = results.get(0);

+                assertValueOfXPath("http://c.moreover.com/click/here.pl?x13563273", result, "url");

+            }

+            catch (UnsupportedAxisException e)

+            {

+                log(debug, "      ## SKIPPED -- Unsupported Axis");

+            }

+        }

+    }

+

+    /* test other node types

+    */

+    public void testid54747() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/contents.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(3, context, "processing-instruction()");

+            assertCountXPath(3, context, "/processing-instruction()");

+            assertCountXPath(1, context, "/comment()");

+            assertCountXPath(1, context, "comment()");

+            assertCountXPath(2, context, "/child::node()/comment()");

+            assertCountXPath(2, context, "/*/comment()");

+            assertCountXPath(3, context, "//comment()");

+        }

+    }

+

+    /* test positioning

+    */

+    public void testid54802() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/fibo.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(9, context, "/*/fibonacci[position() < 10]");

+            assertValueOfXPath("196417", context, "sum(//fibonacci)");

+            assertValueOfXPath("325", context, "sum(//fibonacci/@index)");

+            assertValueOfXPath("1", context, "/*/fibonacci[2]");

+            assertValueOfXPath("75025", context, "/*/fibonacci[ count(/*/fibonacci) ]");

+            assertValueOfXPath("46368", context, "/*/fibonacci[ count(/*/fibonacci) - 1 ]");

+        }

+    }

+

+    /* test number functions

+    */

+    /* test Axes 

+    */

+    public void testid54853() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/web.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(19, context, "descendant-or-self::*");

+            assertCountXPath(19, context, "descendant::*");

+            assertCountXPath(19, context, "/descendant::*");

+            assertCountXPath(19, context, "/descendant-or-self::*");

+            assertCountXPath(2, context, "/descendant::servlet");

+            assertCountXPath(2, context, "/descendant-or-self::servlet");

+            assertCountXPath(2, context, "descendant-or-self::servlet");

+            assertCountXPath(2, context, "descendant::servlet");

+            assertCountXPath(2, context, "/*/servlet");

+            assertValueOfXPath("2", context, "count(/*/servlet)");

+            assertCountXPath(2, context, "//servlet");

+            assertValueOfXPath("2", context, "count(//servlet)");

+        }

+    }

+

+    public void testid54932() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/web.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/web-app", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(2, context, "/descendant::servlet");

+            assertCountXPath(2, context, "/descendant-or-self::servlet");

+            assertCountXPath(2, context, "descendant-or-self::servlet");

+            assertCountXPath(2, context, "descendant::servlet");

+        }

+    }

+

+    public void testid54968() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/much_ado.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(5, context, "/descendant::ACT");

+            assertCountXPath(5, context, "descendant::ACT");

+            assertValueOfXPath("Much Ado about Nothing", context, "/PLAY/TITLE");

+            assertValueOfXPath("4", context, "2+2");

+            assertValueOfXPath("21", context, "5 * 4 + 1");

+            assertValueOfXPath("5", context, "count(descendant::ACT)");

+            assertValueOfXPath("35", context, "10 + count(descendant::ACT) * 5");

+            assertValueOfXPath("75", context, "(10 + count(descendant::ACT)) * 5");

+        }

+    }

+

+    public void testid55020() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/much_ado.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/PLAY/ACT[2]/SCENE[1]", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(5, context, "/descendant::ACT");

+            assertCountXPath(5, context, "../../descendant::ACT");

+            assertCountXPath(141, context, "/PLAY/ACT[2]/SCENE[1]/descendant::SPEAKER");

+            assertCountXPath(141, context, "descendant::SPEAKER");

+            assertValueOfXPath("646", context, "count(descendant::*)+1");

+            assertValueOfXPath("142", context, "count(descendant::SPEAKER)+1");

+            assertValueOfXPath("2", context, "count(ancestor::*)");

+            assertValueOfXPath("1", context, "count(ancestor::PLAY)");

+            assertValueOfXPath("3", context, "count(ancestor-or-self::*)");

+            assertValueOfXPath("1", context, "count(ancestor-or-self::PLAY)");

+            assertValueOfXPath("6", context, "5+count(ancestor::*)-1");

+        }

+    }

+

+    public void testid55090() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/much_ado.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            /* Test correct predicate application

+            */

+            assertValueOfXPath("5", context, "count(/PLAY/ACT/SCENE[1])");

+        }

+    }

+

+    /* test axis node ordering

+    */

+    public void testid55112() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/web.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            /* Reported as Jira issue JAXEN-24

+            */

+            assertCountXPath(1, context, "//servlet-mapping/preceding::*[1][name()='description']");

+            assertCountXPath(1, context, "/web-app/servlet//description/following::*[1][name()='servlet-mapping']");

+            assertCountXPath(1, context, "/web-app/servlet//description/following::*[2][name()='servlet-name']");

+        }

+    }

+

+    /* test document function

+    */

+    public void testid55150() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/text.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            try

+            {

+                Object result = assertCountXPath2(1, context, "document('test-resources/xml/web.xml')");

+                assertValueOfXPath("snoop", result, "/web-app/servlet[1]/servlet-name");

+                assertValueOfXPath("snoop", result, "/web-app/servlet[1]/servlet-name/text()");

+            }

+            catch (UnsupportedAxisException e)

+            {

+                log(debug, "      ## SKIPPED -- Unsupported Axis");

+            }

+            assertValueOfXPath("snoop", context, "document('test-resources/xml/web.xml')/web-app/servlet[1]/servlet-name");

+        }

+    }

+

+    /* Test to check if the context changes when an extension function is used.

+    First test is an example, second is the actual test.

+    

+    */

+    public void testid55189() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/text.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/foo/bar/cheese[1]", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertValueOfXPath("3foo3", context, "concat(./@id,'foo',@id)");

+            assertValueOfXPath("3snoop3", context, "concat(./@id,document('test-resources/xml/web.xml')/web-app/servlet[1]/servlet-name,./@id)");

+        }

+    }

+

+    public void testid55211() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/message.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertValueOfXPath("Pruefgebiete", context, "/message/body/data/items/item[name/text()='parentinfo']/value");

+            assertValueOfXPath("Pruefgebiete", context, "document('test-resources/xml/message.xml')/message/body/data/items/item[name/text()='parentinfo']/value");

+        }

+    }

+

+    /* test behaviour of AbsoluteLocationPath

+    */

+    public void testid55183() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/simple.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/root/a", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertValueOfXPath("ab", context, "concat( ., /root/b )");

+            assertValueOfXPath("ba", context, "concat( ../b, . )");

+            assertValueOfXPath("ba", context, "concat( /root/b, . )");

+            assertValueOfXPath("db", context, "concat( /root/c/d, ../b )");

+        }

+    }

+

+    /* test the translate() function

+    */

+    public void testid55268() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/simple.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertValueOfXPath("", context, "translate( '', '', '' )");

+            assertValueOfXPath("abcd", context, "translate( 'abcd', '', '' )");

+            assertValueOfXPath("abcd", context, "translate( 'abcd', 'abcd', 'abcd' )");

+            assertValueOfXPath("abcd", context, "translate( 'abcd', 'dcba', 'dcba' )");

+            assertValueOfXPath("dcba", context, "translate( 'abcd', 'abcd', 'dcba' )");

+            assertValueOfXPath("ab", context, "translate( 'abcd', 'abcd', 'ab' )");

+            assertValueOfXPath("cd", context, "translate( 'abcd', 'cdab', 'cd' )");

+            assertValueOfXPath("xy", context, "translate( 'abcd', 'acbd', 'xy' )");

+            assertValueOfXPath("abcd", context, "translate( 'abcd', 'abcdb', 'abcdb' )");

+            assertValueOfXPath("abcd", context, "translate( 'abcd', 'abcd', 'abcdb' )");

+        }

+    }

+

+    public void testid55331() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/simple.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertValueOfXPath("234", context, "substring('12345', 1.5, 2.6)");

+            assertValueOfXPath("12", context, "substring('12345', 0, 3)");

+            assertValueOfXPath("", context, "substring('12345', 0 div 0, 3)");

+            assertValueOfXPath("", context, "substring('12345', 1, 0 div 0)");

+            assertValueOfXPath("12345", context, "substring('12345', -42, 1 div 0)");

+            assertValueOfXPath("", context, "substring('12345', -1 div 0, 1 div 0)");

+            assertValueOfXPath("345", context, "substring('12345', 3)");

+            assertValueOfXPath("12345", context, "substring('12345',1,15)");

+        }

+    }

+

+    /* Some tests for the normalize-space() function

+    */

+    public void testid55382() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/simple.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertValueOfXPath("abc", context, "normalize-space('    abc    ')");

+            assertValueOfXPath("a b c", context, "normalize-space(' a  b  c  ')");

+            assertValueOfXPath("a b c", context, "normalize-space(' a \n b \n  c')");

+            /* Next test case addresses issue JAXEN-22

+            */

+            assertValueOfXPath("", context, "normalize-space(' ')");

+            /* Next test case addresses issue JAXEN-29

+            */

+            assertValueOfXPath("", context, "normalize-space('')");

+        }

+    }

+

+    /* test cases for String extension functions

+    */

+    public void testid55429() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/web.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/web-app/servlet[1]", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertValueOfXPath("SNOOPSERVLET", context, "upper-case( servlet-class )");

+            assertValueOfXPath("snoopservlet", context, "lower-case( servlet-class )");

+            assertValueOfXPath("SNOOPSERVLET", context, "upper-case( servlet-class, 'fr' )");

+            assertValueOfXPath("SNOOPSERVLET", context, "upper-case( servlet-class, 'fr-CA' )");

+            assertValueOfXPath("SNOOPSERVLET", context, "upper-case( servlet-class, 'es-ES-Traditional_WIN' )");

+            assertValueOfXPath("true", context, "ends-with( servlet-class, 'Servlet' )");

+            assertValueOfXPath("false", context, "ends-with( servlet-class, 'S' )");

+        }

+    }

+

+    /* test cases for the lang() function

+    */

+    public void testid55485() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/lang.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(0, context, "/e1/e2[lang('hr')]");

+//            assertCountXPath(1, context, "/e1/e2/e3[lang('en')]");

+//            assertCountXPath(1, context, "/e1/e2/e3[lang('en-US')]");

+            assertCountXPath(0, context, "/e1/e2/e3[lang('en-GB')]");

+            assertCountXPath(2, context, "/e1/e2/e3[lang('hu')]");

+            assertCountXPath(0, context, "/e1/e2/e3[lang('hu-HU')]");

+            assertCountXPath(1, context, "/e1/e2/e3[lang('es')]");

+            assertCountXPath(0, context, "/e1/e2/e3[lang('es-BR')]");

+        }

+    }

+

+    /* test namespace

+    */

+    public void testid55235() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/namespaces.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        SimpleNamespaceContext nsContext = new SimpleNamespaceContext();

+        nsContext.addNamespace("alias", "http://fooNamespace/");

+        nsContext.addNamespace("bar", "http://barNamespace/");

+        nsContext.addNamespace("voo", "http://fooNamespace/");

+        nsContext.addNamespace("foo", "http://fooNamespace/");

+        getContextSupport().setNamespaceContext(nsContext);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(1, context, "/*");

+            assertCountXPath(1, context, "/foo:a");

+            assertCountXPath(1, context, "/foo:a/b");

+            assertCountXPath(1, context, "/voo:a/b/c");

+            assertCountXPath(1, context, "/voo:a/bar:f");

+            assertCountXPath(1, context, "/*[namespace-uri()='http://fooNamespace/' and local-name()='a']");

+            assertCountXPath(1, context, "/*[local-name()='a' and namespace-uri()='http://fooNamespace/']/*[local-name()='x' and namespace-uri()='http://fooNamespace/']");

+            assertCountXPath(1, context, "/*[local-name()='a' and namespace-uri()='http://fooNamespace/']/*[local-name()='x' and namespace-uri()='http://fooNamespace/']/*[local-name()='y' and namespace-uri()='http://fooNamespace/']");

+        }

+    }

+

+    /* the prefix here and in the document have no relation; it's their

+    namespace-uri binding that counts 

+    */

+    public void testid55615() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/namespaces.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        SimpleNamespaceContext nsContext = new SimpleNamespaceContext();

+        nsContext.addNamespace("foo", "http://somethingElse/");

+        getContextSupport().setNamespaceContext(nsContext);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(0, context, "/foo:a/b/c");

+        }

+    }

+

+    public void testid55632() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/namespaces.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        SimpleNamespaceContext nsContext = new SimpleNamespaceContext();

+        nsContext.addNamespace("alias", "http://fooNamespace/");

+        nsContext.addNamespace("bar", "http://barNamespace/");

+        nsContext.addNamespace("foo", "http://fooNamespace/");

+        getContextSupport().setNamespaceContext(nsContext);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertValueOfXPath("Hello", context, "/foo:a/b/c");

+            assertValueOfXPath("Hey", context, "/foo:a/foo:d/foo:e");

+            assertValueOfXPath("Hey3", context, "/foo:a/alias:x/alias:y");

+            assertValueOfXPath("Hey3", context, "/foo:a/foo:x/foo:y");

+            assertValueOfXPath("Hey3", context, "/*[local-name()='a' and namespace-uri()='http://fooNamespace/']/*[local-name()='x' and namespace-uri()='http://fooNamespace/']/*[local-name()='y' and namespace-uri()='http://fooNamespace/']");

+        }

+    }

+

+    public void testid55676() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/defaultNamespace.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            /* NOTE: /a/b/c selects elements in no namespace only!

+            */

+            assertCountXPath(0, context, "/a/b/c");

+            /*

+                The following test uses an unbound prefix 'x' and should throw an exception.

+                Addresses issue JAXEN-18.

+                Turns out this isn't really tested as the test didn't fail when the exception wasn't thrown.

+              <test select="/x:a/x:b/x:c" count="0" exception="true"/>

+

+            */

+        }

+    }

+

+    public void testid55692() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/defaultNamespace.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        SimpleNamespaceContext nsContext = new SimpleNamespaceContext();

+        nsContext.addNamespace("dummy", "http://dummyNamespace/");

+        getContextSupport().setNamespaceContext(nsContext);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(1, context, "/dummy:a/dummy:b/dummy:c");

+        }

+    }

+

+    public void testid55716() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/text.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(3, context, "/foo/bar/text()");

+            assertValueOfXPath("baz", context, "normalize-space(/foo/bar/text())");

+        }

+    }

+

+    public void testid55739() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/testNamespaces.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            /* the root is not an element, so no namespaces

+            */

+            assertCountXPath(0, context, "namespace::*");

+            assertCountXPath(0, context, "/namespace::*");

+            /* must count the default xml: prefix as well

+            */

+            assertCountXPath(3, context, "/Template/Application1/namespace::*");

+            assertCountXPath(3, context, "/Template/Application2/namespace::*");

+            /* every element has separate copies

+            */

+            assertCountXPath(25, context, "//namespace::*");

+        }

+    }

+

+    public void testid55797() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/testNamespaces.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/Template/Application1", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            /* must count the default xml: prefix as well

+            */

+            assertCountXPath(3, context, "namespace::*");

+            assertCountXPath(0, context, "/namespace::*");

+            assertCountXPath(3, context, "/Template/Application1/namespace::*");

+            assertCountXPath(3, context, "/Template/Application2/namespace::*");

+            assertCountXPath(25, context, "//namespace::*");

+            assertCountXPath(8, context, "//namespace::xplt");

+            /* the name test literally matches the prefix as given in the

+              document, and does not use the uri

+            */

+            assertCountXPath(0, context, "//namespace::somethingelse");

+        }

+    }

+

+    public void testid55873() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/testNamespaces.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            /* namespace nodes have their element as their parent

+            */

+            assertCountXPath(1, context, "/Template/namespace::xml/parent::Template");

+        }

+    }

+

+    /* namespace nodes can also be used as context nodes

+    */

+    public void testid55893() throws JaxenException

+    {

+        Navigator nav = getNavigator();

+        String url = TESTS_ROOT + "xml/testNamespaces.xml";

+        log("Document [" + url + "]");

+        Object document = nav.getDocument(url);

+        XPath contextpath = new BaseXPath("/Template/namespace::xml", nav);

+        log("Initial Context :: " + contextpath);

+        List list = contextpath.selectNodes(document);

+        Iterator iter = list.iterator();

+        while (iter.hasNext())

+        {

+            Object context = iter.next();

+            assertCountXPath(1, context, "parent::Template");

+        }

+    }

+}            

+        
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/badsoap/bodyNotQualified.xml b/axiom/modules/axiom-tests/test-resources/badsoap/bodyNotQualified.xml
new file mode 100644
index 0000000..4aa6467
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/badsoap/bodyNotQualified.xml
@@ -0,0 +1,19 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"

+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+    <soapenv:Header>

+        <wsa:MessageID soapenv:mustUnderstand="0">

+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>

+        <wsa:To soapenv:mustUnderstand="0">

+            http://localhost:8081/axis/services/BankPort</wsa:To>

+        <wsa:From soapenv:mustUnderstand="0">

+            <Address xmlns="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+                http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous

+            </Address>

+        </wsa:From>

+    </soapenv:Header>

+    <soapenv:Body>

+        <echoVoid></echoVoid>

+    </soapenv:Body>

+</soapenv:Envelope>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/badsoap/envelopeMissing.xml b/axiom/modules/axiom-tests/test-resources/badsoap/envelopeMissing.xml
new file mode 100644
index 0000000..573b856
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/badsoap/envelopeMissing.xml
@@ -0,0 +1,20 @@
+<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"

+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+    <soapenv:Header>

+        <wsa:MessageID soapenv:mustUnderstand="0">

+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>

+        <wsa:To soapenv:mustUnderstand="0">

+            http://localhost:8081/axis/services/BankPort</wsa:To>

+        <wsa:From soapenv:mustUnderstand="0">

+            <Address xmlns="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+                http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous

+            </Address>

+        </wsa:From>

+    </soapenv:Header>

+    <soapenv:Body>

+        <axis2:echoVoid xmlns:axis2="http://ws.apache.org/axis2">

+        </axis2:echoVoid>

+    </soapenv:Body>

+</soapenv:Body>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/badsoap/haederBodyWrongOrder.xml b/axiom/modules/axiom-tests/test-resources/badsoap/haederBodyWrongOrder.xml
new file mode 100644
index 0000000..207ba51
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/badsoap/haederBodyWrongOrder.xml
@@ -0,0 +1,20 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"

+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+    <soapenv:Body>

+        <axis2:echoVoid xmlns:axis2="http://ws.apache.org/axis2">

+        </axis2:echoVoid>

+    </soapenv:Body>

+    <soapenv:Header>

+        <wsa:MessageID soapenv:mustUnderstand="0">

+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>

+        <wsa:To soapenv:mustUnderstand="0">

+            http://localhost:8081/axis/services/BankPort</wsa:To>

+        <wsa:From soapenv:mustUnderstand="0">

+            <Address xmlns="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+                http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous

+            </Address>

+        </wsa:From>

+    </soapenv:Header>

+</soapenv:Envelope>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/badsoap/notnamespaceQualified.xml b/axiom/modules/axiom-tests/test-resources/badsoap/notnamespaceQualified.xml
new file mode 100644
index 0000000..cb423b0
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/badsoap/notnamespaceQualified.xml
@@ -0,0 +1,15 @@
+<Envelope>

+    <Header>

+        <MessageID mustUnderstand="0">uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5

+        </MessageID>

+        <To mustUnderstand="0">http://localhost:8081/axis/services/BankPort</To>

+        <From mustUnderstand="0">

+            <Address>

+                http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous

+            </Address>

+        </From>

+    </Header>

+    <Body>

+        <echoVoid></echoVoid>

+    </Body>

+</Envelope>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/badsoap/twoBodymessage.xml b/axiom/modules/axiom-tests/test-resources/badsoap/twoBodymessage.xml
new file mode 100644
index 0000000..01095ca
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/badsoap/twoBodymessage.xml
@@ -0,0 +1,24 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"

+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+    <soapenv:Header>

+        <wsa:MessageID soapenv:mustUnderstand="0">

+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>

+        <wsa:To soapenv:mustUnderstand="0">

+            http://localhost:8081/axis/services/BankPort</wsa:To>

+        <wsa:From soapenv:mustUnderstand="0">

+            <Address xmlns="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+                http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous

+            </Address>

+        </wsa:From>

+    </soapenv:Header>

+    <soapenv:Body>

+        <axis2:echoVoid xmlns:axis2="http://ws.apache.org/axis2">

+        </axis2:echoVoid>

+    </soapenv:Body>

+    <soapenv:Body>

+        <axis2:echoVoid xmlns:axis2="http://ws.apache.org/axis2">

+        </axis2:echoVoid>

+    </soapenv:Body>

+</soapenv:Envelope>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/badsoap/twoheaders.xml b/axiom/modules/axiom-tests/test-resources/badsoap/twoheaders.xml
new file mode 100644
index 0000000..620278c
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/badsoap/twoheaders.xml
@@ -0,0 +1,29 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"

+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+    <soapenv:Header>

+        <wsa:MessageID soapenv:mustUnderstand="0">

+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>

+        <wsa:To soapenv:mustUnderstand="0">

+            http://localhost:8081/axis/services/BankPort</wsa:To>

+        <wsa:From soapenv:mustUnderstand="0">

+            <Address xmlns="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+                http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous

+            </Address>

+        </wsa:From>

+    </soapenv:Header>

+    <soapenv:Header>

+        <wsa:MessageID soapenv:mustUnderstand="0">

+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>

+        <wsa:To soapenv:mustUnderstand="0">

+            http://localhost:8081/axis/services/BankPort</wsa:To>

+        <wsa:From soapenv:mustUnderstand="0">

+            <Address xmlns="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+                http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous

+            </Address>

+        </wsa:From>

+    </soapenv:Header>

+    <soapenv:Body>

+    </soapenv:Body>

+</soapenv:Envelope>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/badsoap/wrongSoapNs.xml b/axiom/modules/axiom-tests/test-resources/badsoap/wrongSoapNs.xml
new file mode 100644
index 0000000..a8e7e8a
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/badsoap/wrongSoapNs.xml
@@ -0,0 +1,20 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/badsoap/envelope/"

+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"

+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+    <soapenv:Header>

+        <wsa:MessageID soapenv:mustUnderstand="0">

+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>

+        <wsa:To soapenv:mustUnderstand="0">

+            http://localhost:8081/axis/services/BankPort</wsa:To>

+        <wsa:From soapenv:mustUnderstand="0">

+            <Address xmlns="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+                http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous

+            </Address>

+        </wsa:From>

+    </soapenv:Header>

+    <soapenv:Body>

+        <axis2:echoVoid xmlns:axis2="http://ws.apache.org/axis2">

+        </axis2:echoVoid>

+    </soapenv:Body>

+</soapenv:Envelope>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/mtom/ImageMTOMOut.bin b/axiom/modules/axiom-tests/test-resources/mtom/ImageMTOMOut.bin
new file mode 100644
index 0000000..e023f90
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/mtom/ImageMTOMOut.bin
Binary files differ
diff --git a/axiom/modules/axiom-tests/test-resources/mtom/MTOMAttachmentStream.bin b/axiom/modules/axiom-tests/test-resources/mtom/MTOMAttachmentStream.bin
new file mode 100644
index 0000000..af1fa7a
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/mtom/MTOMAttachmentStream.bin
Binary files differ
diff --git a/axiom/modules/axiom-tests/test-resources/mtom/MTOMBuilderTestIn.txt b/axiom/modules/axiom-tests/test-resources/mtom/MTOMBuilderTestIn.txt
new file mode 100644
index 0000000..2ae8dc7
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/mtom/MTOMBuilderTestIn.txt
@@ -0,0 +1,12 @@
+------=_AxIs2_Def_boundary_=42214532

+Content-Type: application/xop+xml

+Content-Transfer-Encoding: 8bit

+Content-ID: SOAPPart

+

+<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><m:data xmlns:m="http://www.example.org/stuff"><m:name m:contentType="text/plain"><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/Include" href="cid:-1609420109260943731"></xop:Include></m:name></m:data></soapenv:Body></soapenv:Envelope>

+------=_AxIs2_Def_boundary_=42214532

+Content-Transfer-Encoding: binary

+Content-ID: -1609420109260943731

+

+8A ???b

+------=_AxIs2_Def_boundary_=42214532--
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/mtom/img/test.jpg b/axiom/modules/axiom-tests/test-resources/mtom/img/test.jpg
new file mode 100644
index 0000000..5ad295e
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/mtom/img/test.jpg
Binary files differ
diff --git a/axiom/modules/axiom-tests/test-resources/mtom/img/test2.jpg b/axiom/modules/axiom-tests/test-resources/mtom/img/test2.jpg
new file mode 100644
index 0000000..73371d8
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/mtom/img/test2.jpg
Binary files differ
diff --git a/axiom/modules/axiom-tests/test-resources/non_soap.xml b/axiom/modules/axiom-tests/test-resources/non_soap.xml
new file mode 100644
index 0000000..48ca66e
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/non_soap.xml
@@ -0,0 +1,35 @@
+<ns1:Root xmlns:ns1="http://www.apache.org"

+    xmlns:ns2="http://www.opensource.lk">

+    <ns2:developers xmlns:ns3="http://www.whatever.com">

+        <ns3:developer>

+            <name>Davanum Srinivas</name>

+            <id>dims</id>

+            <email>dims@apache.org</email>

+            <organization>Computer Associates</organization>

+        </ns3:developer>

+        <ns3:developer>

+            <name>Glen Daniels</name>

+            <id>glen</id>

+            <email>glen@thoughtcraft.com</email>

+            <organization>Sonic Software</organization>

+        </ns3:developer>

+        <ns3:developer>

+            <name>Sanjiva Weerawarana</name>

+            <id>sanjiva</id>

+            <email>sanjiva@opensource.lk</email>

+            <organization>IBM/LSF</organization>

+        </ns3:developer>

+        <ns3:developer>

+            <name>Eran Chinthaka</name>

+            <id>chinthaka</id>

+            <email>chinthaka@apache.org</email>

+            <organization>LSF/Eurocenter DDC</organization>

+        </ns3:developer>

+        <ns3:developer>

+            <name>Jaliya Ekanayake</name>

+            <id>jaliya</id>

+            <email>jaliya@opensource.lk</email>

+            <organization>Virtusa/LSF</organization>

+        </ns3:developer>

+    </ns2:developers>

+</ns1:Root>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/soap/OMElementTest.xml b/axiom/modules/axiom-tests/test-resources/soap/OMElementTest.xml
new file mode 100644
index 0000000..d5796b6
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/soap/OMElementTest.xml
@@ -0,0 +1,22 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"

+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+    <soapenv:Header>

+        <wsa:MessageID soapenv:mustUnderstand="0">

+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>

+        <wsa:To soapenv:mustUnderstand="0">

+            http://localhost:8081/axis/services/BankPort</wsa:To>

+        <wsa:From soapenv:mustUnderstand="0">

+            <Address xmlns="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+                http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous

+            </Address>

+        </wsa:From>

+    </soapenv:Header>

+    <soapenv:Body>

+        <axis2:echoVoid xmlns:axis2="http://ws.apache.org/axis2">This is some text

+            <axis2:input>2</axis2:input>

+            Some Other Text

+        </axis2:echoVoid>

+    </soapenv:Body>

+</soapenv:Envelope>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/soap/emtyBodymessage.xml b/axiom/modules/axiom-tests/test-resources/soap/emtyBodymessage.xml
new file mode 100644
index 0000000..e634309
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/soap/emtyBodymessage.xml
@@ -0,0 +1,18 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"

+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+    <soapenv:Header>

+        <wsa:MessageID soapenv:mustUnderstand="0">

+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>

+        <wsa:To soapenv:mustUnderstand="0">

+            http://localhost:8081/axis/services/BankPort</wsa:To>

+        <wsa:From soapenv:mustUnderstand="0">

+            <Address xmlns="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+                http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous

+            </Address>

+        </wsa:From>

+    </soapenv:Header>

+    <soapenv:Body>

+    </soapenv:Body>

+</soapenv:Envelope>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/soap/invalidMustUnderstandSOAP12.xml b/axiom/modules/axiom-tests/test-resources/soap/invalidMustUnderstandSOAP12.xml
new file mode 100644
index 0000000..60bd291
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/soap/invalidMustUnderstandSOAP12.xml
@@ -0,0 +1,13 @@
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xml="http://www.w3.org/XML/1998/namespace">

+    <env:Header>

+        <test2:echoOk2 xmlns:test2="http://example2.org/ts-tests"

+            env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"

+            env:mustUnderstand="someOtherValue"

+            env:anyAttribute="any value">

+            foo

+        </test2:echoOk2>

+    </env:Header>

+    <env:Body>

+

+    </env:Body>

+</env:Envelope>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/soap/minimalMessage.xml b/axiom/modules/axiom-tests/test-resources/soap/minimalMessage.xml
new file mode 100644
index 0000000..158312b
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/soap/minimalMessage.xml
@@ -0,0 +1,4 @@
+<?xml version='1.0' ?>

+<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">

+    <env:Body/>

+</env:Envelope>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/soap/reallyReallyBigMessage.xml b/axiom/modules/axiom-tests/test-resources/soap/reallyReallyBigMessage.xml
new file mode 100644
index 0000000..4eac7fa
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/soap/reallyReallyBigMessage.xml
@@ -0,0 +1,2529 @@
+<?xml version='1.0' ?>

+<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"

+    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+    <env:Header>

+

+        <wsdl:definitions targetNamespace="http://echo.services"

+            xmlns="http://schemas.xmlsoap.org/wsdl/"

+            xmlns:impl="http://echo.services-impl"

+            xmlns:intf="http://echo.services"

+            xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"

+            xmlns:tns1="http://types.echo.services"

+            xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

+            xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"

+            xmlns:xsd="http://www.w3.org/2001/XMLSchema">

+            <wsdl:types>

+                <schema targetNamespace="http://types.echo.services"

+                    xmlns="http://www.w3.org/2001/XMLSchema">

+                    <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    <complexType name="MyComplexType">

+                        <sequence>

+                            <element name="simpleItem" nillable="true"

+                                type="xsd:string"/>

+                        </sequence>

+                    </complexType>

+                    <element name="MyElement" nillable="true"

+                        type="tns1:MyComplexType"/>

+                </schema>

+            </wsdl:types>

+            <wsdl:message name="echoRequest">

+                <wsdl:part element="tns1:MyElement" name="MyElement"/>

+            </wsdl:message>

+            <wsdl:message name="echoResponse">

+                <wsdl:part element="tns1:MyElement" name="MyElement"/>

+            </wsdl:message>

+            <wsdl:portType name="Echo1">

+                <wsdl:operation name="echo" parameterOrder="MyElement">

+                    <wsdl:input message="intf:echoRequest" name="echoRequest"/>

+                    <wsdl:output message="intf:echoResponse"

+                        name="echoResponse"/>

+                </wsdl:operation>

+            </wsdl:portType>

+            <wsdl:binding name="ComplexEchoServiceSoapBinding"

+                type="intf:Echo1">

+                <wsdlsoap:binding style="document"

+                    transport="http://schemas.xmlsoap.org/soap/http"/>

+                <wsdl:operation name="echo">

+                    <wsdlsoap:operation soapAction=""/>

+                    <wsdl:input name="echoRequest">

+                        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"

+                            namespace="http://types.echo.services"

+                            use="literal"/>

+                    </wsdl:input>

+                    <wsdl:output name="echoResponse">

+                        <wsdlsoap:body namespace="http://types.echo.services"

+                            use="literal"/>

+                    </wsdl:output>

+                </wsdl:operation>

+            </wsdl:binding>

+            <wsdl:service name="ComplexEchoService">

+                <wsdl:port binding="intf:ComplexEchoServiceSoapBinding"

+                    name="ComplexEchoService">

+                    <wsdlsoap:address

+                        location="http://localhost:8080/axis/services/ComplexEchoService"/>

+                </wsdl:port>

+            </wsdl:service>

+        </wsdl:definitions>

+

+

+    </env:Header>

+    <env:Body>

+        <definitions

+            name="comprehensive types test"

+            targetNamespace="urn:comprehensive-service.types.wsdl.test"

+            xmlns:tns="urn:comprehensive-service.types.wsdl.test"

+            xmlns:typens="urn:comprehensive-types.types.wsdl.test"

+            xmlns:typens2="urn:comprehensive-types2.types.wsdl.test"

+            xmlns:xsd="http://www.w3.org/2001/XMLSchema"

+            xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"

+            xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"

+            xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

+            xmlns="http://schemas.xmlsoap.org/wsdl/">

+

+

+            <types>

+                <xsd:schema

+                    targetNamespace="urn:comprehensive-types.types.wsdl.test"

+                    xmlns:xsd="http://www.w3.org/1999/XMLSchema"

+                    xmlns:xsd2="http://www.w3.org/2001/XMLSchema">

+

+                    <xsd:simpleType name="simple">

+                        <xsd:restriction base="xsd:string"/>

+                    </xsd:simpleType>

+

+                    <xsd:simpleType name="simpleDate">

+                        <xsd:restriction base="xsd:date"/>

+                    </xsd:simpleType>

+

+                    <xsd:simpleType name="simpleDateTime">

+                        <xsd:restriction base="xsd2:dateTime"/>

+                    </xsd:simpleType>

+

+                    <xsd:simpleType name="enum">

+                        <xsd:restriction base="xsd:string">

+                            <xsd:enumeration value="one"/>

+                            <xsd:enumeration value="two"/>

+                            <xsd:enumeration value="three"/>

+                        </xsd:restriction>

+                    </xsd:simpleType>

+

+                    <xsd:complexType name="array">

+                        <xsd:complexContent>

+                            <xsd:restriction base="soapenc:Array">

+                                <xsd:attribute ref="soapenc:arrayType"

+                                    wsdl:arrayType="xsd:string[]"/>

+                            </xsd:restriction>

+                        </xsd:complexContent>

+                    </xsd:complexType>

+

+                    <xsd:complexType name="array_of_base64">

+                        <xsd:complexContent>

+                            <xsd:restriction base="soapenc:Array">

+                                <xsd:attribute ref="soapenc:arrayType"

+                                    wsdl:arrayType="xsd:base64Binary[]"/>

+                            </xsd:restriction>

+                        </xsd:complexContent>

+                    </xsd:complexType>

+

+                    <xsd:complexType name="complexAll">

+                        <xsd:all>

+                            <xsd:element name="areaCode" type="xsd:int"/>

+                            <xsd:element name="exchange" type="xsd:string"/>

+                            <xsd:element name="number" type="xsd:string"/>

+                        </xsd:all>

+                    </xsd:complexType>

+

+                    <xsd:complexType name="complexSequence">

+                        <xsd:sequence>

+                            <xsd:element name="areaCode" type="xsd:int"/>

+                            <xsd:element name="exchange" type="xsd:string"/>

+                            <xsd:element name="number" type="xsd:string"/>

+                        </xsd:sequence>

+                    </xsd:complexType>

+

+                    <xsd:complexType name="complexChoice">

+                        <xsd:choice>

+                            <xsd:element name="choiceA" type="xsd:int"/>

+                            <xsd:element name="choiceB" type="xsd:string"/>

+                            <xsd:element name="choiceC" type="xsd:string"/>

+                        </xsd:choice>

+                    </xsd:complexType>

+

+

+                    <xsd:complexType name="Object">

+                        <xsd:sequence>

+                            <xsd:element name="test" type="xsd:string"/>

+                        </xsd:sequence>

+                    </xsd:complexType>

+                    <xsd:complexType name="String">

+                        <xsd:sequence>

+                            <xsd:element name="test" type="xsd:string"/>

+                        </xsd:sequence>

+                    </xsd:complexType>

+                    <xsd:complexType name="Class">

+                        <xsd:sequence>

+                            <xsd:element name="test" type="xsd:string"/>

+                        </xsd:sequence>

+                    </xsd:complexType>

+

+                    <xsd:element name="enumValue" type="typens:enum"/>

+

+                    <xsd:complexType name="time">

+                        <xsd:simpleContent>

+                            <xsd:extension base="xsd:string">

+                                <xsd:attribute name="DST" type="xsd:boolean"/>

+                            </xsd:extension>

+                        </xsd:simpleContent>

+                    </xsd:complexType>

+

+                    <xsd:complexType name="complexWComplex">

+                        <xsd:sequence>

+                            <xsd:element name="stock_quote">

+                                <xsd:complexType>

+                                    <xsd:attribute name="symbol"

+                                        type="xsd:string"/>

+                                    <xsd:sequence>

+

+                                        <xsd:element name="time"

+                                            type="typens:time"/>

+                                        <xsd:element name="change"

+                                            type="typens:simpleFwd"/>

+                                        <xsd:element name="pctchange"

+                                            type="xsd:string"/>

+                                        <xsd:element name="bid"

+                                            type="xsd:string"/>

+                                        <xsd:element name="ask"

+                                            type="xsd:string"/>

+                                        <xsd:element name="choice"

+                                            type="typens:complexChoice"/>

+                                    </xsd:sequence>

+                                    <xsd:attribute name="last"

+                                        type="xsd:string"/>

+                                </xsd:complexType>

+                            </xsd:element>

+                            <xsd:element name="outside" type="xsd:int"/>

+                        </xsd:sequence>

+                    </xsd:complexType>

+

+                    <xsd:complexType name="emptyFault">

+                        <xsd:sequence/>

+                    </xsd:complexType>

+

+                    <xsd:element name="faultElement" type="typens:faultType"/>

+                    <xsd:complexType name="faultType">

+                        <xsd:sequence>

+                            <xsd:element name="userData" type="xsd:string"/>

+                        </xsd:sequence>

+                    </xsd:complexType>

+

+                    <xsd:complexType name="emptyComplexType">

+                        <xsd:sequence/>

+                    </xsd:complexType>

+

+                    <xsd:simpleType name="simpleFwd">

+                        <xsd:restriction base="typens:simple"/>

+                    </xsd:simpleType>

+

+

+                    <xsd:complexType name="arrayM">

+                        <xsd:complexContent>

+                            <xsd:restriction base="soapenc:Array">

+                                <xsd:attribute ref="soapenc:arrayType"

+                                    wsdl:arrayType="typens:arrayM2[]"/>

+                            </xsd:restriction>

+                        </xsd:complexContent>

+                    </xsd:complexType>

+                    <xsd:complexType name="arrayM2">

+                        <xsd:complexContent>

+                            <xsd:restriction base="soapenc:Array">

+                                <xsd:attribute ref="soapenc:arrayType"

+                                    wsdl:arrayType="typens:arrayM3[]"/>

+                            </xsd:restriction>

+                        </xsd:complexContent>

+                    </xsd:complexType>

+                    <xsd:complexType name="arrayM3">

+                        <xsd:complexContent>

+                            <xsd:restriction base="soapenc:Array">

+                                <xsd:attribute ref="soapenc:arrayType"

+                                    wsdl:arrayType="xsd:int[]"/>

+                            </xsd:restriction>

+                        </xsd:complexContent>

+                    </xsd:complexType>

+

+

+                    <xsd:complexType name="Animal">

+                        <xsd:all>

+                            <xsd:element name="Name" nillable="true"

+                                type="xsd:string"/>

+                        </xsd:all>

+                    </xsd:complexType>

+                    <xsd:element name="Animal" nillable="true"

+                        type="typens:Animal"/>

+                    <xsd:complexType name="Cat">

+                        <xsd:complexContent>

+                            <xsd:extension base="typens:Animal">

+                                <xsd:all>

+                                    <xsd:element name="Purr" nillable="true"

+                                        type="xsd:string"/>

+                                </xsd:all>

+                            </xsd:extension>

+                        </xsd:complexContent>

+                    </xsd:complexType>

+                    <xsd:element name="Cat" nillable="true" type="typens:Cat"/>

+

+                    <xsd:complexType name="PersionCat">

+                        <xsd:complexContent>

+                            <xsd:extension base="typens:Cat">

+                                <xsd:all>

+                                    <xsd:element name="Color"

+                                        type="xsd:string"/>

+                                    <xsd:element name="Toy"/>

+                                </xsd:all>

+                            </xsd:extension>

+                        </xsd:complexContent>

+                    </xsd:complexType>

+

+                    <xsd:complexType name="Yarn">

+                        <xsd:all>

+                            <xsd:element name="Color" type="xsd:string"/>

+                        </xsd:all>

+                    </xsd:complexType>

+

+

+                    <xsd:simpleType name="enumString">

+                        <xsd:restriction base="xsd:string">

+                            <xsd:enumeration value="Ho Ho Ho"/>

+                            <xsd:enumeration value="He He He"/>

+                            <xsd:enumeration value="Ha Ha Ha"/>

+                        </xsd:restriction>

+                    </xsd:simpleType>

+                    <xsd:simpleType name="enumInt">

+                        <xsd:restriction base="xsd:int">

+                            <xsd:enumeration value="1"/>

+                            <xsd:enumeration value="2"/>

+                            <xsd:enumeration value="3"/>

+                        </xsd:restriction>

+                    </xsd:simpleType>

+                    <xsd:simpleType name="enumLong">

+                        <xsd:restriction base="xsd:long">

+                            <xsd:enumeration value="1"/>

+                            <xsd:enumeration value="2"/>

+                            <xsd:enumeration value="3"/>

+                            <xsd:enumeration value="-9223372036854775808"/>

+                            <xsd:enumeration value="9223372036854775807"/>

+                        </xsd:restriction>

+                    </xsd:simpleType>

+                    <xsd:simpleType name="enumShort">

+                        <xsd:restriction base="xsd:short">

+                            <xsd:enumeration value="1"/>

+                            <xsd:enumeration value="2"/>

+                            <xsd:enumeration value="3"/>

+                        </xsd:restriction>

+                    </xsd:simpleType>

+                    <xsd:simpleType name="enumFloat">

+                        <xsd:restriction base="xsd:float">

+                            <xsd:enumeration value="1.1"/>

+                            <xsd:enumeration value="2.2"/>

+                            <xsd:enumeration value="3.3"/>

+                        </xsd:restriction>

+                    </xsd:simpleType>

+                    <xsd:simpleType name="enumDouble">

+                        <xsd:restriction base="xsd:double">

+                            <xsd:enumeration value="1.1"/>

+                            <xsd:enumeration value="2.2"/>

+                            <xsd:enumeration value="3.3"/>

+                        </xsd:restriction>

+                    </xsd:simpleType>

+                    <xsd:simpleType name="enumByte">

+                        <xsd:restriction base="xsd:byte">

+                            <xsd:enumeration value="1"/>

+                            <xsd:enumeration value="2"/>

+                            <xsd:enumeration value="3"/>

+                        </xsd:restriction>

+                    </xsd:simpleType>

+

+                    <xsd:simpleType name="enumInteger">

+                        <xsd:restriction base="xsd:integer">

+                            <xsd:enumeration value="1"/>

+                            <xsd:enumeration value="2"/>

+                            <xsd:enumeration value="3"/>

+                        </xsd:restriction>

+                    </xsd:simpleType>

+

+                    <xsd:simpleType name="flowDirectionType">

+                        <xsd:restriction base="xsd:string">

+                            <xsd:enumeration value="in"/>

+                            <xsd:enumeration value="inOut"/>

+                            <xsd:enumeration value="out"/>

+                        </xsd:restriction>

+                    </xsd:simpleType>

+

+                    <xsd:simpleType name="enumNMTOKEN">

+                        <xsd:restriction base="xsd:NMTOKEN">

+                            <xsd:enumeration value="NameToken1"/>

+                            <xsd:enumeration value="NameToken2"/>

+                            <xsd:enumeration value="NameToken3"/>

+                        </xsd:restriction>

+                    </xsd:simpleType>

+

+                    <xsd:simpleType name="AIDType">

+                        <xsd:restriction base="xsd:hexBinary">

+                            <xsd:maxLength value="16"/>

+                            <xsd:minLength value="5"/>

+                        </xsd:restriction>

+                    </xsd:simpleType>

+

+                    <xsd:simpleType name="passModeType">

+                        <xsd:restriction base="xsd:string">

+                            <xsd:enumeration value="passByValue"/>

+                            <xsd:enumeration value="passByReference"/>

+                        </xsd:restriction>

+                    </xsd:simpleType>

+

+

+                    <xsd:element name="StringParameter"

+                        type="typens:StringParameter"/>

+                    <xsd:complexType name="StringParameter">

+                        <xsd:simpleContent>

+                            <xsd:extension base="xsd:string">

+                                <xsd:attribute name="numBytes"

+                                    type="soapenc:int"/>

+                                <xsd:attribute name="storageEncoding"

+                                    type="xsd:string"/>

+                                <xsd:attribute name="direction"

+                                    type="typens:flowDirectionType"/>

+                                <xsd:attribute name="passMode"

+                                    type="typens:passModeType"/>

+                                <xsd:attribute name="description"

+                                    type="xsd:string"/>

+                            </xsd:extension>

+                        </xsd:simpleContent>

+                    </xsd:complexType>

+

+                </xsd:schema>

+

+

+                <xsd:schema

+                    targetNamespace="urn:comprehensive-types2.types.wsdl.test"

+                    xmlns:xsd="http://www.w3.org/1999/XMLSchema">

+                    <xsd:complexType name="fwd">

+                        <xsd:complexContent>

+                            <xsd:restriction base="soapenc:Array">

+                                <xsd:attribute ref="soapenc:arrayType"

+                                    wsdl:arrayType="xsd:QName[]"/>

+                            </xsd:restriction>

+                        </xsd:complexContent>

+                    </xsd:complexType>

+

+

+                    <xsd:element name="three" type="typens:enum"

+                        maxOccurs="unbounded"/>

+

+

+                    <xsd:element name="a" type="xsd:short"/>

+                    <xsd:complexType name="a">

+                        <xsd:sequence>

+                            <xsd:element name="c" type="xsd:int"/>

+                        </xsd:sequence>

+                    </xsd:complexType>

+                    <xsd:complexType name="b">

+                        <xsd:sequence>

+                            <xsd:element name="d" type="typens2:a"/>

+                        </xsd:sequence>

+                    </xsd:complexType>

+

+

+                    <xsd:complexType name="SimpleAnyURIType">

+                        <xsd:simpleContent>

+                            <xsd:extension base="xsd:anyURI">

+                            </xsd:extension>

+                        </xsd:simpleContent>

+                    </xsd:complexType>

+

+                </xsd:schema>

+

+            </types>

+

+            <message name="empty"/>

+

+            <message name="allPrimitives">

+                <part name="string" type="xsd:string"/>

+                <part name="integer" type="xsd:integer"/>

+                <part name="int" type="xsd:int"/>

+                <part name="long" type="xsd:long"/>

+                <part name="short" type="xsd:short"/>

+                <part name="decimal" type="xsd:decimal"/>

+                <part name="float" type="xsd:float"/>

+                <part name="double" type="xsd:double"/>

+                <part name="boolean" type="xsd:boolean"/>

+                <part name="byte" type="xsd:byte"/>

+                <part name="QName" type="xsd:QName"/>

+                <part name="dateTime" type="xsd:dateTime"/>

+                <part name="base64Binary" type="xsd:base64Binary"/>

+                <part name="hexBinary" type="xsd:hexBinary"/>

+                <part name="soapString" type="soapenc:string"/>

+                <part name="soapBoolean" type="soapenc:boolean"/>

+                <part name="soapFloat" type="soapenc:float"/>

+                <part name="soapDouble" type="soapenc:double"/>

+                <part name="soapDecimal" type="soapenc:decimal"/>

+                <part name="soapInt" type="soapenc:int"/>

+                <part name="soapShort" type="soapenc:short"/>

+                <part name="soapBase64" type="soapenc:base64"/>

+                <part name="time" type="xsd:time"/>

+                <part name="unsignedLong" type="xsd:unsignedLong"/>

+                <part name="unsignedInt" type="xsd:unsignedInt"/>

+                <part name="unsignedShort" type="xsd:unsignedShort"/>

+                <part name="unsignedByte" type="xsd:unsignedByte"/>

+                <part name="nonNegativeInteger" type="xsd:nonNegativeInteger"/>

+                <part name="positiveInteger" type="xsd:positiveInteger"/>

+                <part name="nonPositiveInteger" type="xsd:nonPositiveInteger"/>

+                <part name="negativeInteger" type="xsd:negativeInteger"/>

+                <part name="anyURI" type="xsd:anyURI"/>

+                <part name="gYear" type="xsd:gYear"/>

+                <part name="gMonth" type="xsd:gMonth"/>

+                <part name="gDay" type="xsd:gDay"/>

+                <part name="gYearMonth" type="xsd:gYearMonth"/>

+                <part name="gMonthDay" type="xsd:gMonthDay"/>

+            </message>

+            <message name="inputBoolean">

+                <part name="inBoolean" type="xsd:boolean"/>

+                <part name="boolean" type="xsd:boolean"/>

+            </message>

+

+            <message name="outputBoolean">

+                <part name="outBoolean" type="xsd:boolean"/>

+                <part name="boolean" type="xsd:boolean"/>

+            </message>

+

+            <message name="inputByte">

+                <part name="inByte" type="xsd:byte"/>

+                <part name="byte" type="xsd:byte"/>

+            </message>

+

+            <message name="outputByte">

+                <part name="outByte" type="xsd:byte"/>

+                <part name="byte" type="xsd:byte"/>

+            </message>

+

+            <message name="inputShort">

+                <part name="inShort" type="xsd:short"/>

+                <part name="short" type="xsd:short"/>

+            </message>

+

+            <message name="outputShort">

+                <part name="outShort" type="xsd:short"/>

+                <part name="short" type="xsd:short"/>

+            </message>

+

+            <message name="inputInt">

+                <part name="inInt" type="xsd:int"/>

+                <part name="int" type="xsd:int"/>

+            </message>

+

+            <message name="outputInt">

+                <part name="outInt" type="xsd:int"/>

+                <part name="int" type="xsd:int"/>

+            </message>

+

+            <message name="inputLong">

+                <part name="inLong" type="xsd:long"/>

+                <part name="long" type="xsd:long"/>

+            </message>

+

+            <message name="outputLong">

+                <part name="outLong" type="xsd:long"/>

+                <part name="long" type="xsd:long"/>

+            </message>

+

+            <message name="inputFloat">

+                <part name="inFloat" type="xsd:float"/>

+                <part name="float" type="xsd:float"/>

+            </message>

+

+            <message name="outputFloat">

+                <part name="outFloat" type="xsd:float"/>

+                <part name="float" type="xsd:float"/>

+            </message>

+

+            <message name="inputDouble">

+                <part name="inDouble" type="xsd:double"/>

+                <part name="double" type="xsd:double"/>

+            </message>

+

+            <message name="outputDouble">

+                <part name="outDouble" type="xsd:double"/>

+                <part name="double" type="xsd:double"/>

+            </message>

+

+            <message name="inputString">

+                <part name="inString" type="xsd:string"/>

+                <part name="string" type="xsd:string"/>

+            </message>

+

+            <message name="outputString">

+                <part name="outString" type="xsd:string"/>

+                <part name="string" type="xsd:string"/>

+            </message>

+

+            <message name="inputInteger">

+                <part name="inInteger" type="xsd:integer"/>

+                <part name="integer" type="xsd:integer"/>

+            </message>

+

+            <message name="outputInteger">

+                <part name="outInteger" type="xsd:integer"/>

+                <part name="integer" type="xsd:integer"/>

+            </message>

+

+            <message name="inputDecimal">

+                <part name="inDecimal" type="xsd:decimal"/>

+                <part name="decimal" type="xsd:decimal"/>

+            </message>

+

+            <message name="outputDecimal">

+                <part name="outDecimal" type="xsd:decimal"/>

+                <part name="decimal" type="xsd:decimal"/>

+            </message>

+

+            <message name="inputDateTime">

+                <part name="inDateTime" type="xsd:dateTime"/>

+                <part name="dateTime" type="xsd:dateTime"/>

+            </message>

+

+            <message name="outputDateTime">

+                <part name="outDateTime" type="xsd:dateTime"/>

+                <part name="dateTime" type="xsd:dateTime"/>

+            </message>

+

+            <message name="inputBase64Binary">

+                <part name="inBase64Binary" type="xsd:base64Binary"/>

+                <part name="base64Binary" type="xsd:base64Binary"/>

+            </message>

+

+            <message name="outputBase64Binary">

+                <part name="outBase64Binary" type="xsd:base64Binary"/>

+                <part name="base64Binary" type="xsd:base64Binary"/>

+            </message>

+

+            <message name="inputQName">

+                <part name="inQName" type="xsd:QName"/>

+                <part name="qName" type="xsd:QName"/>

+            </message>

+

+            <message name="outputQName">

+                <part name="outQName" type="xsd:QName"/>

+                <part name="qName" type="xsd:QName"/>

+            </message>

+

+            <message name="inputHexBinary">

+                <part name="inHexBinary" type="xsd:hexBinary"/>

+                <part name="hexBinary" type="xsd:hexBinary"/>

+            </message>

+

+            <message name="outputHexBinary">

+                <part name="outHexBinary" type="xsd:hexBinary"/>

+                <part name="hexBinary" type="xsd:hexBinary"/>

+            </message>

+

+            <message name="inputTime">

+                <part name="inTime" type="xsd:time"/>

+                <part name="time" type="xsd:time"/>

+            </message>

+

+            <message name="outputTime">

+                <part name="outTime" type="xsd:time"/>

+                <part name="time" type="xsd:time"/>

+            </message>

+

+            <message name="inputUnsignedLong">

+                <part name="inUnsignedLong" type="xsd:unsignedLong"/>

+                <part name="unsignedLong" type="xsd:unsignedLong"/>

+            </message>

+

+            <message name="outputUnsignedLong">

+                <part name="outUnsignedLong" type="xsd:unsignedLong"/>

+                <part name="unsignedLong" type="xsd:unsignedLong"/>

+            </message>

+

+            <message name="inputUnsignedInt">

+                <part name="inUnsignedInt" type="xsd:unsignedInt"/>

+                <part name="unsignedInt" type="xsd:unsignedInt"/>

+            </message>

+

+            <message name="outputUnsignedInt">

+                <part name="outUnsignedInt" type="xsd:unsignedInt"/>

+                <part name="unsignedInt" type="xsd:unsignedInt"/>

+            </message>

+

+            <message name="inputUnsignedShort">

+                <part name="inUnsignedShort" type="xsd:unsignedShort"/>

+                <part name="unsignedShort" type="xsd:unsignedShort"/>

+            </message>

+

+            <message name="outputUnsignedShort">

+                <part name="outUnsignedShort" type="xsd:unsignedShort"/>

+                <part name="unsignedShort" type="xsd:unsignedShort"/>

+            </message>

+

+            <message name="inputUnsignedByte">

+                <part name="inUnsignedByte" type="xsd:unsignedByte"/>

+                <part name="unsignedByte" type="xsd:unsignedByte"/>

+            </message>

+

+            <message name="outputUnsignedByte">

+                <part name="outUnsignedByte" type="xsd:unsignedByte"/>

+                <part name="unsignedByte" type="xsd:unsignedByte"/>

+            </message>

+

+            <message name="inputNonNegativeInteger">

+                <part name="inNonNegativeInteger"

+                    type="xsd:nonNegativeInteger"/>

+                <part name="NonNegativeInteger" type="xsd:nonNegativeInteger"/>

+            </message>

+

+            <message name="outputNonNegativeInteger">

+                <part name="outNonNegativeInteger"

+                    type="xsd:nonNegativeInteger"/>

+                <part name="NonNegativeInteger" type="xsd:nonNegativeInteger"/>

+            </message>

+

+            <message name="inputPositiveInteger">

+                <part name="inPositiveInteger" type="xsd:positiveInteger"/>

+                <part name="PositiveInteger" type="xsd:positiveInteger"/>

+            </message>

+

+            <message name="outputPositiveInteger">

+                <part name="outPositiveInteger" type="xsd:positiveInteger"/>

+                <part name="PositiveInteger" type="xsd:positiveInteger"/>

+            </message>

+

+            <message name="inputNonPositiveInteger">

+                <part name="inNonPositiveInteger"

+                    type="xsd:nonPositiveInteger"/>

+                <part name="NonPositiveInteger" type="xsd:nonPositiveInteger"/>

+            </message>

+

+            <message name="outputNonPositiveInteger">

+                <part name="outNonPositiveInteger"

+                    type="xsd:nonPositiveInteger"/>

+                <part name="NonPositiveInteger" type="xsd:nonPositiveInteger"/>

+            </message>

+

+            <message name="inputNegativeInteger">

+                <part name="inNegativeInteger" type="xsd:negativeInteger"/>

+                <part name="NegativeInteger" type="xsd:negativeInteger"/>

+            </message>

+

+            <message name="outputNegativeInteger">

+                <part name="outNegativeInteger" type="xsd:negativeInteger"/>

+                <part name="NegativeInteger" type="xsd:negativeInteger"/>

+            </message>

+

+            <message name="inputAnyURI">

+                <part name="inAnyURI" type="xsd:anyURI"/>

+                <part name="anyURI" type="xsd:anyURI"/>

+            </message>

+

+            <message name="outputAnyURI">

+                <part name="outAnyURI" type="xsd:anyURI"/>

+                <part name="anyURI" type="xsd:anyURI"/>

+            </message>

+

+            <message name="inputSimpleAnyURI">

+                <part name="inAnyURI" type="typens2:SimpleAnyURIType"/>

+                <part name="anyURI" type="typens2:SimpleAnyURIType"/>

+            </message>

+

+            <message name="outputSimpleAnyURI">

+                <part name="outAnyURI" type="typens2:SimpleAnyURIType"/>

+                <part name="anyURI" type="typens2:SimpleAnyURIType"/>

+            </message>

+

+            <message name="inputYear">

+                <part name="inYear" type="xsd:gYear"/>

+                <part name="Year" type="xsd:gYear"/>

+            </message>

+

+            <message name="outputYear">

+                <part name="outYear" type="xsd:gYear"/>

+                <part name="Year" type="xsd:gYear"/>

+            </message>

+

+            <message name="inputMonth">

+                <part name="inMonth" type="xsd:gMonth"/>

+                <part name="Month" type="xsd:gMonth"/>

+            </message>

+

+            <message name="outputMonth">

+                <part name="outMonth" type="xsd:gMonth"/>

+                <part name="Month" type="xsd:gMonth"/>

+            </message>

+

+            <message name="inputDay">

+                <part name="inDay" type="xsd:gDay"/>

+                <part name="Day" type="xsd:gDay"/>

+            </message>

+

+            <message name="outputDay">

+                <part name="outDay" type="xsd:gDay"/>

+                <part name="Day" type="xsd:gDay"/>

+            </message>

+

+            <message name="inputYearMonth">

+                <part name="inYearMonth" type="xsd:gYearMonth"/>

+                <part name="YearMonth" type="xsd:gYearMonth"/>

+            </message>

+

+            <message name="outputYearMonth">

+                <part name="outYearMonth" type="xsd:gYearMonth"/>

+                <part name="YearMonth" type="xsd:gYearMonth"/>

+            </message>

+

+            <message name="inputMonthDay">

+                <part name="inMonthDay" type="xsd:gMonthDay"/>

+                <part name="MonthDay" type="xsd:gMonthDay"/>

+            </message>

+

+            <message name="outputMonthDay">

+                <part name="outMonthDay" type="xsd:gMonthDay"/>

+                <part name="MonthDay" type="xsd:gMonthDay"/>

+            </message>

+

+            <message name="inputSoapString">

+                <part name="inSoapString" type="soapenc:string"/>

+                <part name="soapencString" type="soapenc:string"/>

+            </message>

+

+            <message name="outputSoapString">

+                <part name="outSoapString" type="soapenc:string"/>

+                <part name="soapencString" type="soapenc:string"/>

+            </message>

+

+            <message name="inputSoapBoolean">

+                <part name="inSoapBoolean" type="soapenc:boolean"/>

+                <part name="soapencBoolean" type="soapenc:boolean"/>

+            </message>

+

+            <message name="outputSoapBoolean">

+                <part name="outSoapBoolean" type="soapenc:boolean"/>

+                <part name="soapencBoolean" type="soapenc:boolean"/>

+            </message>

+

+            <message name="inputSoapFloat">

+                <part name="inSoapFloat" type="soapenc:float"/>

+                <part name="soapencFloat" type="soapenc:float"/>

+            </message>

+

+            <message name="outputSoapFloat">

+                <part name="outSoapFloat" type="soapenc:float"/>

+                <part name="soapencFloat" type="soapenc:float"/>

+            </message>

+

+            <message name="inputSoapDouble">

+                <part name="inSoapDouble" type="soapenc:double"/>

+                <part name="soapencDouble" type="soapenc:double"/>

+            </message>

+

+            <message name="outputSoapDouble">

+                <part name="outSoapDouble" type="soapenc:double"/>

+                <part name="soapencDouble" type="soapenc:double"/>

+            </message>

+

+            <message name="inputSoapDecimal">

+                <part name="inSoapDecimal" type="soapenc:decimal"/>

+                <part name="soapencDecimal" type="soapenc:decimal"/>

+            </message>

+

+            <message name="outputSoapDecimal">

+                <part name="outSoapDecimal" type="soapenc:decimal"/>

+                <part name="soapencDecimal" type="soapenc:decimal"/>

+            </message>

+

+            <message name="inputSoapInt">

+                <part name="inSoapInt" type="soapenc:int"/>

+                <part name="soapencInt" type="soapenc:int"/>

+            </message>

+

+            <message name="outputSoapInt">

+                <part name="outSoapInt" type="soapenc:int"/>

+                <part name="soapencInt" type="soapenc:int"/>

+            </message>

+

+            <message name="inputSoapShort">

+                <part name="inSoapShort" type="soapenc:short"/>

+                <part name="soapencShort" type="soapenc:short"/>

+            </message>

+

+            <message name="outputSoapShort">

+                <part name="outSoapShort" type="soapenc:short"/>

+                <part name="soapencShort" type="soapenc:short"/>

+            </message>

+

+            <message name="inputSoapBase64">

+                <part name="inSoapBase64" type="soapenc:base64"/>

+                <part name="soapencBase64" type="soapenc:base64"/>

+            </message>

+

+            <message name="outputSoapBase64">

+                <part name="outSoapBase64" type="soapenc:base64"/>

+                <part name="soapencBase64" type="soapenc:base64"/>

+            </message>

+

+            <message name="enum">

+                <part name="enum" type="typens:enum"/>

+            </message>

+

+            <message name="enumInt">

+                <part name="enumInt" type="typens:enumInt"/>

+            </message>

+

+            <message name="array">

+                <part name="array" type="typens:array"/>

+            </message>

+

+            <message name="arrayM">

+                <part name="arrayM" type="typens:arrayM"/>

+            </message>

+

+            <message name="complexAll">

+                <part name="complexAll" type="typens:complexAll"/>

+            </message>

+

+            <message name="complexSequence">

+                <part name="complexSequence" type="typens:complexSequence"/>

+            </message>

+

+            <message name="complexWComplex">

+                <part name="complexWComplex" type="typens:complexWComplex"/>

+            </message>

+

+            <message name="any">

+                <part name="any" type="xsd:anyType"/>

+            </message>

+

+            <message name="animal">

+                <part name="animal" type="typens:Animal"/>

+            </message>

+

+            <message name="cat">

+                <part name="cat" type="typens:Cat"/>

+            </message>

+

+            <message name="emptyFault">

+                <part name="theFault" type="typens:emptyFault"/>

+            </message>

+

+            <message name="faultWithElement">

+                <part name="fault2" element="typens:faultElement"/>

+            </message>

+

+            <message name="emptyComplexType">

+                <part name="emptyComplexType" type="typens:emptyComplexType"/>

+            </message>

+

+

+            <portType name="TypeTest">

+                <operation name="allPrimitivesIn">

+                    <input message="tns:allPrimitives"/>

+                    <output message="tns:empty"/>

+                </operation>

+                <operation name="allPrimitivesInout">

+                    <input message="tns:allPrimitives"/>

+                    <output message="tns:allPrimitives"/>

+                </operation>

+                <operation name="allPrimitivesOut">

+                    <input message="tns:empty"/>

+                    <output message="tns:allPrimitives"/>

+                </operation>

+                <operation name="enumIn">

+                    <input message="tns:enum"/>

+                    <output message="tns:empty"/>

+                </operation>

+                <operation name="enumInout">

+                    <input message="tns:enum"/>

+                    <output message="tns:enum"/>

+                </operation>

+                <operation name="enumOut" parameterOrder="enum">

+                    <input message="tns:empty"/>

+                    <output message="tns:enum"/>

+                </operation>

+                <operation name="enumReturn">

+                    <input message="tns:empty"/>

+                    <output message="tns:enum"/>

+                </operation>

+                <operation name="enumIntIn">

+                    <input message="tns:enumInt"/>

+                    <output message="tns:empty"/>

+                </operation>

+                <operation name="enumIntInout">

+                    <input message="tns:enumInt"/>

+                    <output message="tns:enumInt"/>

+                </operation>

+                <operation name="enumIntOut" parameterOrder="enumInt">

+                    <input message="tns:empty"/>

+                    <output message="tns:enumInt"/>

+                </operation>

+                <operation name="enumIntReturn">

+                    <input message="tns:empty"/>

+                    <output message="tns:enumInt"/>

+                </operation>

+                <operation name="arrayIn">

+                    <input message="tns:array"/>

+                    <output message="tns:empty"/>

+                </operation>

+                <operation name="arrayInout">

+                    <input message="tns:array"/>

+                    <output message="tns:array"/>

+                </operation>

+                <operation name="arrayOut" parameterOrder="array">

+                    <input message="tns:empty"/>

+                    <output message="tns:array"/>

+                </operation>

+                <operation name="arrayReturn">

+                    <input message="tns:empty"/>

+                    <output message="tns:array"/>

+                </operation>

+

+                <operation name="arrayMIn">

+                    <input message="tns:arrayM"/>

+                    <output message="tns:empty"/>

+                </operation>

+                <operation name="arrayMInout">

+                    <input message="tns:arrayM"/>

+                    <output message="tns:arrayM"/>

+                </operation>

+                <operation name="arrayMOut" parameterOrder="arrayM">

+                    <input message="tns:empty"/>

+                    <output message="tns:arrayM"/>

+                </operation>

+                <operation name="arrayMReturn">

+                    <input message="tns:empty"/>

+                    <output message="tns:arrayM"/>

+                </operation>

+

+                <operation name="complexAllIn">

+                    <input message="tns:complexAll"/>

+                    <output message="tns:empty"/>

+                </operation>

+                <operation name="complexAllInout">

+                    <input message="tns:complexAll"/>

+                    <output message="tns:complexAll"/>

+                </operation>

+                <operation name="complexAllOut" parameterOrder="complexAll">

+                    <input message="tns:empty"/>

+                    <output message="tns:complexAll"/>

+                </operation>

+                <operation name="complexAllReturn">

+                    <input message="tns:empty"/>

+                    <output message="tns:complexAll"/>

+                </operation>

+                <operation name="complexSequenceIn">

+                    <input message="tns:complexSequence"/>

+                    <output message="tns:empty"/>

+                </operation>

+                <operation name="complexSequenceInout">

+                    <input message="tns:complexSequence"/>

+                    <output message="tns:complexSequence"/>

+                </operation>

+                <operation name="complexSequenceOut"

+                    parameterOrder="complexSequence">

+                    <input message="tns:empty"/>

+                    <output message="tns:complexSequence"/>

+                </operation>

+                <operation name="complexSequenceReturn">

+                    <input message="tns:empty"/>

+                    <output message="tns:complexSequence"/>

+                </operation>

+                <operation name="complexWComplexIn">

+                    <input message="tns:complexWComplex"/>

+                    <output message="tns:empty"/>

+                </operation>

+                <operation name="complexWComplexInout">

+                    <input message="tns:complexWComplex"/>

+                    <output message="tns:complexWComplex"/>

+                </operation>

+                <operation name="complexWComplexOut"

+                    parameterOrder="complexWComplex">

+                    <input message="tns:empty"/>

+                    <output message="tns:complexWComplex"/>

+                </operation>

+                <operation name="complexWComplexReturn">

+                    <input message="tns:empty"/>

+                    <output message="tns:complexWComplex"/>

+                </operation>

+                <operation name="emptyComplexTypeIn"

+                    parameterOrder="emptyComplexType">

+                    <input message="tns:emptyComplexType"/>

+                    <output message="tns:empty"/>

+                    <fault name="emptyFault" message="tns:emptyFault"/>

+                </operation>

+                <operation name="emptyComplexTypeInout"

+                    parameterOrder="emptyComplexType">

+                    <input message="tns:emptyComplexType"/>

+                    <output message="tns:emptyComplexType"/>

+                    <fault name="emptyFault" message="tns:emptyFault"/>

+                </operation>

+                <operation name="emptyComplexTypeOut"

+                    parameterOrder="emptyComplexType">

+                    <input message="tns:empty"/>

+                    <output message="tns:emptyComplexType"/>

+                    <fault name="emptyFault" message="tns:emptyFault"/>

+                </operation>

+                <operation name="emptyComplexTypeReturn">

+                    <input message="tns:empty"/>

+                    <output message="tns:emptyComplexType"/>

+                    <fault name="emptyFault" message="tns:emptyFault"/>

+                </operation>

+                <operation name="anyIn">

+                    <input message="tns:any"/>

+                    <output message="tns:empty"/>

+                </operation>

+                <operation name="anyInout">

+                    <input message="tns:any"/>

+                    <output message="tns:any"/>

+                </operation>

+                <operation name="anyOut" parameterOrder="any">

+                    <input message="tns:empty"/>

+                    <output message="tns:any"/>

+                </operation>

+                <operation name="anyReturn">

+                    <input message="tns:empty"/>

+                    <output message="tns:any"/>

+                </operation>

+                <operation name="animalIn">

+                    <input message="tns:animal"/>

+                    <output message="tns:empty"/>

+                </operation>

+                <operation name="animalInout">

+                    <input message="tns:animal"/>

+                    <output message="tns:animal"/>

+                </operation>

+                <operation name="animalOut" parameterOrder="animal">

+                    <input message="tns:empty"/>

+                    <output message="tns:animal"/>

+                </operation>

+                <operation name="animalReturn">

+                    <input message="tns:empty"/>

+                    <output message="tns:animal"/>

+                </operation>

+                <operation name="catIn">

+                    <input message="tns:cat"/>

+                    <output message="tns:empty"/>

+                </operation>

+                <operation name="catInout">

+                    <input message="tns:cat"/>

+                    <output message="tns:cat"/>

+                </operation>

+                <operation name="catOut" parameterOrder="cat">

+                    <input message="tns:empty"/>

+                    <output message="tns:cat"/>

+                </operation>

+                <operation name="catReturn">

+                    <input message="tns:empty"/>

+                    <output message="tns:cat"/>

+                </operation>

+                <operation name="methodBoolean">

+                    <input message="tns:inputBoolean"/>

+                    <output message="tns:outputBoolean"/>

+                </operation>

+                <operation name="methodByte">

+                    <input message="tns:inputByte"/>

+                    <output message="tns:outputByte"/>

+                </operation>

+                <operation name="methodShort">

+                    <input message="tns:inputShort"/>

+                    <output message="tns:outputShort"/>

+                </operation>

+                <operation name="methodInt">

+                    <input message="tns:inputInt"/>

+                    <output message="tns:outputInt"/>

+                </operation>

+                <operation name="methodLong">

+                    <input message="tns:inputLong"/>

+                    <output message="tns:outputLong"/>

+                </operation>

+                <operation name="methodFloat">

+                    <input message="tns:inputFloat"/>

+                    <output message="tns:outputFloat"/>

+                </operation>

+                <operation name="methodDouble">

+                    <input message="tns:inputDouble"/>

+                    <output message="tns:outputDouble"/>

+                </operation>

+                <operation name="methodString">

+                    <input message="tns:inputString"/>

+                    <output message="tns:outputString"/>

+                </operation>

+                <operation name="methodInteger">

+                    <input message="tns:inputInteger"/>

+                    <output message="tns:outputInteger"/>

+                </operation>

+                <operation name="methodDecimal">

+                    <input message="tns:inputDecimal"/>

+                    <output message="tns:outputDecimal"/>

+                </operation>

+                <operation name="methodDateTime">

+                    <input message="tns:inputDateTime"/>

+                    <output message="tns:outputDateTime"/>

+                </operation>

+                <operation name="methodQName">

+                    <input message="tns:inputQName"/>

+                    <output message="tns:outputQName"/>

+                </operation>

+                <operation name="methodTime">

+                    <input message="tns:inputTime"/>

+                    <output message="tns:outputTime"/>

+                </operation>

+                <operation name="methodUnsignedLong">

+                    <input message="tns:inputUnsignedLong"/>

+                    <output message="tns:outputUnsignedLong"/>

+                </operation>

+                <operation name="methodUnsignedInt">

+                    <input message="tns:inputUnsignedInt"/>

+                    <output message="tns:outputUnsignedInt"/>

+                </operation>

+                <operation name="methodUnsignedShort">

+                    <input message="tns:inputUnsignedShort"/>

+                    <output message="tns:outputUnsignedShort"/>

+                </operation>

+                <operation name="methodUnsignedByte">

+                    <input message="tns:inputUnsignedByte"/>

+                    <output message="tns:outputUnsignedByte"/>

+                </operation>

+                <operation name="methodNonNegativeInteger">

+                    <input message="tns:inputNonNegativeInteger"/>

+                    <output message="tns:outputNonNegativeInteger"/>

+                </operation>

+                <operation name="methodPositiveInteger">

+                    <input message="tns:inputPositiveInteger"/>

+                    <output message="tns:outputPositiveInteger"/>

+                </operation>

+                <operation name="methodNonPositiveInteger">

+                    <input message="tns:inputNonPositiveInteger"/>

+                    <output message="tns:outputNonPositiveInteger"/>

+                </operation>

+                <operation name="methodNegativeInteger">

+                    <input message="tns:inputNegativeInteger"/>

+                    <output message="tns:outputNegativeInteger"/>

+                </operation>

+                <operation name="methodAnyURI">

+                    <input message="tns:inputAnyURI"/>

+                    <output message="tns:outputAnyURI"/>

+                </operation>

+                <operation name="methodSimpleAnyURI">

+                    <input message="tns:inputSimpleAnyURI"/>

+                    <output message="tns:outputSimpleAnyURI"/>

+                </operation>

+                <operation name="methodYear">

+                    <input message="tns:inputYear"/>

+                    <output message="tns:outputYear"/>

+                </operation>

+                <operation name="methodMonth">

+                    <input message="tns:inputMonth"/>

+                    <output message="tns:outputMonth"/>

+                </operation>

+                <operation name="methodDay">

+                    <input message="tns:inputDay"/>

+                    <output message="tns:outputDay"/>

+                </operation>

+                <operation name="methodYearMonth">

+                    <input message="tns:inputYearMonth"/>

+                    <output message="tns:outputYearMonth"/>

+                </operation>

+                <operation name="methodMonthDay">

+                    <input message="tns:inputMonthDay"/>

+                    <output message="tns:outputMonthDay"/>

+                </operation>

+                <operation name="methodSoapString">

+                    <input message="tns:inputSoapString"/>

+                    <output message="tns:outputSoapString"/>

+                </operation>

+                <operation name="methodSoapBoolean">

+                    <input message="tns:inputSoapBoolean"/>

+                    <output message="tns:outputSoapBoolean"/>

+                </operation>

+                <operation name="methodSoapFloat">

+                    <input message="tns:inputSoapFloat"/>

+                    <output message="tns:outputSoapFloat"/>

+                </operation>

+                <operation name="methodSoapDouble">

+                    <input message="tns:inputSoapDouble"/>

+                    <output message="tns:outputSoapDouble"/>

+                </operation>

+                <operation name="methodSoapDecimal">

+                    <input message="tns:inputSoapDecimal"/>

+                    <output message="tns:outputSoapDecimal"/>

+                </operation>

+                <operation name="methodSoapInt">

+                    <input message="tns:inputSoapInt"/>

+                    <output message="tns:outputSoapInt"/>

+                </operation>

+                <operation name="methodSoapShort">

+                    <input message="tns:inputSoapShort"/>

+                    <output message="tns:outputSoapShort"/>

+                </operation>

+            </portType>

+

+

+            <binding name="TypeTestBinding" type="tns:TypeTest">

+                <soap:binding

+                    style="rpc"

+                    transport="http://schemas.xmlsoap.org/soap/http"/>

+                <operation name="allPrimitivesIn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="allPrimitivesInout">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="allPrimitivesOut">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="enumIn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="enumInout">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="enumOut">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="enumReturn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="enumIntIn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="enumIntInout">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="enumIntOut">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="enumIntReturn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="arrayIn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="arrayInout">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="arrayOut">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="arrayReturn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+

+                <operation name="arrayMIn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="arrayMInout">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="arrayMOut">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="arrayMReturn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+

+                <operation name="complexAllIn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="complexAllInout">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="complexAllOut">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="complexAllReturn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="complexSequenceIn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="complexSequenceInout">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="complexSequenceOut">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="complexSequenceReturn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="complexWComplexIn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="complexWComplexInout">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="complexWComplexOut">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="complexWComplexReturn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="emptyComplexTypeIn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                    <fault name="emptyFault">

+                        <soap:fault name="emptyFault" use="encoded"/>

+                    </fault>

+                </operation>

+                <operation name="emptyComplexTypeInout">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                    <fault name="emptyFault">

+                        <soap:fault name="emptyFault" use="encoded"/>

+                    </fault>

+                </operation>

+                <operation name="emptyComplexTypeOut">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                    <fault name="emptyFault">

+                        <soap:fault name="emptyFault" use="encoded"/>

+                    </fault>

+                </operation>

+                <operation name="emptyComplexTypeReturn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                    <fault name="emptyFault">

+                        <soap:fault name="emptyFault" use="encoded"/>

+                    </fault>

+                </operation>

+                <operation name="anyIn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="anyInout">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="anyOut">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="anyReturn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="animalIn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="animalInout">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="animalOut">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="animalReturn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="catIn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="catInout">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="catOut">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="catReturn">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodBoolean">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodByte">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodShort">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodInt">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodLong">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodFloat">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodDouble">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodString">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodInteger">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodDecimal">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodDateTime">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodQName">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodTime">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodUnsignedLong">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodUnsignedInt">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodUnsignedShort">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodUnsignedByte">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodNonNegativeInteger">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodPositiveInteger">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodNonPositiveInteger">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodNegativeInteger">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+

+                <operation name="methodAnyURI">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodSimpleAnyURI">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodYear">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodMonth">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodDay">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodYearMonth">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodMonthDay">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodSoapString">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodSoapBoolean">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodSoapFloat">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodSoapDouble">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodSoapDecimal">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodSoapInt">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+                <operation name="methodSoapShort">

+                    <soap:operation soapAction=""/>

+                    <input>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </input>

+                    <output>

+                        <soap:body

+                            use="encoded"

+                            namespace=""

+                            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

+                    </output>

+                </operation>

+            </binding>

+

+

+            <service name="TypeTestService">

+                <port name="TypeTest" binding="tns:TypeTestBinding">

+                    <soap:address location="http://localhost:8080/axis/services/TypeTest"/>

+                </port>

+            </service>

+

+        </definitions>

+

+    </env:Body>

+</env:Envelope>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/soap/sample1.txt b/axiom/modules/axiom-tests/test-resources/soap/sample1.txt
new file mode 100644
index 0000000..a5f7560
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/soap/sample1.txt
@@ -0,0 +1,12 @@
+POST /axis/services/EchoService HTTP/1.1
+Host: 127.0.0.1
+Content-Type: application/soap+xml; charset="utf-8"
+
+<?xml version='1.0' ?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> 
+ <env:Header>
+ </env:Header>
+ <env:Body>
+	<axis2:echoVoid xmlns:axis2="http://ws.apache.org/axis2" ></axis2:echoVoid>
+ </env:Body>
+</env:Envelope>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/soap/sample1.xml b/axiom/modules/axiom-tests/test-resources/soap/sample1.xml
new file mode 100644
index 0000000..6a06a41
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/soap/sample1.xml
@@ -0,0 +1,9 @@
+<?xml version='1.0' ?>

+<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">

+    <env:Header>

+    </env:Header>

+    <env:Body>

+        <axis2:echoVoid xmlns:axis2="http://ws.apache.org/axis2">

+        </axis2:echoVoid>

+    </env:Body>

+</env:Envelope>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/soap/security2-soap.xml b/axiom/modules/axiom-tests/test-resources/soap/security2-soap.xml
new file mode 100644
index 0000000..eeed17b
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/soap/security2-soap.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>

+<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"

+    xmlns:ds="http://www.w3.org/2000/09/xmldsig#"

+    xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/04/secext"

+    xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">

+    <S:Header>

+        <m:path xmlns:m="http://schemas.xmlsoap.org/rp">

+            <m:action>http://fabrikam123.com/getQuote</m:action>

+            <m:to>http://fabrikam123.com/stocks</m:to>

+            <m:from>mailto:johnsmith@fabrikam123.com</m:from>

+            <m:id>uuid:84b9f5d0-33fb-4a81-b02b-5b760641c1d6</m:id>

+        </m:path>

+        <wsse:Security>

+            <wsse:BinarySecurityToken

+                ValueType="wsse:X509v3"

+                EncodingType="wsse:Base64Binary"

+                Id="X509Token">

+                MIIEZzCCA9CgAwIBAgIQEmtJZc0rqrKh5i...

+            </wsse:BinarySecurityToken>

+            <ds:Signature>

+                <ds:SignedInfo>

+                    <ds:CanonicalizationMethod Algorithm=

+                                               "http://www.w3.org/2001/10/xml-exc-c14n#"/>

+                    <ds:SignatureMethod Algorithm=

+                                        "http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>

+                    <ds:Reference>

+                        <ds:Transforms>

+                            <ds:Transform Algorithm=

+                                          "http://...#RoutingTransform"/>

+                            <ds:Transform Algorithm=

+                                          "http://www.w3.org/2001/10/xml-exc-c14n#"/>

+                        </ds:Transforms>

+                        <ds:DigestMethod Algorithm=

+                                         "http://www.w3.org/2000/09/xmldsig#sha1"/>

+                        <ds:DigestValue>EULddytSo1...</ds:DigestValue>

+                    </ds:Reference>

+                </ds:SignedInfo>

+                <ds:SignatureValue>

+                    BL8jdfToEb1l/vXcMZNNjPOV...

+                </ds:SignatureValue>

+                <ds:KeyInfo>

+                    <wsse:SecurityTokenReference>

+                        <wsse:Reference URI="#X509Token"/>

+                    </wsse:SecurityTokenReference>

+                </ds:KeyInfo>

+            </ds:Signature>

+        </wsse:Security>

+    </S:Header>

+    <S:Body>

+        <tru:StockSymbol xmlns:tru="http://fabrikam123.com/payloads">

+            QQQ

+        </tru:StockSymbol>

+    </S:Body>

+</S:Envelope>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/soap/soap11/soap11fault.xml b/axiom/modules/axiom-tests/test-resources/soap/soap11/soap11fault.xml
new file mode 100644
index 0000000..3db7989
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/soap/soap11/soap11fault.xml
@@ -0,0 +1,16 @@
+ <SOAP-ENV:Envelope

+     xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">

+     <SOAP-ENV:Header>

+         <TestHeader>Test</TestHeader>

+     </SOAP-ENV:Header>

+     <SOAP-ENV:Body>

+         <SOAP-ENV:Fault>

+             <faultcode>SOAP-ENV:MustUnderstand</faultcode>

+             <faultstring>SOAP Must Understand Error</faultstring>

+             <faultactor>Actor</faultactor>

+             <detail>Detail text

+                 <SomeElement>Some Element Text</SomeElement>

+             </detail>

+         </SOAP-ENV:Fault>

+     </SOAP-ENV:Body>

+ </SOAP-ENV:Envelope>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/soap/soap11/soap11message.xml b/axiom/modules/axiom-tests/test-resources/soap/soap11/soap11message.xml
new file mode 100644
index 0000000..f2dc7ce
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/soap/soap11/soap11message.xml
@@ -0,0 +1,46 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"

+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+    <soapenv:Header>

+        <wsa:From soapenv:mustUnderstand="0"

+            soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next">

+            <Address xmlns="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+                http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous

+            </Address>

+        </wsa:From>

+        <test:MessageID xmlns:test="http://example.org/ts-tests"

+            soapenv:mustUnderstand="1"

+            soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"

+            soapenv:anyAttribute="any value">

+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5

+        </test:MessageID>

+        <wsa:To soapenv:mustUnderstand="0"

+            soapenv:anyAttribute="any value">

+            http://localhost:8081/axis/services/BankPort

+        </wsa:To>

+    </soapenv:Header>

+    <soapenv:Body>

+        <soapenv:Fault>

+            <soapenv:faultcode>

+                env:Sender

+            </soapenv:faultcode>

+            <soapenv:faultstring>Sender Timeout</soapenv:faultstring>

+            <soapenv:faultactor>

+                http://schemas.xmlsoap.org/soap/envelope/actor/ultimateReceiver

+            </soapenv:faultactor>

+            <soapenv:detail xmlns:m="http://www.sample.org">

+                Details of error

+                <m:MaxTime m:detail="This is only a test">

+                    P5M

+                </m:MaxTime>

+                <m:AveTime>

+                    <m:Time>

+                        P3M

+                    </m:Time>

+                </m:AveTime>

+            </soapenv:detail>

+        </soapenv:Fault>

+    </soapenv:Body>

+</soapenv:Envelope>

+

diff --git a/axiom/modules/axiom-tests/test-resources/soap/soap11/soapfault1.xml b/axiom/modules/axiom-tests/test-resources/soap/soap11/soapfault1.xml
new file mode 100644
index 0000000..8a2b44c
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/soap/soap11/soapfault1.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8" ?>

+<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">

+<S:Header>

+<Action xmlns="http://www.w3.org/2005/08/addressing">http://www.w3.org/2005/08/addressing/fault</Action>

+<FaultDetail xmlns="http://www.w3.org/2005/08/addressing">

+<ProblemHeaderQName xmlns="http://www.w3.org/2005/08/addressing">ReplyTo</ProblemHeaderQName>

+</FaultDetail>

+<RelatesTo xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:C6E4970C03887FC5C31153324076046143</RelatesTo>

+</S:Header>

+<S:Body>

+<SOAP-ENV:Fault xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">

+<faultcode xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">wsa:OnlyAnonymousAddressSupported</faultcode>

+<faultstring xmlns="">A header representing a Message Addressing Property is not valid and the message cannot be processed</faultstring>

+</SOAP-ENV:Fault>

+</S:Body>

+</S:Envelope>

diff --git a/axiom/modules/axiom-tests/test-resources/soap/soap11/soapfault2.xml b/axiom/modules/axiom-tests/test-resources/soap/soap11/soapfault2.xml
new file mode 100644
index 0000000..c3bf5fd
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/soap/soap11/soapfault2.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8" ?>

+<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">

+<S:Header>

+<Action xmlns="http://www.w3.org/2005/08/addressing">http://www.w3.org/2005/08/addressing/fault</Action>

+<FaultDetail xmlns="http://www.w3.org/2005/08/addressing">

+<ProblemHeaderQName xmlns="http://www.w3.org/2005/08/addressing">ReplyTo</ProblemHeaderQName>

+</FaultDetail>

+<RelatesTo xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:C6E4970C03887FC5C31153324076046143</RelatesTo>

+</S:Header>

+<S:Body>

+<SOAP-ENV:Fault xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">

+<faultcode xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns="" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">wsa:OnlyAnonymousAddressSupported</faultcode>

+<faultstring xmlns="">A header representing a Message Addressing Property is not valid and the message cannot be processed</faultstring>

+</SOAP-ENV:Fault>

+</S:Body>

+</S:Envelope>

diff --git a/axiom/modules/axiom-tests/test-resources/soap/soap12message.xml b/axiom/modules/axiom-tests/test-resources/soap/soap12message.xml
new file mode 100644
index 0000000..a95f0ab
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/soap/soap12message.xml
@@ -0,0 +1,58 @@
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xml="http://www.w3.org/XML/1998/namespace">

+    <env:Header>

+        <test:echoOk xmlns:test="http://example.org/ts-tests"

+            env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"

+            env:mustUnderstand="true"

+            env:anyAttribute="any value">

+            foo

+        </test:echoOk>

+        <test1:echoOk1 xmlns:test1="http://example1.org/ts-tests"

+            env:role="http://www.w3.org/2003/05/soap-envelope/role/next"

+            env:mustUnderstand="false"

+            env:anyAttribute="any value">

+            foo

+        </test1:echoOk1>

+        <test2:echoOk2 xmlns:test2="http://example2.org/ts-tests"

+            env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"

+            env:mustUnderstand="1"

+            env:anyAttribute="any value">

+            foo

+        </test2:echoOk2>

+    </env:Header>

+    <env:Body>

+        <env:Fault>

+            <env:Code>

+                <env:Value>env:Sender</env:Value>

+                <env:Subcode>

+                    <env:Value>m:MessageTimeout In First Subcode</env:Value>

+                    <env:Subcode>

+                        <env:Value>m:MessageTimeout In Second Subcode</env:Value>

+                        <env:Subcode>

+                            <env:Value>m:MessageTimeout In Third Subcode</env:Value>

+                        </env:Subcode>

+                    </env:Subcode>

+                </env:Subcode>

+            </env:Code>

+            <env:Reason>

+                <env:Text xml:lang="en">Sender Timeout</env:Text>

+            </env:Reason>

+            <env:Node>

+                http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver

+            </env:Node>

+            <env:Role>

+                ultimateReceiver

+            </env:Role>

+            <env:Detail xmlns:m="http:www.sample.org">

+                Details of error

+                <m:MaxTime m:detail="This is only a test">

+                    P5M\n

+                </m:MaxTime>

+                <m:AveTime>

+                    <m:Time>

+                        P3M\n

+                    </m:Time>

+                </m:AveTime>

+            </env:Detail>

+        </env:Fault>

+    </env:Body>

+</env:Envelope>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/soap/soapmessage.txt b/axiom/modules/axiom-tests/test-resources/soap/soapmessage.txt
new file mode 100644
index 0000000..acae3b5
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/soap/soapmessage.txt
@@ -0,0 +1,16 @@
+POST /axis/services/EchoService HTTP/1.1

+Host: 127.0.0.1

+Content-Type: application/soap+xml; charset="utf-8"

+

+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+    <soapenv:Header>

+        <wsa:MessageID soapenv:mustUnderstand="0">uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>

+        <wsa:To soapenv:mustUnderstand="0">http://localhost:8081/axis/services/BankPort</wsa:To>

+        <wsa:From soapenv:mustUnderstand="0">

+            <Address xmlns="http://schemas.xmlsoap.org/ws/2004/03/addressing">http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</Address>

+        </wsa:From>

+    </soapenv:Header>

+    <soapenv:Body>

+        <axis2:echoVoid xmlns:axis2="http://ws.apache.org/axis2" ></axis2:echoVoid>

+    </soapenv:Body>

+</soapenv:Envelope>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/soap/soapmessage.xml b/axiom/modules/axiom-tests/test-resources/soap/soapmessage.xml
new file mode 100644
index 0000000..e5083d0
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/soap/soapmessage.xml
@@ -0,0 +1,20 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"

+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+    <soapenv:Header>

+        <wsa:MessageID soapenv:mustUnderstand="0">

+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>

+        <wsa:To soapenv:mustUnderstand="0">

+            http://localhost:8081/axis/services/BankPort</wsa:To>

+        <wsa:From soapenv:mustUnderstand="0">

+            <Address xmlns="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+                http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous

+            </Address>

+        </wsa:From>

+    </soapenv:Header>

+    <soapenv:Body>

+        <axis2:echoVoid xmlns:axis2="http://ws.apache.org/axis2">

+        </axis2:echoVoid>

+    </soapenv:Body>

+</soapenv:Envelope>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/soap/soapmessage1.xml b/axiom/modules/axiom-tests/test-resources/soap/soapmessage1.xml
new file mode 100644
index 0000000..81e3ff2
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/soap/soapmessage1.xml
@@ -0,0 +1,27 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"

+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+    <soapenv:Header>

+        <wsa:MessageID soapenv:mustUnderstand="0">

+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>

+        <wsa:To soapenv:mustUnderstand="0">

+            http://localhost:8081/axis/services/BankPort</wsa:To>

+        <wsa:From soapenv:mustUnderstand="0">

+            <Address xmlns="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+                http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous

+            </Address>

+        </wsa:From>

+    </soapenv:Header>

+    <soapenv:Body>

+        <ns1:getBalance soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"

+            xmlns:ns1="http://localhost:8081/axis/services/BankPort">

+            <ns1:accountNo href="#id0"/>

+        </ns1:getBalance>

+        <multiRef xmlns="tempUri" id="id0" soapenc:root="0"

+            soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"

+            xsi:type="xsd:int"

+            xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">1001

+        </multiRef>

+    </soapenv:Body>

+</soapenv:Envelope>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/soap/whitespacedMessage.xml b/axiom/modules/axiom-tests/test-resources/soap/whitespacedMessage.xml
new file mode 100644
index 0000000..342b63d
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/soap/whitespacedMessage.xml
@@ -0,0 +1,27 @@
+<?xml version='1.0' ?>

+<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"

+    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+

+    <env:Header>

+

+

+        <wsa:MessageID env:mustUnderstand="0">

+            uuid:920C5190-0B8F-11D9-8CED-F22EDEEBF7E5</wsa:MessageID>

+        <wsa:To env:mustUnderstand="0">

+            http://localhost:8081/axis/services/BankPort</wsa:To>

+        <wsa:From env:mustUnderstand="0">

+            <Address xmlns="http://schemas.xmlsoap.org/ws/2004/03/addressing">

+                http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous

+            </Address>

+        </wsa:From>

+

+    </env:Header>

+    <env:Body>

+

+

+        <axis2:echoVoid xmlns:axis2="http://ws.apache.org/axis2">

+        </axis2:echoVoid>

+

+

+    </env:Body>

+</env:Envelope>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/soap/wrongEnvelopeNamespace.xml b/axiom/modules/axiom-tests/test-resources/soap/wrongEnvelopeNamespace.xml
new file mode 100644
index 0000000..850ef8a
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/soap/wrongEnvelopeNamespace.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>

+<soap:Envelope

+xmlns:soap="http://www.w3.org/2001/12/soap-envelope"

+soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

+

+  <soap:Body xmlns:m="http://www.stock.org/stock">

+    <m:GetStockPrice>

+      <m:StockName>IBM</m:StockName>

+    </m:GetStockPrice>

+  </soap:Body>

+

+</soap:Envelope>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/xml/axis.xml b/axiom/modules/axiom-tests/test-resources/xml/axis.xml
new file mode 100644
index 0000000..fe7cca8
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/axis.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>

+

+<root>

+

+  <a>

+    <a.1/>

+    <a.2/>

+    <a.3/>

+    <a.4/>

+    <a.5/>

+  </a>

+

+  <b>

+    <b.1/>

+    <b.2/>

+    <b.3/>

+    <b.4/>

+    <b.5/>

+    <b.6/>

+    <b.7/>

+    <b.8/>

+    <b.9/>

+  </b>

+

+</root>

diff --git a/axiom/modules/axiom-tests/test-resources/xml/basic.xml b/axiom/modules/axiom-tests/test-resources/xml/basic.xml
new file mode 100644
index 0000000..caf3fa9
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/basic.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>

+

+<foo>

+    <bar>

+        <baz/>

+        <cheese/>

+        <baz/>

+        <cheese/>

+        <baz/>

+    </bar>

+</foo>

diff --git a/axiom/modules/axiom-tests/test-resources/xml/basicupdate.xml b/axiom/modules/axiom-tests/test-resources/xml/basicupdate.xml
new file mode 100644
index 0000000..52bd0f7
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/basicupdate.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>

+

+<xu:modifications xmlns:xu="http://www.xmldb.org/xupdate">

+

+  <xu:append select="/foo/bar/cheese[1]">

+    Goudse kaas

+    <edam type="jong belegen">Rond</edam>

+  </xu:append>

+

+  <xu:remove select="/foo/bar/baz[2]"/>

+

+  <xu:if test="/foo">

+    <xu:insert-before select="/foo/bar/baz[2]">

+      <cheese>More cheese!</cheese>

+    </xu:insert-before>

+  </xu:if>

+

+  <xu:insert-before select="/foo/bar/baz[2]">

+    <cheese>Even more cheese!</cheese>

+  </xu:insert-before>

+

+  <xu:if test="/bar">

+    <xu:insert-before select="/foo/bar/baz[2]">

+      <sausages>No sausages today</sausages>

+    </xu:insert-before>

+  </xu:if>

+

+  <xu:variable

+    xmlns:private="http://www.jaxen.org/private"

+    name="private:twice">

+    <cracker/>

+    <!-- champagne -->

+    <?oisters with a bit of lemon?>

+  </xu:variable>

+

+  <xu:variable name="twice" select="'Twice'"/>

+  

+  <xu:insert-after

+    select="/foo/bar"

+    xmlns:private="http://www.jaxen.org/private"

+    >

+    <xu:value-of select="$private:twice"/>

+    <xu:value-of select="$private:twice"/>

+    <xu:value-of select="$twice"/>

+  </xu:insert-after>

+

+</xu:modifications>

diff --git a/axiom/modules/axiom-tests/test-resources/xml/contents.xml b/axiom/modules/axiom-tests/test-resources/xml/contents.xml
new file mode 100644
index 0000000..b309bda
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/contents.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>

+

+<?xml-stylesheet href="XSL\JavaXML.html.xsl" type="text/xsl"?>

+<?xml-stylesheet href="XSL\JavaXML.wml.xsl" type="text/xsl" 

+                 media="wap"?>

+<?cocoon-process type="xslt"?>

+

+<!-- Java and XML -->

+<JavaXML:Book xmlns:JavaXML="http://www.oreilly.com/catalog/javaxml/" 

+              xmlns:ora="http://www.oreilly.com"

+              xmlns:unused="http://www.unused.com"

+              ora:category="Java" 

+> 

+  <!-- comment one -->

+  <!-- comment two -->

+

+ <JavaXML:Title>Java and XML</JavaXML:Title>

+ <JavaXML:Contents xmlns:topic="http://www.oreilly.com/topics">

+  <JavaXML:Chapter topic:focus="XML">

+   <JavaXML:Heading>Introduction</JavaXML:Heading>

+   <JavaXML:Topic subSections="7">

+     What Is It?

+   </JavaXML:Topic>

+   <JavaXML:Topic subSections="3">

+     How Do I Use It?

+   </JavaXML:Topic>

+   <JavaXML:Topic subSections="4">

+     Why Should I Use It?

+   </JavaXML:Topic>

+   <JavaXML:Topic subSections="0">

+     What's Next?

+   </JavaXML:Topic>

+  </JavaXML:Chapter>

+

+  <JavaXML:Chapter topic:focus="XML">

+   <JavaXML:Heading>Creating XML</JavaXML:Heading>

+   <JavaXML:Topic subSections="0">An XML Document</JavaXML:Topic>

+   <JavaXML:Topic subSections="2">The Header</JavaXML:Topic>

+   <JavaXML:Topic subSections="6">The Content</JavaXML:Topic>

+   <JavaXML:Topic subSections="1">What's Next?</JavaXML:Topic>

+  </JavaXML:Chapter>

+

+  <JavaXML:Chapter topic:focus="Java">

+   <JavaXML:Heading>Parsing XML</JavaXML:Heading>

+   <JavaXML:Topic subSections="3">Getting Prepared</JavaXML:Topic>

+   <JavaXML:Topic subSections="3">SAX Readers</JavaXML:Topic>

+   <JavaXML:Topic subSections="9">Content Handlers</JavaXML:Topic>

+   <JavaXML:Topic subSections="4">Error Handlers</JavaXML:Topic>

+   <JavaXML:Topic subSections="0">

+     A Better Way to Load a Parser

+   </JavaXML:Topic>

+   <JavaXML:Topic subSections="4">"Gotcha!"</JavaXML:Topic>

+   <JavaXML:Topic subSections="0">What's Next?</JavaXML:Topic>

+  </JavaXML:Chapter>

+

+  <JavaXML:SectionBreak/>

+

+  <JavaXML:Chapter topic:focus="Java">

+   <JavaXML:Heading>Web Publishing Frameworks</JavaXML:Heading>

+   <JavaXML:Topic subSections="4">Selecting a Framework</JavaXML:Topic>

+   <JavaXML:Topic subSections="4">Installation</JavaXML:Topic>

+   <JavaXML:Topic subSections="3">

+     Using a Publishing Framework

+   </JavaXML:Topic>

+   <JavaXML:Topic subSections="2">XSP</JavaXML:Topic>

+   <JavaXML:Topic subSections="3">Cocoon 2.0 and Beyond</JavaXML:Topic>

+   <JavaXML:Topic subSections="0">What's Next?</JavaXML:Topic>

+  </JavaXML:Chapter>

+ </JavaXML:Contents>

+</JavaXML:Book>

diff --git a/axiom/modules/axiom-tests/test-resources/xml/defaultNamespace.xml b/axiom/modules/axiom-tests/test-resources/xml/defaultNamespace.xml
new file mode 100644
index 0000000..d5cb3c6
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/defaultNamespace.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>

+<a xmlns="http://dummyNamespace/">

+  <b>

+    <c>Hello</c>

+  </b>

+</a>

diff --git a/axiom/modules/axiom-tests/test-resources/xml/dtd.xml b/axiom/modules/axiom-tests/test-resources/xml/dtd.xml
new file mode 100644
index 0000000..cddd8e2
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/dtd.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE feed [
+        <!ENTITY foo "bar">
+        <!ENTITY bar "foo">
+        ]>
+<feed xmlns="http://www.w3.org/2005/Atom">
+</feed>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/xml/evaluate.xml b/axiom/modules/axiom-tests/test-resources/xml/evaluate.xml
new file mode 100644
index 0000000..bf919a3
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/evaluate.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>

+

+<evaluate>

+  <data>

+    <jumps>

+      <subject>

+        <the/>

+        <fox color="brown"/>

+        <speed category="quick"/>

+      </subject>

+      <over/>

+      <object>

+        <the/>

+        <dog color="unspecified"/>

+        <speed category="lazy"/>

+      </object>

+    </jumps>

+  </data>

+       

+  <!-- there is one element with attribute color="brown" should this

+  meta-test should succeed -->

+  

+  <metatest select="//@color">brown</metatest>

+ 

+  <!-- there is no element with attribute category="moderate" -->

+  <metatest select="//speed/@category">moderate</metatest>

+

+</evaluate>

diff --git a/axiom/modules/axiom-tests/test-resources/xml/fibo.xml b/axiom/modules/axiom-tests/test-resources/xml/fibo.xml
new file mode 100644
index 0000000..624988a
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/fibo.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<Fibonacci_Numbers>

+  <fibonacci index="0">0</fibonacci>

+  <fibonacci index="1">1</fibonacci>

+  <fibonacci index="2">1</fibonacci>

+  <fibonacci index="3">2</fibonacci>

+  <fibonacci index="4">3</fibonacci>

+  <fibonacci index="5">5</fibonacci>

+  <fibonacci index="6">8</fibonacci>

+  <fibonacci index="7">13</fibonacci>

+  <fibonacci index="8">21</fibonacci>

+  <fibonacci index="9">34</fibonacci>

+  <fibonacci index="10">55</fibonacci>

+  <fibonacci index="11">89</fibonacci>

+  <fibonacci index="12">144</fibonacci>

+  <fibonacci index="13">233</fibonacci>

+  <fibonacci index="14">377</fibonacci>

+  <fibonacci index="15">610</fibonacci>

+  <fibonacci index="16">987</fibonacci>

+  <fibonacci index="17">1597</fibonacci>

+  <fibonacci index="18">2584</fibonacci>

+  <fibonacci index="19">4181</fibonacci>

+  <fibonacci index="20">6765</fibonacci>

+  <fibonacci index="21">10946</fibonacci>

+  <fibonacci index="22">17711</fibonacci>

+  <fibonacci index="23">28657</fibonacci>

+  <fibonacci index="24">46368</fibonacci>

+  <fibonacci index="25">75025</fibonacci>

+</Fibonacci_Numbers>

diff --git a/axiom/modules/axiom-tests/test-resources/xml/id.xml b/axiom/modules/axiom-tests/test-resources/xml/id.xml
new file mode 100644
index 0000000..84733b6
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/id.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>

+

+<!DOCTYPE foo [

+

+<!ELEMENT foo (bar)>

+<!ATTLIST foo id CDATA #IMPLIED>

+<!ELEMENT bar (#PCDATA|cheese)*>

+<!ATTLIST bar id ID #REQUIRED>

+<!ELEMENT cheese (#PCDATA)>

+<!ATTLIST cheese kind ID #IMPLIED>

+]>

+

+<foo id="foobar">

+  <bar id="fb1">

+    baz

+    <cheese kind="edam">gouda</cheese>

+    baz

+    <cheese kind="gouda">cheddar</cheese>

+    baz

+  </bar>

+</foo>

diff --git a/axiom/modules/axiom-tests/test-resources/xml/jaxen24.xml b/axiom/modules/axiom-tests/test-resources/xml/jaxen24.xml
new file mode 100644
index 0000000..176606e
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/jaxen24.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>

+<body><p><span></span></p><div></div></body> 

diff --git a/axiom/modules/axiom-tests/test-resources/xml/jaxen3.xml b/axiom/modules/axiom-tests/test-resources/xml/jaxen3.xml
new file mode 100644
index 0000000..8647396
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/jaxen3.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<Configuration>

+    <hostname>

+        <val>2</val>

+        <attrlist>

+            <hostname>CE-A</hostname>

+        </attrlist>

+    </hostname>

+    <hostname>

+        <val>1</val>

+        <attrlist>

+            <hostname>CE-B</hostname>

+        </attrlist>

+    </hostname>

+</Configuration>

diff --git a/axiom/modules/axiom-tests/test-resources/xml/lang.xml b/axiom/modules/axiom-tests/test-resources/xml/lang.xml
new file mode 100644
index 0000000..e1c02eb
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/lang.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>

+<e1 xml:lang="hr">

+  <e2 xml:lang="en-US">

+    <e3/>

+  </e2>

+  <e2 xml:lang="hu">

+    <e3/>

+    <e3/>

+    <e3 xml:lang="es"/>

+  </e2>

+</e1>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/xml/message.xml b/axiom/modules/axiom-tests/test-resources/xml/message.xml
new file mode 100644
index 0000000..808a02c
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/message.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>

+<message>

+  <header>

+    <service>lookupformservice</service>

+    <connectionid>9</connectionid>

+    <appid>stammdaten</appid>

+    <action>new</action>

+  </header>

+  <body>

+    <data>

+      <items>

+        <item>

+          <name>iteminfo</name>

+          <value>ELE</value>

+        </item>

+        <item>

+          <name>parentinfo</name>

+          <value>Pruefgebiete</value>

+        </item>

+        <item>

+          <name>id</name>

+          <value>1</value>

+        </item>

+      </items>

+    </data>

+  </body>

+</message>

diff --git a/axiom/modules/axiom-tests/test-resources/xml/moreover.xml b/axiom/modules/axiom-tests/test-resources/xml/moreover.xml
new file mode 100644
index 0000000..06d4da7
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/moreover.xml
@@ -0,0 +1,243 @@
+<?xml version="1.0" encoding="iso-8859-1"?>

+   <moreovernews>

+      <article code="13563275">

+         <url>http://c.moreover.com/click/here.pl?x13563273</url>

+         <headline_text>e-Commerce Operators Present Version 1.0 of the XML Standard</headline_text>

+         <source>StockAccess</source>

+         <media_type>text</media_type>

+         <cluster>moreover...</cluster>

+         <tagline> </tagline>

+         <document_url>http://www.stockaccess.com/index.html</document_url>

+         <harvest_time>Dec 24 2000  6:28AM</harvest_time>

+         <access_registration> </access_registration>

+         <access_status> </access_status>

+      </article>

+      <article code="13560996">

+         <url>http://c.moreover.com/click/here.pl?x13560995</url>

+         <headline_text>W3C Publishes XML Protocol Requirements Document</headline_text>

+         <source>Xml</source>

+         <media_type>text</media_type>

+         <cluster>moreover...</cluster>

+         <tagline> </tagline>

+         <document_url>http://www.xml.com/</document_url>

+         <harvest_time>Dec 24 2000 12:22AM</harvest_time>

+         <access_registration> </access_registration>

+         <access_status> </access_status>

+      </article>

+      <article code="13553522">

+         <url>http://c.moreover.com/click/here.pl?x13553521</url>

+         <headline_text>Prowler: Open Source XML-Based Content Management Framework</headline_text>

+         <source>Xml</source>

+         <media_type>text</media_type>

+         <cluster>moreover...</cluster>

+         <tagline> </tagline>

+         <document_url>http://www.xml.com/</document_url>

+         <harvest_time>Dec 23 2000  2:05PM</harvest_time>

+         <access_registration> </access_registration>

+         <access_status> </access_status>

+      </article>

+      <article code="13549014">

+         <url>http://c.moreover.com/click/here.pl?x13549013</url>

+         <headline_text>The Middleware Company Debuts Public Training Courses in Ejb, J2ee And Xml</headline_text>

+         <source>Java Industry Connection</source>

+         <media_type>text</media_type>

+         <cluster>moreover...</cluster>

+         <tagline> </tagline>

+         <document_url>http://industry.java.sun.com/javanews/more/hotnews/</document_url>

+         <harvest_time>Dec 23 2000 12:15PM</harvest_time>

+         <access_registration> </access_registration>

+         <access_status> </access_status>

+      </article>

+      <article code="13544468">

+         <url>http://c.moreover.com/click/here.pl?x13544467</url>

+         <headline_text>Revised Working Draft for the W3C XML Information Set</headline_text>

+         <source>Xml</source>

+         <media_type>text</media_type>

+         <cluster>moreover...</cluster>

+         <tagline> </tagline>

+         <document_url>http://www.xml.com/</document_url>

+         <harvest_time>Dec 23 2000  5:50AM</harvest_time>

+         <access_registration> </access_registration>

+         <access_status> </access_status>

+      </article>

+      <article code="13534837">

+         <url>http://c.moreover.com/click/here.pl?x13534836</url>

+         <headline_text>XML: Its The Great Peacemaker</headline_text>

+         <source>ZDNet</source>

+         <media_type>text</media_type>

+         <cluster>moreover...</cluster>

+         <tagline> </tagline>

+         <document_url>http://www.zdnet.com/intweek/</document_url>

+         <harvest_time>Dec 22 2000  9:05PM</harvest_time>

+         <access_registration> </access_registration>

+         <access_status> </access_status>

+      </article>

+      <article code="13533486">

+         <url>http://c.moreover.com/click/here.pl?x13533485</url>

+         <headline_text>Project eL - The XML Leningrad Codex Markup Project</headline_text>

+         <source>Xml</source>

+         <media_type>text</media_type>

+         <cluster>moreover...</cluster>

+         <tagline> </tagline>

+         <document_url>http://www.xml.com/</document_url>

+         <harvest_time>Dec 22 2000  8:34PM</harvest_time>

+         <access_registration> </access_registration>

+         <access_status> </access_status>

+      </article>

+      <article code="13533489">

+         <url>http://c.moreover.com/click/here.pl?x13533488</url>

+         <headline_text>XML Linking Language (XLink) and XML Base Specifications Issued as W3C Proposed Recommenda</headline_text>

+         <source>Xml</source>

+         <media_type>text</media_type>

+         <cluster>moreover...</cluster>

+         <tagline> </tagline>

+         <document_url>http://www.xml.com/</document_url>

+         <harvest_time>Dec 22 2000  8:34PM</harvest_time>

+         <access_registration> </access_registration>

+         <access_status> </access_status>

+      </article>

+      <article code="13533493">

+         <url>http://c.moreover.com/click/here.pl?x13533492</url>

+         <headline_text>W3C Releases XHTML Basic Specification as a W3C Recommendation</headline_text>

+         <source>Xml</source>

+         <media_type>text</media_type>

+         <cluster>moreover...</cluster>

+         <tagline> </tagline>

+         <document_url>http://www.xml.com/</document_url>

+         <harvest_time>Dec 22 2000  8:34PM</harvest_time>

+         <access_registration> </access_registration>

+         <access_status> </access_status>

+      </article>

+      <article code="13521835">

+         <url>http://c.moreover.com/click/here.pl?x13521827</url>

+         <headline_text>Java, Xml And Oracle9i(TM) Make A Great Team</headline_text>

+         <source>Java Industry Connection</source>

+         <media_type>text</media_type>

+         <cluster>moreover...</cluster>

+         <tagline> </tagline>

+         <document_url>http://industry.java.sun.com/javanews/more/hotnews/</document_url>

+         <harvest_time>Dec 22 2000  3:21PM</harvest_time>

+         <access_registration> </access_registration>

+         <access_status> </access_status>

+      </article>

+      <article code="13512020">

+         <url>http://c.moreover.com/click/here.pl?x13511233</url>

+         <headline_text>Competing initiatives to vie for security standard</headline_text>

+         <source>ZDNet</source>

+         <media_type>text</media_type>

+         <cluster>moreover...</cluster>

+         <tagline> </tagline>

+         <document_url>http://www.zdnet.com/eweek/filters/news/</document_url>

+         <harvest_time>Dec 22 2000 10:54AM</harvest_time>

+         <access_registration> </access_registration>

+         <access_status> </access_status>

+      </article>

+      <article code="13492401">

+         <url>http://c.moreover.com/click/here.pl?x13492397</url>

+         <headline_text>Oracle Provides Developers with Great Xml Reading This Holiday Season</headline_text>

+         <source>Java Industry Connection</source>

+         <media_type>text</media_type>

+         <cluster>moreover...</cluster>

+         <tagline> </tagline>

+         <document_url>http://industry.java.sun.com/javanews/more/hotnews/</document_url>

+         <harvest_time>Dec 21 2000  8:08PM</harvest_time>

+         <access_registration> </access_registration>

+         <access_status> </access_status>

+      </article>

+      <article code="13491296">

+         <url>http://c.moreover.com/click/here.pl?x13491292</url>

+         <headline_text>XML as the great peacemaker - Extensible Markup Language Accomplished The Seemingly Impossible This Year: It B</headline_text>

+         <source>Hospitality Net</source>

+         <media_type>text</media_type>

+         <cluster>moreover...</cluster>

+         <tagline> </tagline>

+         <document_url>http://www.hospitalitynet.org/news/list.htm?c=2000</document_url>

+         <harvest_time>Dec 21 2000  7:45PM</harvest_time>

+         <access_registration> </access_registration>

+         <access_status> </access_status>

+      </article>

+      <article code="13484761">

+         <url>http://c.moreover.com/click/here.pl?x13484758</url>

+         <headline_text>XML as the great peacemaker</headline_text>

+         <source>CNET</source>

+         <media_type>text</media_type>

+         <cluster>moreover...</cluster>

+         <tagline> </tagline>

+         <document_url>http://news.cnet.com/news/0-1003.html?tag=st.ne.1002.dir.1003</document_url>

+         <harvest_time>Dec 21 2000  4:41PM</harvest_time>

+         <access_registration> </access_registration>

+         <access_status> </access_status>

+      </article>

+      <article code="13480897">

+         <url>http://c.moreover.com/click/here.pl?x13480896</url>

+         <headline_text>COOP Switzerland Selects Mercator as Integration Platform</headline_text>

+         <source>Stockhouse Canada</source>

+         <media_type>text</media_type>

+         <cluster>moreover...</cluster>

+         <tagline> </tagline>

+         <document_url>http://www.stockhouse.ca/news/</document_url>

+         <harvest_time>Dec 21 2000  1:55PM</harvest_time>

+         <access_registration> </access_registration>

+         <access_status> </access_status>

+      </article>

+      <article code="13471024">

+         <url>http://c.moreover.com/click/here.pl?x13471023</url>

+         <headline_text>Competing XML Specs Move Toward a Union</headline_text>

+         <source>Internet World</source>

+         <media_type>text</media_type>

+         <cluster>moreover...</cluster>

+         <tagline> </tagline>

+         <document_url>http://www.internetworld.com/</document_url>

+         <harvest_time>Dec 21 2000 11:14AM</harvest_time>

+         <access_registration> </access_registration>

+         <access_status> </access_status>

+      </article>

+      <article code="13452281">

+         <url>http://c.moreover.com/click/here.pl?x13452280</url>

+         <headline_text>Next-generation XHTML stripped down for handhelds</headline_text>

+         <source>CNET</source>

+         <media_type>text</media_type>

+         <cluster>moreover...</cluster>

+         <tagline> </tagline>

+         <document_url>http://news.cnet.com/news/0-1005.html?tag=st.ne.1002.dir.1005</document_url>

+         <harvest_time>Dec 20 2000  9:11PM</harvest_time>

+         <access_registration> </access_registration>

+         <access_status> </access_status>

+      </article>

+      <article code="13451791">

+         <url>http://c.moreover.com/click/here.pl?x13451789</url>

+         <headline_text>Xml Powers Oracle9i(TM) Dynamic Services</headline_text>

+         <source>Java Industry Connection</source>

+         <media_type>text</media_type>

+         <cluster>moreover...</cluster>

+         <tagline> </tagline>

+         <document_url>http://industry.java.sun.com/javanews/more/hotnews/</document_url>

+         <harvest_time>Dec 20 2000  9:05PM</harvest_time>

+         <access_registration> </access_registration>

+         <access_status> </access_status>

+      </article>

+      <article code="13442098">

+         <url>http://c.moreover.com/click/here.pl?x13442097</url>

+         <headline_text>XML DOM reference guide</headline_text>

+         <source>ASPWire</source>

+         <media_type>text</media_type>

+         <cluster>moreover...</cluster>

+         <tagline> </tagline>

+         <document_url>http://aspwire.com/</document_url>

+         <harvest_time>Dec 20 2000  6:26PM</harvest_time>

+         <access_registration> </access_registration>

+         <access_status> </access_status>

+      </article>

+      <article code="13424118">

+         <url>http://c.moreover.com/click/here.pl?x13424117</url>

+         <headline_text>Repeat/Xqsite And Bowstreet Team to Deliver Integrated Xml Solutions</headline_text>

+         <source>Java Industry Connection</source>

+         <media_type>text</media_type>

+         <cluster>moreover...</cluster>

+         <tagline> </tagline>

+         <document_url>http://industry.java.sun.com/javanews/more/hotnews/</document_url>

+         <harvest_time>Dec 20 2000  9:04AM</harvest_time>

+         <access_registration> </access_registration>

+         <access_status> </access_status>

+      </article>

+    </moreovernews>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/xml/much_ado.xml b/axiom/modules/axiom-tests/test-resources/xml/much_ado.xml
new file mode 100644
index 0000000..2909267
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/much_ado.xml
@@ -0,0 +1,6850 @@
+<?xml version="1.0"?>

+<PLAY>

+<TITLE>Much Ado about Nothing</TITLE>

+

+<FM>

+<P>Text placed in the public domain by Moby Lexical Tools, 1992.</P>

+<P>SGML markup by Jon Bosak, 1992-1994.</P>

+<P>XML version by Jon Bosak, 1996-1998.</P>

+<P>This work may be freely copied and distributed worldwide.</P>

+</FM>

+

+

+<PERSONAE>

+<TITLE>Dramatis Personae</TITLE>

+

+<PERSONA>DON PEDRO, prince of Arragon.</PERSONA>

+<PERSONA>DON JOHN, his bastard brother.</PERSONA>

+<PERSONA>CLAUDIO, a young lord of Florence.</PERSONA>

+<PERSONA>BENEDICK, a young lord of Padua.</PERSONA>

+<PERSONA>LEONATO, governor of Messina.</PERSONA>

+<PERSONA>ANTONIO, his brother.</PERSONA>

+<PERSONA>BALTHASAR, attendant on Don Pedro.</PERSONA>

+

+<PGROUP>

+<PERSONA>CONRADE</PERSONA>

+<PERSONA>BORACHIO</PERSONA>

+<GRPDESCR>followers of Don John.</GRPDESCR>

+</PGROUP>

+

+<PERSONA>FRIAR FRANCIS</PERSONA>

+<PERSONA>DOGBERRY, a constable.</PERSONA>

+<PERSONA>VERGES, a headborough.</PERSONA>

+<PERSONA>A Sexton.</PERSONA>

+<PERSONA>A Boy.</PERSONA>

+<PERSONA>HERO, daughter to Leonato.</PERSONA>

+<PERSONA>BEATRICE, niece to Leonato.</PERSONA>

+

+<PGROUP>

+<PERSONA>MARGARET</PERSONA>

+<PERSONA>URSULA</PERSONA>

+<GRPDESCR>gentlewomen attending on Hero.</GRPDESCR>

+</PGROUP>

+

+<PERSONA>Messengers, Watch, Attendants, &amp;c. </PERSONA>

+</PERSONAE>

+

+<SCNDESCR>SCENE  Messina.</SCNDESCR>

+

+<PLAYSUBT>MUCH ADO ABOUT NOTHING</PLAYSUBT>

+

+<ACT><TITLE>ACT I</TITLE>

+

+<SCENE><TITLE>SCENE I.  Before LEONATO'S house.</TITLE>

+<STAGEDIR>Enter LEONATO, HERO, and BEATRICE, with a

+Messenger</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>I learn in this letter that Don Peter of Arragon</LINE>

+<LINE>comes this night to Messina.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Messenger</SPEAKER>

+<LINE>He is very near by this: he was not three leagues off</LINE>

+<LINE>when I left him.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>How many gentlemen have you lost in this action?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Messenger</SPEAKER>

+<LINE>But few of any sort, and none of name.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>A victory is twice itself when the achiever brings</LINE>

+<LINE>home full numbers. I find here that Don Peter hath</LINE>

+<LINE>bestowed much honour on a young Florentine called Claudio.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Messenger</SPEAKER>

+<LINE>Much deserved on his part and equally remembered by</LINE>

+<LINE>Don Pedro: he hath borne himself beyond the</LINE>

+<LINE>promise of his age, doing, in the figure of a lamb,</LINE>

+<LINE>the feats of a lion: he hath indeed better</LINE>

+<LINE>bettered expectation than you must expect of me to</LINE>

+<LINE>tell you how.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>He hath an uncle here in Messina will be very much</LINE>

+<LINE>glad of it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Messenger</SPEAKER>

+<LINE>I have already delivered him letters, and there</LINE>

+<LINE>appears much joy in him; even so much that joy could</LINE>

+<LINE>not show itself modest enough without a badge of</LINE>

+<LINE>bitterness.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Did he break out into tears?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Messenger</SPEAKER>

+<LINE>In great measure.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>A kind overflow of kindness: there are no faces</LINE>

+<LINE>truer than those that are so washed. How much</LINE>

+<LINE>better is it to weep at joy than to joy at weeping!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>I pray you, is Signior Mountanto returned from the</LINE>

+<LINE>wars or no?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Messenger</SPEAKER>

+<LINE>I know none of that name, lady: there was none such</LINE>

+<LINE>in the army of any sort.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>What is he that you ask for, niece?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>My cousin means Signior Benedick of Padua.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Messenger</SPEAKER>

+<LINE>O, he's returned; and as pleasant as ever he was.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>He set up his bills here in Messina and challenged</LINE>

+<LINE>Cupid at the flight; and my uncle's fool, reading</LINE>

+<LINE>the challenge, subscribed for Cupid, and challenged</LINE>

+<LINE>him at the bird-bolt. I pray you, how many hath he</LINE>

+<LINE>killed and eaten in these wars? But how many hath</LINE>

+<LINE>he killed? for indeed I promised to eat all of his killing.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Faith, niece, you tax Signior Benedick too much;</LINE>

+<LINE>but he'll be meet with you, I doubt it not.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Messenger</SPEAKER>

+<LINE>He hath done good service, lady, in these wars.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>You had musty victual, and he hath holp to eat it:</LINE>

+<LINE>he is a very valiant trencherman; he hath an</LINE>

+<LINE>excellent stomach.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Messenger</SPEAKER>

+<LINE>And a good soldier too, lady.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>And a good soldier to a lady: but what is he to a lord?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Messenger</SPEAKER>

+<LINE>A lord to a lord, a man to a man; stuffed with all</LINE>

+<LINE>honourable virtues.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>It is so, indeed; he is no less than a stuffed man:</LINE>

+<LINE>but for the stuffing,--well, we are all mortal.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>You must not, sir, mistake my niece. There is a</LINE>

+<LINE>kind of merry war betwixt Signior Benedick and her:</LINE>

+<LINE>they never meet but there's a skirmish of wit</LINE>

+<LINE>between them.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Alas! he gets nothing by that. In our last</LINE>

+<LINE>conflict four of his five wits went halting off, and</LINE>

+<LINE>now is the whole man governed with one: so that if</LINE>

+<LINE>he have wit enough to keep himself warm, let him</LINE>

+<LINE>bear it for a difference between himself and his</LINE>

+<LINE>horse; for it is all the wealth that he hath left,</LINE>

+<LINE>to be known a reasonable creature. Who is his</LINE>

+<LINE>companion now? He hath every month a new sworn brother.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Messenger</SPEAKER>

+<LINE>Is't possible?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Very easily possible: he wears his faith but as</LINE>

+<LINE>the fashion of his hat; it ever changes with the</LINE>

+<LINE>next block.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Messenger</SPEAKER>

+<LINE>I see, lady, the gentleman is not in your books.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>No; an he were, I would burn my study. But, I pray</LINE>

+<LINE>you, who is his companion? Is there no young</LINE>

+<LINE>squarer now that will make a voyage with him to the devil?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Messenger</SPEAKER>

+<LINE>He is most in the company of the right noble Claudio.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>O Lord, he will hang upon him like a disease: he</LINE>

+<LINE>is sooner caught than the pestilence, and the taker</LINE>

+<LINE>runs presently mad. God help the noble Claudio! if</LINE>

+<LINE>he have caught the Benedick, it will cost him a</LINE>

+<LINE>thousand pound ere a' be cured.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Messenger</SPEAKER>

+<LINE>I will hold friends with you, lady.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Do, good friend.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>You will never run mad, niece.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>No, not till a hot January.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Messenger</SPEAKER>

+<LINE>Don Pedro is approached.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Enter DON PEDRO, DON JOHN, CLAUDIO, BENEDICK,

+and BALTHASAR</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Good Signior Leonato, you are come to meet your</LINE>

+<LINE>trouble: the fashion of the world is to avoid</LINE>

+<LINE>cost, and you encounter it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Never came trouble to my house in the likeness of</LINE>

+<LINE>your grace: for trouble being gone, comfort should</LINE>

+<LINE>remain; but when you depart from me, sorrow abides</LINE>

+<LINE>and happiness takes his leave.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>You embrace your charge too willingly. I think this</LINE>

+<LINE>is your daughter.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Her mother hath many times told me so.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Were you in doubt, sir, that you asked her?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Signior Benedick, no; for then were you a child.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>You have it full, Benedick: we may guess by this</LINE>

+<LINE>what you are, being a man. Truly, the lady fathers</LINE>

+<LINE>herself. Be happy, lady; for you are like an</LINE>

+<LINE>honourable father.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>If Signior Leonato be her father, she would not</LINE>

+<LINE>have his head on her shoulders for all Messina, as</LINE>

+<LINE>like him as she is.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>I wonder that you will still be talking, Signior</LINE>

+<LINE>Benedick: nobody marks you.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>What, my dear Lady Disdain! are you yet living?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Is it possible disdain should die while she hath</LINE>

+<LINE>such meet food to feed it as Signior Benedick?</LINE>

+<LINE>Courtesy itself must convert to disdain, if you come</LINE>

+<LINE>in her presence.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Then is courtesy a turncoat. But it is certain I</LINE>

+<LINE>am loved of all ladies, only you excepted: and I</LINE>

+<LINE>would I could find in my heart that I had not a hard</LINE>

+<LINE>heart; for, truly, I love none.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>A dear happiness to women: they would else have</LINE>

+<LINE>been troubled with a pernicious suitor. I thank God</LINE>

+<LINE>and my cold blood, I am of your humour for that: I</LINE>

+<LINE>had rather hear my dog bark at a crow than a man</LINE>

+<LINE>swear he loves me.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>God keep your ladyship still in that mind! so some</LINE>

+<LINE>gentleman or other shall 'scape a predestinate</LINE>

+<LINE>scratched face.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Scratching could not make it worse, an 'twere such</LINE>

+<LINE>a face as yours were.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Well, you are a rare parrot-teacher.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>A bird of my tongue is better than a beast of yours.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>I would my horse had the speed of your tongue, and</LINE>

+<LINE>so good a continuer. But keep your way, i' God's</LINE>

+<LINE>name; I have done.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>You always end with a jade's trick: I know you of old.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>That is the sum of all, Leonato. Signior Claudio</LINE>

+<LINE>and Signior Benedick, my dear friend Leonato hath</LINE>

+<LINE>invited you all. I tell him we shall stay here at</LINE>

+<LINE>the least a month; and he heartily prays some</LINE>

+<LINE>occasion may detain us longer. I dare swear he is no</LINE>

+<LINE>hypocrite, but prays from his heart.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>If you swear, my lord, you shall not be forsworn.</LINE>

+<STAGEDIR>To DON JOHN</STAGEDIR>

+<LINE>Let me bid you welcome, my lord: being reconciled to</LINE>

+<LINE>the prince your brother, I owe you all duty.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>I thank you: I am not of many words, but I thank</LINE>

+<LINE>you.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Please it your grace lead on?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Your hand, Leonato; we will go together.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt all except BENEDICK and CLAUDIO</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Benedick, didst thou note the daughter of Signior Leonato?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>I noted her not; but I looked on her.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Is she not a modest young lady?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Do you question me, as an honest man should do, for</LINE>

+<LINE>my simple true judgment; or would you have me speak</LINE>

+<LINE>after my custom, as being a professed tyrant to their sex?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>No; I pray thee speak in sober judgment.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Why, i' faith, methinks she's too low for a high</LINE>

+<LINE>praise, too brown for a fair praise and too little</LINE>

+<LINE>for a great praise: only this commendation I can</LINE>

+<LINE>afford her, that were she other than she is, she</LINE>

+<LINE>were unhandsome; and being no other but as she is, I</LINE>

+<LINE>do not like her.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Thou thinkest I am in sport: I pray thee tell me</LINE>

+<LINE>truly how thou likest her.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Would you buy her, that you inquire after her?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Can the world buy such a jewel?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Yea, and a case to put it into. But speak you this</LINE>

+<LINE>with a sad brow? or do you play the flouting Jack,</LINE>

+<LINE>to tell us Cupid is a good hare-finder and Vulcan a</LINE>

+<LINE>rare carpenter? Come, in what key shall a man take</LINE>

+<LINE>you, to go in the song?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>In mine eye she is the sweetest lady that ever I</LINE>

+<LINE>looked on.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>I can see yet without spectacles and I see no such</LINE>

+<LINE>matter: there's her cousin, an she were not</LINE>

+<LINE>possessed with a fury, exceeds her as much in beauty</LINE>

+<LINE>as the first of May doth the last of December. But I</LINE>

+<LINE>hope you have no intent to turn husband, have you?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>I would scarce trust myself, though I had sworn the</LINE>

+<LINE>contrary, if Hero would be my wife.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Is't come to this? In faith, hath not the world</LINE>

+<LINE>one man but he will wear his cap with suspicion?</LINE>

+<LINE>Shall I never see a bachelor of three-score again?</LINE>

+<LINE>Go to, i' faith; an thou wilt needs thrust thy neck</LINE>

+<LINE>into a yoke, wear the print of it and sigh away</LINE>

+<LINE>Sundays. Look Don Pedro is returned to seek you.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Re-enter DON PEDRO</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>What secret hath held you here, that you followed</LINE>

+<LINE>not to Leonato's?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>I would your grace would constrain me to tell.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>I charge thee on thy allegiance.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>You hear, Count Claudio: I can be secret as a dumb</LINE>

+<LINE>man; I would have you think so; but, on my</LINE>

+<LINE>allegiance, mark you this, on my allegiance. He is</LINE>

+<LINE>in love. With who? now that is your grace's part.</LINE>

+<LINE>Mark how short his answer is;--With Hero, Leonato's</LINE>

+<LINE>short daughter.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>If this were so, so were it uttered.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Like the old tale, my lord: 'it is not so, nor</LINE>

+<LINE>'twas not so, but, indeed, God forbid it should be</LINE>

+<LINE>so.'</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>If my passion change not shortly, God forbid it</LINE>

+<LINE>should be otherwise.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Amen, if you love her; for the lady is very well worthy.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>You speak this to fetch me in, my lord.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>By my troth, I speak my thought.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>And, in faith, my lord, I spoke mine.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>And, by my two faiths and troths, my lord, I spoke mine.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>That I love her, I feel.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>That she is worthy, I know.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>That I neither feel how she should be loved nor</LINE>

+<LINE>know how she should be worthy, is the opinion that</LINE>

+<LINE>fire cannot melt out of me: I will die in it at the stake.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Thou wast ever an obstinate heretic in the despite</LINE>

+<LINE>of beauty.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>And never could maintain his part but in the force</LINE>

+<LINE>of his will.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>That a woman conceived me, I thank her; that she</LINE>

+<LINE>brought me up, I likewise give her most humble</LINE>

+<LINE>thanks: but that I will have a recheat winded in my</LINE>

+<LINE>forehead, or hang my bugle in an invisible baldrick,</LINE>

+<LINE>all women shall pardon me. Because I will not do</LINE>

+<LINE>them the wrong to mistrust any, I will do myself the</LINE>

+<LINE>right to trust none; and the fine is, for the which</LINE>

+<LINE>I may go the finer, I will live a bachelor.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>I shall see thee, ere I die, look pale with love.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>With anger, with sickness, or with hunger, my lord,</LINE>

+<LINE>not with love: prove that ever I lose more blood</LINE>

+<LINE>with love than I will get again with drinking, pick</LINE>

+<LINE>out mine eyes with a ballad-maker's pen and hang me</LINE>

+<LINE>up at the door of a brothel-house for the sign of</LINE>

+<LINE>blind Cupid.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Well, if ever thou dost fall from this faith, thou</LINE>

+<LINE>wilt prove a notable argument.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>If I do, hang me in a bottle like a cat and shoot</LINE>

+<LINE>at me; and he that hits me, let him be clapped on</LINE>

+<LINE>the shoulder, and called Adam.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Well, as time shall try: 'In time the savage bull</LINE>

+<LINE>doth bear the yoke.'</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>The savage bull may; but if ever the sensible</LINE>

+<LINE>Benedick bear it, pluck off the bull's horns and set</LINE>

+<LINE>them in my forehead: and let me be vilely painted,</LINE>

+<LINE>and in such great letters as they write 'Here is</LINE>

+<LINE>good horse to hire,' let them signify under my sign</LINE>

+<LINE>'Here you may see Benedick the married man.'</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>If this should ever happen, thou wouldst be horn-mad.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Nay, if Cupid have not spent all his quiver in</LINE>

+<LINE>Venice, thou wilt quake for this shortly.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>I look for an earthquake too, then.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Well, you temporize with the hours. In the</LINE>

+<LINE>meantime, good Signior Benedick, repair to</LINE>

+<LINE>Leonato's: commend me to him and tell him I will</LINE>

+<LINE>not fail him at supper; for indeed he hath made</LINE>

+<LINE>great preparation.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>I have almost matter enough in me for such an</LINE>

+<LINE>embassage; and so I commit you--</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>To the tuition of God: From my house, if I had it,--</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>The sixth of July: Your loving friend, Benedick.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Nay, mock not, mock not. The body of your</LINE>

+<LINE>discourse is sometime guarded with fragments, and</LINE>

+<LINE>the guards are but slightly basted on neither: ere</LINE>

+<LINE>you flout old ends any further, examine your</LINE>

+<LINE>conscience: and so I leave you.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exit</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>My liege, your highness now may do me good.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>My love is thine to teach: teach it but how,</LINE>

+<LINE>And thou shalt see how apt it is to learn</LINE>

+<LINE>Any hard lesson that may do thee good.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Hath Leonato any son, my lord?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>No child but Hero; she's his only heir.</LINE>

+<LINE>Dost thou affect her, Claudio?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>O, my lord,</LINE>

+<LINE>When you went onward on this ended action,</LINE>

+<LINE>I look'd upon her with a soldier's eye,</LINE>

+<LINE>That liked, but had a rougher task in hand</LINE>

+<LINE>Than to drive liking to the name of love:</LINE>

+<LINE>But now I am return'd and that war-thoughts</LINE>

+<LINE>Have left their places vacant, in their rooms</LINE>

+<LINE>Come thronging soft and delicate desires,</LINE>

+<LINE>All prompting me how fair young Hero is,</LINE>

+<LINE>Saying, I liked her ere I went to wars.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Thou wilt be like a lover presently</LINE>

+<LINE>And tire the hearer with a book of words.</LINE>

+<LINE>If thou dost love fair Hero, cherish it,</LINE>

+<LINE>And I will break with her and with her father,</LINE>

+<LINE>And thou shalt have her. Was't not to this end</LINE>

+<LINE>That thou began'st to twist so fine a story?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>How sweetly you do minister to love,</LINE>

+<LINE>That know love's grief by his complexion!</LINE>

+<LINE>But lest my liking might too sudden seem,</LINE>

+<LINE>I would have salved it with a longer treatise.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>What need the bridge much broader than the flood?</LINE>

+<LINE>The fairest grant is the necessity.</LINE>

+<LINE>Look, what will serve is fit: 'tis once, thou lovest,</LINE>

+<LINE>And I will fit thee with the remedy.</LINE>

+<LINE>I know we shall have revelling to-night:</LINE>

+<LINE>I will assume thy part in some disguise</LINE>

+<LINE>And tell fair Hero I am Claudio,</LINE>

+<LINE>And in her bosom I'll unclasp my heart</LINE>

+<LINE>And take her hearing prisoner with the force</LINE>

+<LINE>And strong encounter of my amorous tale:</LINE>

+<LINE>Then after to her father will I break;</LINE>

+<LINE>And the conclusion is, she shall be thine.</LINE>

+<LINE>In practise let us put it presently.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt</STAGEDIR>

+</SCENE>

+

+<SCENE><TITLE>SCENE II.  A room in LEONATO's house.</TITLE>

+<STAGEDIR>Enter LEONATO and ANTONIO, meeting</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>How now, brother! Where is my cousin, your son?</LINE>

+<LINE>hath he provided this music?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>He is very busy about it. But, brother, I can tell</LINE>

+<LINE>you strange news that you yet dreamt not of.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Are they good?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>As the event stamps them: but they have a good</LINE>

+<LINE>cover; they show well outward. The prince and Count</LINE>

+<LINE>Claudio, walking in a thick-pleached alley in mine</LINE>

+<LINE>orchard, were thus much overheard by a man of mine:</LINE>

+<LINE>the prince discovered to Claudio that he loved my</LINE>

+<LINE>niece your daughter and meant to acknowledge it</LINE>

+<LINE>this night in a dance: and if he found her</LINE>

+<LINE>accordant, he meant to take the present time by the</LINE>

+<LINE>top and instantly break with you of it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Hath the fellow any wit that told you this?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>A good sharp fellow: I will send for him; and</LINE>

+<LINE>question him yourself.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>No, no; we will hold it as a dream till it appear</LINE>

+<LINE>itself: but I will acquaint my daughter withal,</LINE>

+<LINE>that she may be the better prepared for an answer,</LINE>

+<LINE>if peradventure this be true. Go you and tell her of it.</LINE>

+<STAGEDIR>Enter Attendants</STAGEDIR>

+<LINE>Cousins, you know what you have to do. O, I cry you</LINE>

+<LINE>mercy, friend; go you with me, and I will use your</LINE>

+<LINE>skill. Good cousin, have a care this busy time.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt</STAGEDIR>

+</SCENE>

+

+<SCENE><TITLE>SCENE III.  The same.</TITLE>

+<STAGEDIR>Enter DON JOHN and CONRADE</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>What the good-year, my lord! why are you thus out</LINE>

+<LINE>of measure sad?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>There is no measure in the occasion that breeds;</LINE>

+<LINE>therefore the sadness is without limit.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>You should hear reason.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>And when I have heard it, what blessing brings it?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>If not a present remedy, at least a patient</LINE>

+<LINE>sufferance.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>I wonder that thou, being, as thou sayest thou art,</LINE>

+<LINE>born under Saturn, goest about to apply a moral</LINE>

+<LINE>medicine to a mortifying mischief. I cannot hide</LINE>

+<LINE>what I am: I must be sad when I have cause and smile</LINE>

+<LINE>at no man's jests, eat when I have stomach and wait</LINE>

+<LINE>for no man's leisure, sleep when I am drowsy and</LINE>

+<LINE>tend on no man's business, laugh when I am merry and</LINE>

+<LINE>claw no man in his humour.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>Yea, but you must not make the full show of this</LINE>

+<LINE>till you may do it without controlment. You have of</LINE>

+<LINE>late stood out against your brother, and he hath</LINE>

+<LINE>ta'en you newly into his grace; where it is</LINE>

+<LINE>impossible you should take true root but by the</LINE>

+<LINE>fair weather that you make yourself: it is needful</LINE>

+<LINE>that you frame the season for your own harvest.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>I had rather be a canker in a hedge than a rose in</LINE>

+<LINE>his grace, and it better fits my blood to be</LINE>

+<LINE>disdained of all than to fashion a carriage to rob</LINE>

+<LINE>love from any: in this, though I cannot be said to</LINE>

+<LINE>be a flattering honest man, it must not be denied</LINE>

+<LINE>but I am a plain-dealing villain. I am trusted with</LINE>

+<LINE>a muzzle and enfranchised with a clog; therefore I</LINE>

+<LINE>have decreed not to sing in my cage. If I had my</LINE>

+<LINE>mouth, I would bite; if I had my liberty, I would do</LINE>

+<LINE>my liking: in the meantime let me be that I am and</LINE>

+<LINE>seek not to alter me.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>Can you make no use of your discontent?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>I make all use of it, for I use it only.</LINE>

+<LINE>Who comes here?</LINE>

+<STAGEDIR>Enter BORACHIO</STAGEDIR>

+<LINE>What news, Borachio?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>I came yonder from a great supper: the prince your</LINE>

+<LINE>brother is royally entertained by Leonato: and I</LINE>

+<LINE>can give you intelligence of an intended marriage.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>Will it serve for any model to build mischief on?</LINE>

+<LINE>What is he for a fool that betroths himself to</LINE>

+<LINE>unquietness?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Marry, it is your brother's right hand.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>Who? the most exquisite Claudio?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Even he.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>A proper squire! And who, and who? which way looks</LINE>

+<LINE>he?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Marry, on Hero, the daughter and heir of Leonato.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>A very forward March-chick! How came you to this?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Being entertained for a perfumer, as I was smoking a</LINE>

+<LINE>musty room, comes me the prince and Claudio, hand</LINE>

+<LINE>in hand in sad conference: I whipt me behind the</LINE>

+<LINE>arras; and there heard it agreed upon that the</LINE>

+<LINE>prince should woo Hero for himself, and having</LINE>

+<LINE>obtained her, give her to Count Claudio.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>Come, come, let us thither: this may prove food to</LINE>

+<LINE>my displeasure. That young start-up hath all the</LINE>

+<LINE>glory of my overthrow: if I can cross him any way, I</LINE>

+<LINE>bless myself every way. You are both sure, and will assist me?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>To the death, my lord.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>Let us to the great supper: their cheer is the</LINE>

+<LINE>greater that I am subdued. Would the cook were of</LINE>

+<LINE>my mind! Shall we go prove what's to be done?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>We'll wait upon your lordship.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt</STAGEDIR>

+</SCENE>

+

+</ACT>

+

+<ACT><TITLE>ACT II</TITLE>

+

+<SCENE><TITLE>SCENE I.  A hall in LEONATO'S house.</TITLE>

+<STAGEDIR>Enter LEONATO, ANTONIO, HERO, BEATRICE, and others</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Was not Count John here at supper?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>I saw him not.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>How tartly that gentleman looks! I never can see</LINE>

+<LINE>him but I am heart-burned an hour after.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>He is of a very melancholy disposition.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>He were an excellent man that were made just in the</LINE>

+<LINE>midway between him and Benedick: the one is too</LINE>

+<LINE>like an image and says nothing, and the other too</LINE>

+<LINE>like my lady's eldest son, evermore tattling.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Then half Signior Benedick's tongue in Count John's</LINE>

+<LINE>mouth, and half Count John's melancholy in Signior</LINE>

+<LINE>Benedick's face,--</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>With a good leg and a good foot, uncle, and money</LINE>

+<LINE>enough in his purse, such a man would win any woman</LINE>

+<LINE>in the world, if a' could get her good-will.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>By my troth, niece, thou wilt never get thee a</LINE>

+<LINE>husband, if thou be so shrewd of thy tongue.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>In faith, she's too curst.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Too curst is more than curst: I shall lessen God's</LINE>

+<LINE>sending that way; for it is said, 'God sends a curst</LINE>

+<LINE>cow short horns;' but to a cow too curst he sends none.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>So, by being too curst, God will send you no horns.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Just, if he send me no husband; for the which</LINE>

+<LINE>blessing I am at him upon my knees every morning and</LINE>

+<LINE>evening. Lord, I could not endure a husband with a</LINE>

+<LINE>beard on his face: I had rather lie in the woollen.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>You may light on a husband that hath no beard.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>What should I do with him? dress him in my apparel</LINE>

+<LINE>and make him my waiting-gentlewoman? He that hath a</LINE>

+<LINE>beard is more than a youth, and he that hath no</LINE>

+<LINE>beard is less than a man: and he that is more than</LINE>

+<LINE>a youth is not for me, and he that is less than a</LINE>

+<LINE>man, I am not for him: therefore, I will even take</LINE>

+<LINE>sixpence in earnest of the bear-ward, and lead his</LINE>

+<LINE>apes into hell.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Well, then, go you into hell?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>No, but to the gate; and there will the devil meet</LINE>

+<LINE>me, like an old cuckold, with horns on his head, and</LINE>

+<LINE>say 'Get you to heaven, Beatrice, get you to</LINE>

+<LINE>heaven; here's no place for you maids:' so deliver</LINE>

+<LINE>I up my apes, and away to Saint Peter for the</LINE>

+<LINE>heavens; he shows me where the bachelors sit, and</LINE>

+<LINE>there live we as merry as the day is long.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE><STAGEDIR>To HERO</STAGEDIR>  Well, niece, I trust you will be ruled</LINE>

+<LINE>by your father.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Yes, faith; it is my cousin's duty to make curtsy</LINE>

+<LINE>and say 'Father, as it please you.' But yet for all</LINE>

+<LINE>that, cousin, let him be a handsome fellow, or else</LINE>

+<LINE>make another curtsy and say 'Father, as it please</LINE>

+<LINE>me.'</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Well, niece, I hope to see you one day fitted with a husband.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Not till God make men of some other metal than</LINE>

+<LINE>earth. Would it not grieve a woman to be</LINE>

+<LINE>overmastered with a pierce of valiant dust? to make</LINE>

+<LINE>an account of her life to a clod of wayward marl?</LINE>

+<LINE>No, uncle, I'll none: Adam's sons are my brethren;</LINE>

+<LINE>and, truly, I hold it a sin to match in my kindred.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Daughter, remember what I told you: if the prince</LINE>

+<LINE>do solicit you in that kind, you know your answer.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>The fault will be in the music, cousin, if you be</LINE>

+<LINE>not wooed in good time: if the prince be too</LINE>

+<LINE>important, tell him there is measure in every thing</LINE>

+<LINE>and so dance out the answer. For, hear me, Hero:</LINE>

+<LINE>wooing, wedding, and repenting, is as a Scotch jig,</LINE>

+<LINE>a measure, and a cinque pace: the first suit is hot</LINE>

+<LINE>and hasty, like a Scotch jig, and full as</LINE>

+<LINE>fantastical; the wedding, mannerly-modest, as a</LINE>

+<LINE>measure, full of state and ancientry; and then comes</LINE>

+<LINE>repentance and, with his bad legs, falls into the</LINE>

+<LINE>cinque pace faster and faster, till he sink into his grave.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Cousin, you apprehend passing shrewdly.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>I have a good eye, uncle; I can see a church by daylight.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>The revellers are entering, brother: make good room.</LINE>

+</SPEECH>

+

+<STAGEDIR>All put on their masks</STAGEDIR>

+<STAGEDIR>Enter DON PEDRO, CLAUDIO, BENEDICK, BALTHASAR,

+DON JOHN, BORACHIO, MARGARET, URSULA and others, masked</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Lady, will you walk about with your friend?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>So you walk softly and look sweetly and say nothing,</LINE>

+<LINE>I am yours for the walk; and especially when I walk away.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>With me in your company?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>I may say so, when I please.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>And when please you to say so?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>When I like your favour; for God defend the lute</LINE>

+<LINE>should be like the case!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>My visor is Philemon's roof; within the house is Jove.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>Why, then, your visor should be thatched.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Speak low, if you speak love.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Drawing her aside</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>BALTHASAR</SPEAKER>

+<LINE>Well, I would you did like me.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>So would not I, for your own sake; for I have many</LINE>

+<LINE>ill-qualities.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BALTHASAR</SPEAKER>

+<LINE>Which is one?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>I say my prayers aloud.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BALTHASAR</SPEAKER>

+<LINE>I love you the better: the hearers may cry, Amen.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>God match me with a good dancer!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BALTHASAR</SPEAKER>

+<LINE>Amen.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>And God keep him out of my sight when the dance is</LINE>

+<LINE>done! Answer, clerk.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BALTHASAR</SPEAKER>

+<LINE>No more words: the clerk is answered.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>URSULA</SPEAKER>

+<LINE>I know you well enough; you are Signior Antonio.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>At a word, I am not.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>URSULA</SPEAKER>

+<LINE>I know you by the waggling of your head.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>To tell you true, I counterfeit him.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>URSULA</SPEAKER>

+<LINE>You could never do him so ill-well, unless you were</LINE>

+<LINE>the very man. Here's his dry hand up and down: you</LINE>

+<LINE>are he, you are he.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>At a word, I am not.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>URSULA</SPEAKER>

+<LINE>Come, come, do you think I do not know you by your</LINE>

+<LINE>excellent wit? can virtue hide itself? Go to,</LINE>

+<LINE>mum, you are he: graces will appear, and there's an</LINE>

+<LINE>end.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Will you not tell me who told you so?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>No, you shall pardon me.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Nor will you not tell me who you are?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Not now.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>That I was disdainful, and that I had my good wit</LINE>

+<LINE>out of the 'Hundred Merry Tales:'--well this was</LINE>

+<LINE>Signior Benedick that said so.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>What's he?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>I am sure you know him well enough.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Not I, believe me.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Did he never make you laugh?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>I pray you, what is he?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Why, he is the prince's jester: a very dull fool;</LINE>

+<LINE>only his gift is in devising impossible slanders:</LINE>

+<LINE>none but libertines delight in him; and the</LINE>

+<LINE>commendation is not in his wit, but in his villany;</LINE>

+<LINE>for he both pleases men and angers them, and then</LINE>

+<LINE>they laugh at him and beat him. I am sure he is in</LINE>

+<LINE>the fleet: I would he had boarded me.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>When I know the gentleman, I'll tell him what you say.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Do, do: he'll but break a comparison or two on me;</LINE>

+<LINE>which, peradventure not marked or not laughed at,</LINE>

+<LINE>strikes him into melancholy; and then there's a</LINE>

+<LINE>partridge wing saved, for the fool will eat no</LINE>

+<LINE>supper that night.</LINE>

+<STAGEDIR>Music</STAGEDIR>

+<LINE>We must follow the leaders.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>In every good thing.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Nay, if they lead to any ill, I will leave them at</LINE>

+<LINE>the next turning.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Dance. Then exeunt all except DON JOHN, BORACHIO,

+and CLAUDIO</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>Sure my brother is amorous on Hero and hath</LINE>

+<LINE>withdrawn her father to break with him about it.</LINE>

+<LINE>The ladies follow her and but one visor remains.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>And that is Claudio: I know him by his bearing.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>Are not you Signior Benedick?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>You know me well; I am he.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>Signior, you are very near my brother in his love:</LINE>

+<LINE>he is enamoured on Hero; I pray you, dissuade him</LINE>

+<LINE>from her: she is no equal for his birth: you may</LINE>

+<LINE>do the part of an honest man in it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>How know you he loves her?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>I heard him swear his affection.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>So did I too; and he swore he would marry her to-night.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>Come, let us to the banquet.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt DON JOHN and BORACHIO</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Thus answer I in the name of Benedick,</LINE>

+<LINE>But hear these ill news with the ears of Claudio.</LINE>

+<LINE>'Tis certain so; the prince wooes for himself.</LINE>

+<LINE>Friendship is constant in all other things</LINE>

+<LINE>Save in the office and affairs of love:</LINE>

+<LINE>Therefore, all hearts in love use their own tongues;</LINE>

+<LINE>Let every eye negotiate for itself</LINE>

+<LINE>And trust no agent; for beauty is a witch</LINE>

+<LINE>Against whose charms faith melteth into blood.</LINE>

+<LINE>This is an accident of hourly proof,</LINE>

+<LINE>Which I mistrusted not. Farewell, therefore, Hero!</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Re-enter BENEDICK</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Count Claudio?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Yea, the same.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Come, will you go with me?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Whither?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Even to the next willow, about your own business,</LINE>

+<LINE>county. What fashion will you wear the garland of?</LINE>

+<LINE>about your neck, like an usurer's chain? or under</LINE>

+<LINE>your arm, like a lieutenant's scarf? You must wear</LINE>

+<LINE>it one way, for the prince hath got your Hero.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>I wish him joy of her.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Why, that's spoken like an honest drovier: so they</LINE>

+<LINE>sell bullocks. But did you think the prince would</LINE>

+<LINE>have served you thus?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>I pray you, leave me.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Ho! now you strike like the blind man: 'twas the</LINE>

+<LINE>boy that stole your meat, and you'll beat the post.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>If it will not be, I'll leave you.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exit</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Alas, poor hurt fowl! now will he creep into sedges.</LINE>

+<LINE>But that my Lady Beatrice should know me, and not</LINE>

+<LINE>know me! The prince's fool! Ha? It may be I go</LINE>

+<LINE>under that title because I am merry. Yea, but so I</LINE>

+<LINE>am apt to do myself wrong; I am not so reputed: it</LINE>

+<LINE>is the base, though bitter, disposition of Beatrice</LINE>

+<LINE>that puts the world into her person and so gives me</LINE>

+<LINE>out. Well, I'll be revenged as I may.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Re-enter DON PEDRO</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Now, signior, where's the count? did you see him?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Troth, my lord, I have played the part of Lady Fame.</LINE>

+<LINE>I found him here as melancholy as a lodge in a</LINE>

+<LINE>warren: I told him, and I think I told him true,</LINE>

+<LINE>that your grace had got the good will of this young</LINE>

+<LINE>lady; and I offered him my company to a willow-tree,</LINE>

+<LINE>either to make him a garland, as being forsaken, or</LINE>

+<LINE>to bind him up a rod, as being worthy to be whipped.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>To be whipped! What's his fault?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>The flat transgression of a schoolboy, who, being</LINE>

+<LINE>overjoyed with finding a birds' nest, shows it his</LINE>

+<LINE>companion, and he steals it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Wilt thou make a trust a transgression? The</LINE>

+<LINE>transgression is in the stealer.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Yet it had not been amiss the rod had been made,</LINE>

+<LINE>and the garland too; for the garland he might have</LINE>

+<LINE>worn himself, and the rod he might have bestowed on</LINE>

+<LINE>you, who, as I take it, have stolen his birds' nest.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>I will but teach them to sing, and restore them to</LINE>

+<LINE>the owner.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>If their singing answer your saying, by my faith,</LINE>

+<LINE>you say honestly.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>The Lady Beatrice hath a quarrel to you: the</LINE>

+<LINE>gentleman that danced with her told her she is much</LINE>

+<LINE>wronged by you.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>O, she misused me past the endurance of a block!</LINE>

+<LINE>an oak but with one green leaf on it would have</LINE>

+<LINE>answered her; my very visor began to assume life and</LINE>

+<LINE>scold with her. She told me, not thinking I had been</LINE>

+<LINE>myself, that I was the prince's jester, that I was</LINE>

+<LINE>duller than a great thaw; huddling jest upon jest</LINE>

+<LINE>with such impossible conveyance upon me that I stood</LINE>

+<LINE>like a man at a mark, with a whole army shooting at</LINE>

+<LINE>me. She speaks poniards, and every word stabs:</LINE>

+<LINE>if her breath were as terrible as her terminations,</LINE>

+<LINE>there were no living near her; she would infect to</LINE>

+<LINE>the north star. I would not marry her, though she</LINE>

+<LINE>were endowed with all that Adam bad left him before</LINE>

+<LINE>he transgressed: she would have made Hercules have</LINE>

+<LINE>turned spit, yea, and have cleft his club to make</LINE>

+<LINE>the fire too. Come, talk not of her: you shall find</LINE>

+<LINE>her the infernal Ate in good apparel. I would to God</LINE>

+<LINE>some scholar would conjure her; for certainly, while</LINE>

+<LINE>she is here, a man may live as quiet in hell as in a</LINE>

+<LINE>sanctuary; and people sin upon purpose, because they</LINE>

+<LINE>would go thither; so, indeed, all disquiet, horror</LINE>

+<LINE>and perturbation follows her.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Look, here she comes.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Enter CLAUDIO, BEATRICE, HERO, and LEONATO</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Will your grace command me any service to the</LINE>

+<LINE>world's end? I will go on the slightest errand now</LINE>

+<LINE>to the Antipodes that you can devise to send me on;</LINE>

+<LINE>I will fetch you a tooth-picker now from the</LINE>

+<LINE>furthest inch of Asia, bring you the length of</LINE>

+<LINE>Prester John's foot, fetch you a hair off the great</LINE>

+<LINE>Cham's beard, do you any embassage to the Pigmies,</LINE>

+<LINE>rather than hold three words' conference with this</LINE>

+<LINE>harpy. You have no employment for me?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>None, but to desire your good company.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>O God, sir, here's a dish I love not: I cannot</LINE>

+<LINE>endure my Lady Tongue.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exit</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Come, lady, come; you have lost the heart of</LINE>

+<LINE>Signior Benedick.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Indeed, my lord, he lent it me awhile; and I gave</LINE>

+<LINE>him use for it, a double heart for his single one:</LINE>

+<LINE>marry, once before he won it of me with false dice,</LINE>

+<LINE>therefore your grace may well say I have lost it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>You have put him down, lady, you have put him down.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>So I would not he should do me, my lord, lest I</LINE>

+<LINE>should prove the mother of fools. I have brought</LINE>

+<LINE>Count Claudio, whom you sent me to seek.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Why, how now, count! wherefore are you sad?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Not sad, my lord.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>How then? sick?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Neither, my lord.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>The count is neither sad, nor sick, nor merry, nor</LINE>

+<LINE>well; but civil count, civil as an orange, and</LINE>

+<LINE>something of that jealous complexion.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>I' faith, lady, I think your blazon to be true;</LINE>

+<LINE>though, I'll be sworn, if he be so, his conceit is</LINE>

+<LINE>false. Here, Claudio, I have wooed in thy name, and</LINE>

+<LINE>fair Hero is won: I have broke with her father,</LINE>

+<LINE>and his good will obtained: name the day of</LINE>

+<LINE>marriage, and God give thee joy!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Count, take of me my daughter, and with her my</LINE>

+<LINE>fortunes: his grace hath made the match, and an</LINE>

+<LINE>grace say Amen to it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Speak, count, 'tis your cue.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Silence is the perfectest herald of joy: I were</LINE>

+<LINE>but little happy, if I could say how much. Lady, as</LINE>

+<LINE>you are mine, I am yours: I give away myself for</LINE>

+<LINE>you and dote upon the exchange.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Speak, cousin; or, if you cannot, stop his mouth</LINE>

+<LINE>with a kiss, and let not him speak neither.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>In faith, lady, you have a merry heart.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Yea, my lord; I thank it, poor fool, it keeps on</LINE>

+<LINE>the windy side of care. My cousin tells him in his</LINE>

+<LINE>ear that he is in her heart.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>And so she doth, cousin.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Good Lord, for alliance! Thus goes every one to the</LINE>

+<LINE>world but I, and I am sunburnt; I may sit in a</LINE>

+<LINE>corner and cry heigh-ho for a husband!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Lady Beatrice, I will get you one.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>I would rather have one of your father's getting.</LINE>

+<LINE>Hath your grace ne'er a brother like you? Your</LINE>

+<LINE>father got excellent husbands, if a maid could come by them.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Will you have me, lady?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>No, my lord, unless I might have another for</LINE>

+<LINE>working-days: your grace is too costly to wear</LINE>

+<LINE>every day. But, I beseech your grace, pardon me: I</LINE>

+<LINE>was born to speak all mirth and no matter.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Your silence most offends me, and to be merry best</LINE>

+<LINE>becomes you; for, out of question, you were born in</LINE>

+<LINE>a merry hour.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>No, sure, my lord, my mother cried; but then there</LINE>

+<LINE>was a star danced, and under that was I born.</LINE>

+<LINE>Cousins, God give you joy!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Niece, will you look to those things I told you of?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>I cry you mercy, uncle. By your grace's pardon.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exit</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>By my troth, a pleasant-spirited lady.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>There's little of the melancholy element in her, my</LINE>

+<LINE>lord: she is never sad but when she sleeps, and</LINE>

+<LINE>not ever sad then; for I have heard my daughter say,</LINE>

+<LINE>she hath often dreamed of unhappiness and waked</LINE>

+<LINE>herself with laughing.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>She cannot endure to hear tell of a husband.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>O, by no means: she mocks all her wooers out of suit.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>She were an excellent wife for Benedict.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>O Lord, my lord, if they were but a week married,</LINE>

+<LINE>they would talk themselves mad.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>County Claudio, when mean you to go to church?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>To-morrow, my lord: time goes on crutches till love</LINE>

+<LINE>have all his rites.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Not till Monday, my dear son, which is hence a just</LINE>

+<LINE>seven-night; and a time too brief, too, to have all</LINE>

+<LINE>things answer my mind.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Come, you shake the head at so long a breathing:</LINE>

+<LINE>but, I warrant thee, Claudio, the time shall not go</LINE>

+<LINE>dully by us. I will in the interim undertake one of</LINE>

+<LINE>Hercules' labours; which is, to bring Signior</LINE>

+<LINE>Benedick and the Lady Beatrice into a mountain of</LINE>

+<LINE>affection the one with the other. I would fain have</LINE>

+<LINE>it a match, and I doubt not but to fashion it, if</LINE>

+<LINE>you three will but minister such assistance as I</LINE>

+<LINE>shall give you direction.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>My lord, I am for you, though it cost me ten</LINE>

+<LINE>nights' watchings.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>And I, my lord.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>And you too, gentle Hero?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>I will do any modest office, my lord, to help my</LINE>

+<LINE>cousin to a good husband.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>And Benedick is not the unhopefullest husband that</LINE>

+<LINE>I know. Thus far can I praise him; he is of a noble</LINE>

+<LINE>strain, of approved valour and confirmed honesty. I</LINE>

+<LINE>will teach you how to humour your cousin, that she</LINE>

+<LINE>shall fall in love with Benedick; and I, with your</LINE>

+<LINE>two helps, will so practise on Benedick that, in</LINE>

+<LINE>despite of his quick wit and his queasy stomach, he</LINE>

+<LINE>shall fall in love with Beatrice. If we can do this,</LINE>

+<LINE>Cupid is no longer an archer: his glory shall be</LINE>

+<LINE>ours, for we are the only love-gods. Go in with me,</LINE>

+<LINE>and I will tell you my drift.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt</STAGEDIR>

+</SCENE>

+

+<SCENE><TITLE>SCENE II.  The same.</TITLE>

+<STAGEDIR>Enter DON JOHN and BORACHIO</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>It is so; the Count Claudio shall marry the</LINE>

+<LINE>daughter of Leonato.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Yea, my lord; but I can cross it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>Any bar, any cross, any impediment will be</LINE>

+<LINE>medicinable to me: I am sick in displeasure to him,</LINE>

+<LINE>and whatsoever comes athwart his affection ranges</LINE>

+<LINE>evenly with mine. How canst thou cross this marriage?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Not honestly, my lord; but so covertly that no</LINE>

+<LINE>dishonesty shall appear in me.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>Show me briefly how.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>I think I told your lordship a year since, how much</LINE>

+<LINE>I am in the favour of Margaret, the waiting</LINE>

+<LINE>gentlewoman to Hero.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>I remember.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>I can, at any unseasonable instant of the night,</LINE>

+<LINE>appoint her to look out at her lady's chamber window.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>What life is in that, to be the death of this marriage?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>The poison of that lies in you to temper. Go you to</LINE>

+<LINE>the prince your brother; spare not to tell him that</LINE>

+<LINE>he hath wronged his honour in marrying the renowned</LINE>

+<LINE>Claudio--whose estimation do you mightily hold</LINE>

+<LINE>up--to a contaminated stale, such a one as Hero.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>What proof shall I make of that?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Proof enough to misuse the prince, to vex Claudio,</LINE>

+<LINE>to undo Hero and kill Leonato. Look you for any</LINE>

+<LINE>other issue?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>Only to despite them, I will endeavour any thing.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Go, then; find me a meet hour to draw Don Pedro and</LINE>

+<LINE>the Count Claudio alone: tell them that you know</LINE>

+<LINE>that Hero loves me; intend a kind of zeal both to the</LINE>

+<LINE>prince and Claudio, as,--in love of your brother's</LINE>

+<LINE>honour, who hath made this match, and his friend's</LINE>

+<LINE>reputation, who is thus like to be cozened with the</LINE>

+<LINE>semblance of a maid,--that you have discovered</LINE>

+<LINE>thus. They will scarcely believe this without trial:</LINE>

+<LINE>offer them instances; which shall bear no less</LINE>

+<LINE>likelihood than to see me at her chamber-window,</LINE>

+<LINE>hear me call Margaret Hero, hear Margaret term me</LINE>

+<LINE>Claudio; and bring them to see this the very night</LINE>

+<LINE>before the intended wedding,--for in the meantime I</LINE>

+<LINE>will so fashion the matter that Hero shall be</LINE>

+<LINE>absent,--and there shall appear such seeming truth</LINE>

+<LINE>of Hero's disloyalty that jealousy shall be called</LINE>

+<LINE>assurance and all the preparation overthrown.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>Grow this to what adverse issue it can, I will put</LINE>

+<LINE>it in practise. Be cunning in the working this, and</LINE>

+<LINE>thy fee is a thousand ducats.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Be you constant in the accusation, and my cunning</LINE>

+<LINE>shall not shame me.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>I will presently go learn their day of marriage.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt</STAGEDIR>

+</SCENE>

+

+<SCENE><TITLE>SCENE III.  LEONATO'S orchard.</TITLE>

+<STAGEDIR>Enter BENEDICK</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Boy!</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Enter Boy</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>Boy</SPEAKER>

+<LINE>Signior?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>In my chamber-window lies a book: bring it hither</LINE>

+<LINE>to me in the orchard.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Boy</SPEAKER>

+<LINE>I am here already, sir.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>I know that; but I would have thee hence, and here again.</LINE>

+<STAGEDIR>Exit Boy</STAGEDIR>

+<LINE>I do much wonder that one man, seeing how much</LINE>

+<LINE>another man is a fool when he dedicates his</LINE>

+<LINE>behaviors to love, will, after he hath laughed at</LINE>

+<LINE>such shallow follies in others, become the argument</LINE>

+<LINE>of his own scorn by failing in love: and such a man</LINE>

+<LINE>is Claudio. I have known when there was no music</LINE>

+<LINE>with him but the drum and the fife; and now had he</LINE>

+<LINE>rather hear the tabour and the pipe: I have known</LINE>

+<LINE>when he would have walked ten mile a-foot to see a</LINE>

+<LINE>good armour; and now will he lie ten nights awake,</LINE>

+<LINE>carving the fashion of a new doublet. He was wont to</LINE>

+<LINE>speak plain and to the purpose, like an honest man</LINE>

+<LINE>and a soldier; and now is he turned orthography; his</LINE>

+<LINE>words are a very fantastical banquet, just so many</LINE>

+<LINE>strange dishes. May I be so converted and see with</LINE>

+<LINE>these eyes? I cannot tell; I think not: I will not</LINE>

+<LINE>be sworn, but love may transform me to an oyster; but</LINE>

+<LINE>I'll take my oath on it, till he have made an oyster</LINE>

+<LINE>of me, he shall never make me such a fool. One woman</LINE>

+<LINE>is fair, yet I am well; another is wise, yet I am</LINE>

+<LINE>well; another virtuous, yet I am well; but till all</LINE>

+<LINE>graces be in one woman, one woman shall not come in</LINE>

+<LINE>my grace. Rich she shall be, that's certain; wise,</LINE>

+<LINE>or I'll none; virtuous, or I'll never cheapen her;</LINE>

+<LINE>fair, or I'll   never look on her; mild, or come not</LINE>

+<LINE>near me; noble, or not I for an angel; of good</LINE>

+<LINE>discourse, an excellent musician, and her hair shall</LINE>

+<LINE>be of what colour it please God. Ha! the prince and</LINE>

+<LINE>Monsieur Love! I will hide me in the arbour.</LINE>

+</SPEECH>

+

+<STAGEDIR>Withdraws</STAGEDIR>

+<STAGEDIR>Enter DON PEDRO, CLAUDIO, and LEONATO</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Come, shall we hear this music?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Yea, my good lord. How still the evening is,</LINE>

+<LINE>As hush'd on purpose to grace harmony!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>See you where Benedick hath hid himself?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>O, very well, my lord: the music ended,</LINE>

+<LINE>We'll fit the kid-fox with a pennyworth.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Enter BALTHASAR with Music</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Come, Balthasar, we'll hear that song again.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BALTHASAR</SPEAKER>

+<LINE>O, good my lord, tax not so bad a voice</LINE>

+<LINE>To slander music any more than once.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>It is the witness still of excellency</LINE>

+<LINE>To put a strange face on his own perfection.</LINE>

+<LINE>I pray thee, sing, and let me woo no more.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BALTHASAR</SPEAKER>

+<LINE>Because you talk of wooing, I will sing;</LINE>

+<LINE>Since many a wooer doth commence his suit</LINE>

+<LINE>To her he thinks not worthy, yet he wooes,</LINE>

+<LINE>Yet will he swear he loves.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Now, pray thee, come;</LINE>

+<LINE>Or, if thou wilt hold longer argument,</LINE>

+<LINE>Do it in notes.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BALTHASAR</SPEAKER>

+<LINE>Note this before my notes;</LINE>

+<LINE>There's not a note of mine that's worth the noting.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Why, these are very crotchets that he speaks;</LINE>

+<LINE>Note, notes, forsooth, and nothing.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Air</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Now, divine air! now is his soul ravished! Is it</LINE>

+<LINE>not strange that sheeps' guts should hale souls out</LINE>

+<LINE>of men's bodies? Well, a horn for my money, when</LINE>

+<LINE>all's done.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>The Song</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>BALTHASAR</SPEAKER>

+<LINE>Sigh no more, ladies, sigh no more,</LINE>

+<LINE>Men were deceivers ever,</LINE>

+<LINE>One foot in sea and one on shore,</LINE>

+<LINE>To one thing constant never:</LINE>

+<LINE>Then sigh not so, but let them go,</LINE>

+<LINE>And be you blithe and bonny,</LINE>

+<LINE>Converting all your sounds of woe</LINE>

+<LINE>Into Hey nonny, nonny.</LINE>

+<LINE>Sing no more ditties, sing no moe,</LINE>

+<LINE>Of dumps so dull and heavy;</LINE>

+<LINE>The fraud of men was ever so,</LINE>

+<LINE>Since summer first was leafy:</LINE>

+<LINE>Then sigh not so, &amp;c.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>By my troth, a good song.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BALTHASAR</SPEAKER>

+<LINE>And an ill singer, my lord.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Ha, no, no, faith; thou singest well enough for a shift.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>An he had been a dog that should have howled thus,</LINE>

+<LINE>they would have hanged him: and I pray God his bad</LINE>

+<LINE>voice bode no mischief. I had as lief have heard the</LINE>

+<LINE>night-raven, come what plague could have come after</LINE>

+<LINE>it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Yea, marry, dost thou hear, Balthasar? I pray thee,</LINE>

+<LINE>get us some excellent music; for to-morrow night we</LINE>

+<LINE>would have it at the Lady Hero's chamber-window.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BALTHASAR</SPEAKER>

+<LINE>The best I can, my lord.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Do so: farewell.</LINE>

+<STAGEDIR>Exit BALTHASAR</STAGEDIR>

+<LINE>Come hither, Leonato. What was it you told me of</LINE>

+<LINE>to-day, that your niece Beatrice was in love with</LINE>

+<LINE>Signior Benedick?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>O, ay: stalk on. stalk on; the fowl sits. I did</LINE>

+<LINE>never think that lady would have loved any man.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>No, nor I neither; but most wonderful that she</LINE>

+<LINE>should so dote on Signior Benedick, whom she hath in</LINE>

+<LINE>all outward behaviors seemed ever to abhor.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Is't possible? Sits the wind in that corner?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>By my troth, my lord, I cannot tell what to think</LINE>

+<LINE>of it but that she loves him with an enraged</LINE>

+<LINE>affection: it is past the infinite of thought.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>May be she doth but counterfeit.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Faith, like enough.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>O God, counterfeit! There was never counterfeit of</LINE>

+<LINE>passion came so near the life of passion as she</LINE>

+<LINE>discovers it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Why, what effects of passion shows she?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Bait the hook well; this fish will bite.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>What effects, my lord? She will sit you, you heard</LINE>

+<LINE>my daughter tell you how.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>She did, indeed.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>How, how, pray you? You amaze me: I would have I</LINE>

+<LINE>thought her spirit had been invincible against all</LINE>

+<LINE>assaults of affection.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>I would have sworn it had, my lord; especially</LINE>

+<LINE>against Benedick.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>I should think this a gull, but that the</LINE>

+<LINE>white-bearded fellow speaks it: knavery cannot,</LINE>

+<LINE>sure, hide himself in such reverence.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>He hath ta'en the infection: hold it up.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Hath she made her affection known to Benedick?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>No; and swears she never will: that's her torment.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>'Tis true, indeed; so your daughter says: 'Shall</LINE>

+<LINE>I,' says she, 'that have so oft encountered him</LINE>

+<LINE>with scorn, write to him that I love him?'</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>This says she now when she is beginning to write to</LINE>

+<LINE>him; for she'll be up twenty times a night, and</LINE>

+<LINE>there will she sit in her smock till she have writ a</LINE>

+<LINE>sheet of paper: my daughter tells us all.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Now you talk of a sheet of paper, I remember a</LINE>

+<LINE>pretty jest your daughter told us of.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>O, when she had writ it and was reading it over, she</LINE>

+<LINE>found Benedick and Beatrice between the sheet?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>That.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>O, she tore the letter into a thousand halfpence;</LINE>

+<LINE>railed at herself, that she should be so immodest</LINE>

+<LINE>to write to one that she knew would flout her; 'I</LINE>

+<LINE>measure him,' says she, 'by my own spirit; for I</LINE>

+<LINE>should flout him, if he writ to me; yea, though I</LINE>

+<LINE>love him, I should.'</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Then down upon her knees she falls, weeps, sobs,</LINE>

+<LINE>beats her heart, tears her hair, prays, curses; 'O</LINE>

+<LINE>sweet Benedick! God give me patience!'</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>She doth indeed; my daughter says so: and the</LINE>

+<LINE>ecstasy hath so much overborne her that my daughter</LINE>

+<LINE>is sometime afeared she will do a desperate outrage</LINE>

+<LINE>to herself: it is very true.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>It were good that Benedick knew of it by some</LINE>

+<LINE>other, if she will not discover it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>To what end? He would make but a sport of it and</LINE>

+<LINE>torment the poor lady worse.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>An he should, it were an alms to hang him. She's an</LINE>

+<LINE>excellent sweet lady; and, out of all suspicion,</LINE>

+<LINE>she is virtuous.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>And she is exceeding wise.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>In every thing but in loving Benedick.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>O, my lord, wisdom and blood combating in so tender</LINE>

+<LINE>a body, we have ten proofs to one that blood hath</LINE>

+<LINE>the victory. I am sorry for her, as I have just</LINE>

+<LINE>cause, being her uncle and her guardian.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>I would she had bestowed this dotage on me: I would</LINE>

+<LINE>have daffed all other respects and made her half</LINE>

+<LINE>myself. I pray you, tell Benedick of it, and hear</LINE>

+<LINE>what a' will say.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Were it good, think you?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Hero thinks surely she will die; for she says she</LINE>

+<LINE>will die, if he love her not, and she will die, ere</LINE>

+<LINE>she make her love known, and she will die, if he woo</LINE>

+<LINE>her, rather than she will bate one breath of her</LINE>

+<LINE>accustomed crossness.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>She doth well: if she should make tender of her</LINE>

+<LINE>love, 'tis very possible he'll scorn it; for the</LINE>

+<LINE>man, as you know all, hath a contemptible spirit.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>He is a very proper man.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>He hath indeed a good outward happiness.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Before God! and, in my mind, very wise.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>He doth indeed show some sparks that are like wit.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>And I take him to be valiant.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>As Hector, I assure you: and in the managing of</LINE>

+<LINE>quarrels you may say he is wise; for either he</LINE>

+<LINE>avoids them with great discretion, or undertakes</LINE>

+<LINE>them with a most Christian-like fear.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>If he do fear God, a' must necessarily keep peace:</LINE>

+<LINE>if he break the peace, he ought to enter into a</LINE>

+<LINE>quarrel with fear and trembling.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>And so will he do; for the man doth fear God,</LINE>

+<LINE>howsoever it seems not in him by some large jests</LINE>

+<LINE>he will make. Well I am sorry for your niece. Shall</LINE>

+<LINE>we go seek Benedick, and tell him of her love?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Never tell him, my lord: let her wear it out with</LINE>

+<LINE>good counsel.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Nay, that's impossible: she may wear her heart out first.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Well, we will hear further of it by your daughter:</LINE>

+<LINE>let it cool the while. I love Benedick well; and I</LINE>

+<LINE>could wish he would modestly examine himself, to see</LINE>

+<LINE>how much he is unworthy so good a lady.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>My lord, will you walk? dinner is ready.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>If he do not dote on her upon this, I will never</LINE>

+<LINE>trust my expectation.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Let there be the same net spread for her; and that</LINE>

+<LINE>must your daughter and her gentlewomen carry. The</LINE>

+<LINE>sport will be, when they hold one an opinion of</LINE>

+<LINE>another's dotage, and no such matter: that's the</LINE>

+<LINE>scene that I would see, which will be merely a</LINE>

+<LINE>dumb-show. Let us send her to call him in to dinner.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt DON PEDRO, CLAUDIO, and LEONATO</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE><STAGEDIR>Coming forward</STAGEDIR>  This can be no trick: the</LINE>

+<LINE>conference was sadly borne. They have the truth of</LINE>

+<LINE>this from Hero. They seem to pity the lady: it</LINE>

+<LINE>seems her affections have their full bent. Love me!</LINE>

+<LINE>why, it must be requited. I hear how I am censured:</LINE>

+<LINE>they say I will bear myself proudly, if I perceive</LINE>

+<LINE>the love come from her; they say too that she will</LINE>

+<LINE>rather die than give any sign of affection. I did</LINE>

+<LINE>never think to marry: I must not seem proud: happy</LINE>

+<LINE>are they that hear their detractions and can put</LINE>

+<LINE>them to mending. They say the lady is fair; 'tis a</LINE>

+<LINE>truth, I can bear them witness; and virtuous; 'tis</LINE>

+<LINE>so, I cannot reprove it; and wise, but for loving</LINE>

+<LINE>me; by my troth, it is no addition to her wit, nor</LINE>

+<LINE>no great argument of her folly, for I will be</LINE>

+<LINE>horribly in love with her. I may chance have some</LINE>

+<LINE>odd quirks and remnants of wit broken on me,</LINE>

+<LINE>because I have railed so long against marriage: but</LINE>

+<LINE>doth not the appetite alter? a man loves the meat</LINE>

+<LINE>in his youth that he cannot endure in his age.</LINE>

+<LINE>Shall quips and sentences and these paper bullets of</LINE>

+<LINE>the brain awe a man from the career of his humour?</LINE>

+<LINE>No, the world must be peopled. When I said I would</LINE>

+<LINE>die a bachelor, I did not think I should live till I</LINE>

+<LINE>were married. Here comes Beatrice. By this day!</LINE>

+<LINE>she's a fair lady: I do spy some marks of love in</LINE>

+<LINE>her.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Enter BEATRICE</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Against my will I am sent to bid you come in to dinner.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Fair Beatrice, I thank you for your pains.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>I took no more pains for those thanks than you take</LINE>

+<LINE>pains to thank me: if it had been painful, I would</LINE>

+<LINE>not have come.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>You take pleasure then in the message?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Yea, just so much as you may take upon a knife's</LINE>

+<LINE>point and choke a daw withal. You have no stomach,</LINE>

+<LINE>signior: fare you well.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exit</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Ha! 'Against my will I am sent to bid you come in</LINE>

+<LINE>to dinner;' there's a double meaning in that 'I took</LINE>

+<LINE>no more pains for those thanks than you took pains</LINE>

+<LINE>to thank me.' that's as much as to say, Any pains</LINE>

+<LINE>that I take for you is as easy as thanks. If I do</LINE>

+<LINE>not take pity of her, I am a villain; if I do not</LINE>

+<LINE>love her, I am a Jew. I will go get her picture.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exit</STAGEDIR>

+</SCENE>

+

+</ACT>

+

+<ACT><TITLE>ACT III</TITLE>

+

+<SCENE><TITLE>SCENE I.  LEONATO'S garden.</TITLE>

+<STAGEDIR>Enter HERO, MARGARET, and URSULA</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>Good Margaret, run thee to the parlor;</LINE>

+<LINE>There shalt thou find my cousin Beatrice</LINE>

+<LINE>Proposing with the prince and Claudio:</LINE>

+<LINE>Whisper her ear and tell her, I and Ursula</LINE>

+<LINE>Walk in the orchard and our whole discourse</LINE>

+<LINE>Is all of her; say that thou overheard'st us;</LINE>

+<LINE>And bid her steal into the pleached bower,</LINE>

+<LINE>Where honeysuckles, ripen'd by the sun,</LINE>

+<LINE>Forbid the sun to enter, like favourites,</LINE>

+<LINE>Made proud by princes, that advance their pride</LINE>

+<LINE>Against that power that bred it: there will she hide her,</LINE>

+<LINE>To listen our purpose.  This is thy office;</LINE>

+<LINE>Bear thee well in it and leave us alone.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>I'll make her come, I warrant you, presently.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exit</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>Now, Ursula, when Beatrice doth come,</LINE>

+<LINE>As we do trace this alley up and down,</LINE>

+<LINE>Our talk must only be of Benedick.</LINE>

+<LINE>When I do name him, let it be thy part</LINE>

+<LINE>To praise him more than ever man did merit:</LINE>

+<LINE>My talk to thee must be how Benedick</LINE>

+<LINE>Is sick in love with Beatrice. Of this matter</LINE>

+<LINE>Is little Cupid's crafty arrow made,</LINE>

+<LINE>That only wounds by hearsay.</LINE>

+<STAGEDIR>Enter BEATRICE, behind</STAGEDIR>

+<LINE>Now begin;</LINE>

+<LINE>For look where Beatrice, like a lapwing, runs</LINE>

+<LINE>Close by the ground, to hear our conference.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>URSULA</SPEAKER>

+<LINE>The pleasant'st angling is to see the fish</LINE>

+<LINE>Cut with her golden oars the silver stream,</LINE>

+<LINE>And greedily devour the treacherous bait:</LINE>

+<LINE>So angle we for Beatrice; who even now</LINE>

+<LINE>Is couched in the woodbine coverture.</LINE>

+<LINE>Fear you not my part of the dialogue.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>Then go we near her, that her ear lose nothing</LINE>

+<LINE>Of the false sweet bait that we lay for it.</LINE>

+<STAGEDIR>Approaching the bower</STAGEDIR>

+<LINE>No, truly, Ursula, she is too disdainful;</LINE>

+<LINE>I know her spirits are as coy and wild</LINE>

+<LINE>As haggerds of the rock.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>URSULA</SPEAKER>

+<LINE>But are you sure</LINE>

+<LINE>That Benedick loves Beatrice so entirely?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>So says the prince and my new-trothed lord.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>URSULA</SPEAKER>

+<LINE>And did they bid you tell her of it, madam?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>They did entreat me to acquaint her of it;</LINE>

+<LINE>But I persuaded them, if they loved Benedick,</LINE>

+<LINE>To wish him wrestle with affection,</LINE>

+<LINE>And never to let Beatrice know of it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>URSULA</SPEAKER>

+<LINE>Why did you so? Doth not the gentleman</LINE>

+<LINE>Deserve as full as fortunate a bed</LINE>

+<LINE>As ever Beatrice shall couch upon?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>O god of love! I know he doth deserve</LINE>

+<LINE>As much as may be yielded to a man:</LINE>

+<LINE>But Nature never framed a woman's heart</LINE>

+<LINE>Of prouder stuff than that of Beatrice;</LINE>

+<LINE>Disdain and scorn ride sparkling in her eyes,</LINE>

+<LINE>Misprising what they look on, and her wit</LINE>

+<LINE>Values itself so highly that to her</LINE>

+<LINE>All matter else seems weak: she cannot love,</LINE>

+<LINE>Nor take no shape nor project of affection,</LINE>

+<LINE>She is so self-endeared.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>URSULA</SPEAKER>

+<LINE>Sure, I think so;</LINE>

+<LINE>And therefore certainly it were not good</LINE>

+<LINE>She knew his love, lest she make sport at it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>Why, you speak truth. I never yet saw man,</LINE>

+<LINE>How wise, how noble, young, how rarely featured,</LINE>

+<LINE>But she would spell him backward: if fair-faced,</LINE>

+<LINE>She would swear the gentleman should be her sister;</LINE>

+<LINE>If black, why, Nature, drawing of an antique,</LINE>

+<LINE>Made a foul blot; if tall, a lance ill-headed;</LINE>

+<LINE>If low, an agate very vilely cut;</LINE>

+<LINE>If speaking, why, a vane blown with all winds;</LINE>

+<LINE>If silent, why, a block moved with none.</LINE>

+<LINE>So turns she every man the wrong side out</LINE>

+<LINE>And never gives to truth and virtue that</LINE>

+<LINE>Which simpleness and merit purchaseth.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>URSULA</SPEAKER>

+<LINE>Sure, sure, such carping is not commendable.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>No, not to be so odd and from all fashions</LINE>

+<LINE>As Beatrice is, cannot be commendable:</LINE>

+<LINE>But who dare tell her so? If I should speak,</LINE>

+<LINE>She would mock me into air; O, she would laugh me</LINE>

+<LINE>Out of myself, press me to death with wit.</LINE>

+<LINE>Therefore let Benedick, like cover'd fire,</LINE>

+<LINE>Consume away in sighs, waste inwardly:</LINE>

+<LINE>It were a better death than die with mocks,</LINE>

+<LINE>Which is as bad as die with tickling.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>URSULA</SPEAKER>

+<LINE>Yet tell her of it: hear what she will say.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>No; rather I will go to Benedick</LINE>

+<LINE>And counsel him to fight against his passion.</LINE>

+<LINE>And, truly, I'll devise some honest slanders</LINE>

+<LINE>To stain my cousin with: one doth not know</LINE>

+<LINE>How much an ill word may empoison liking.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>URSULA</SPEAKER>

+<LINE>O, do not do your cousin such a wrong.</LINE>

+<LINE>She cannot be so much without true judgment--</LINE>

+<LINE>Having so swift and excellent a wit</LINE>

+<LINE>As she is prized to have--as to refuse</LINE>

+<LINE>So rare a gentleman as Signior Benedick.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>He is the only man of Italy.</LINE>

+<LINE>Always excepted my dear Claudio.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>URSULA</SPEAKER>

+<LINE>I pray you, be not angry with me, madam,</LINE>

+<LINE>Speaking my fancy: Signior Benedick,</LINE>

+<LINE>For shape, for bearing, argument and valour,</LINE>

+<LINE>Goes foremost in report through Italy.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>Indeed, he hath an excellent good name.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>URSULA</SPEAKER>

+<LINE>His excellence did earn it, ere he had it.</LINE>

+<LINE>When are you married, madam?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>Why, every day, to-morrow. Come, go in:</LINE>

+<LINE>I'll show thee some attires, and have thy counsel</LINE>

+<LINE>Which is the best to furnish me to-morrow.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>URSULA</SPEAKER>

+<LINE>She's limed, I warrant you: we have caught her, madam.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>If it proves so, then loving goes by haps:</LINE>

+<LINE>Some Cupid kills with arrows, some with traps.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt HERO and URSULA</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE><STAGEDIR>Coming forward</STAGEDIR></LINE>

+<LINE>What fire is in mine ears? Can this be true?</LINE>

+<LINE>Stand I condemn'd for pride and scorn so much?</LINE>

+<LINE>Contempt, farewell! and maiden pride, adieu!</LINE>

+<LINE>No glory lives behind the back of such.</LINE>

+<LINE>And, Benedick, love on; I will requite thee,</LINE>

+<LINE>Taming my wild heart to thy loving hand:</LINE>

+<LINE>If thou dost love, my kindness shall incite thee</LINE>

+<LINE>To bind our loves up in a holy band;</LINE>

+<LINE>For others say thou dost deserve, and I</LINE>

+<LINE>Believe it better than reportingly.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exit</STAGEDIR>

+</SCENE>

+

+<SCENE><TITLE>SCENE II.  A room in LEONATO'S house</TITLE>

+<STAGEDIR>Enter DON PEDRO, CLAUDIO, BENEDICK, and LEONATO</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>I do but stay till your marriage be consummate, and</LINE>

+<LINE>then go I toward Arragon.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>I'll bring you thither, my lord, if you'll</LINE>

+<LINE>vouchsafe me.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Nay, that would be as great a soil in the new gloss</LINE>

+<LINE>of your marriage as to show a child his new coat</LINE>

+<LINE>and forbid him to wear it. I will only be bold</LINE>

+<LINE>with Benedick for his company; for, from the crown</LINE>

+<LINE>of his head to the sole of his foot, he is all</LINE>

+<LINE>mirth: he hath twice or thrice cut Cupid's</LINE>

+<LINE>bow-string and the little hangman dare not shoot at</LINE>

+<LINE>him; he hath a heart as sound as a bell and his</LINE>

+<LINE>tongue is the clapper, for what his heart thinks his</LINE>

+<LINE>tongue speaks.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Gallants, I am not as I have been.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>So say I methinks you are sadder.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>I hope he be in love.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Hang him, truant! there's no true drop of blood in</LINE>

+<LINE>him, to be truly touched with love: if he be sad,</LINE>

+<LINE>he wants money.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>I have the toothache.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Draw it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Hang it!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>You must hang it first, and draw it afterwards.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>What! sigh for the toothache?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Where is but a humour or a worm.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Well, every one can master a grief but he that has</LINE>

+<LINE>it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Yet say I, he is in love.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>There is no appearance of fancy in him, unless it be</LINE>

+<LINE>a fancy that he hath to strange disguises; as, to be</LINE>

+<LINE>a Dutchman today, a Frenchman to-morrow, or in the</LINE>

+<LINE>shape of two countries at once, as, a German from</LINE>

+<LINE>the waist downward, all slops, and a Spaniard from</LINE>

+<LINE>the hip upward, no doublet. Unless he have a fancy</LINE>

+<LINE>to this foolery, as it appears he hath, he is no</LINE>

+<LINE>fool for fancy, as you would have it appear he is.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>If he be not in love with some woman, there is no</LINE>

+<LINE>believing old signs: a' brushes his hat o'</LINE>

+<LINE>mornings; what should that bode?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Hath any man seen him at the barber's?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>No, but the barber's man hath been seen with him,</LINE>

+<LINE>and the old ornament of his cheek hath already</LINE>

+<LINE>stuffed tennis-balls.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Indeed, he looks younger than he did, by the loss of a beard.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Nay, a' rubs himself with civet: can you smell him</LINE>

+<LINE>out by that?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>That's as much as to say, the sweet youth's in love.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>The greatest note of it is his melancholy.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>And when was he wont to wash his face?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Yea, or to paint himself? for the which, I hear</LINE>

+<LINE>what they say of him.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Nay, but his jesting spirit; which is now crept into</LINE>

+<LINE>a lute-string and now governed by stops.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Indeed, that tells a heavy tale for him: conclude,</LINE>

+<LINE>conclude he is in love.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Nay, but I know who loves him.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>That would I know too: I warrant, one that knows him not.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Yes, and his ill conditions; and, in despite of</LINE>

+<LINE>all, dies for him.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>She shall be buried with her face upwards.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Yet is this no charm for the toothache. Old</LINE>

+<LINE>signior, walk aside with me: I have studied eight</LINE>

+<LINE>or nine wise words to speak to you, which these</LINE>

+<LINE>hobby-horses must not hear.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt BENEDICK and LEONATO</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>For my life, to break with him about Beatrice.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>'Tis even so. Hero and Margaret have by this</LINE>

+<LINE>played their parts with Beatrice; and then the two</LINE>

+<LINE>bears will not bite one another when they meet.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Enter DON JOHN</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>My lord and brother, God save you!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Good den, brother.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>If your leisure served, I would speak with you.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>In private?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>If it please you: yet Count Claudio may hear; for</LINE>

+<LINE>what I would speak of concerns him.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>What's the matter?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE><STAGEDIR>To CLAUDIO</STAGEDIR>  Means your lordship to be married</LINE>

+<LINE>to-morrow?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>You know he does.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>I know not that, when he knows what I know.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>If there be any impediment, I pray you discover it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>You may think I love you not: let that appear</LINE>

+<LINE>hereafter, and aim better at me by that I now will</LINE>

+<LINE>manifest. For my brother, I think he holds you</LINE>

+<LINE>well, and in dearness of heart hath holp to effect</LINE>

+<LINE>your ensuing marriage;--surely suit ill spent and</LINE>

+<LINE>labour ill bestowed.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Why, what's the matter?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>I came hither to tell you; and, circumstances</LINE>

+<LINE>shortened, for she has been too long a talking of,</LINE>

+<LINE>the lady is disloyal.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Who, Hero?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Even she; Leonato's Hero, your Hero, every man's Hero:</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Disloyal?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>The word is too good to paint out her wickedness; I</LINE>

+<LINE>could say she were worse: think you of a worse</LINE>

+<LINE>title, and I will fit her to it. Wonder not till</LINE>

+<LINE>further warrant: go but with me to-night, you shall</LINE>

+<LINE>see her chamber-window entered, even the night</LINE>

+<LINE>before her wedding-day: if you love her then,</LINE>

+<LINE>to-morrow wed her; but it would better fit your honour</LINE>

+<LINE>to change your mind.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>May this be so?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>I will not think it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>If you dare not trust that you see, confess not</LINE>

+<LINE>that you know: if you will follow me, I will show</LINE>

+<LINE>you enough; and when you have seen more and heard</LINE>

+<LINE>more, proceed accordingly.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>If I see any thing to-night why I should not marry</LINE>

+<LINE>her to-morrow in the congregation, where I should</LINE>

+<LINE>wed, there will I shame her.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>And, as I wooed for thee to obtain her, I will join</LINE>

+<LINE>with thee to disgrace her.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>I will disparage her no farther till you are my</LINE>

+<LINE>witnesses: bear it coldly but till midnight, and</LINE>

+<LINE>let the issue show itself.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>O day untowardly turned!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>O mischief strangely thwarting!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>O plague right well prevented! so will you say when</LINE>

+<LINE>you have seen the sequel.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt</STAGEDIR>

+</SCENE>

+

+<SCENE><TITLE>SCENE III.  A street.</TITLE>

+<STAGEDIR>Enter DOGBERRY and VERGES with the Watch</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Are you good men and true?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>VERGES</SPEAKER>

+<LINE>Yea, or else it were pity but they should suffer</LINE>

+<LINE>salvation, body and soul.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Nay, that were a punishment too good for them, if</LINE>

+<LINE>they should have any allegiance in them, being</LINE>

+<LINE>chosen for the prince's watch.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>VERGES</SPEAKER>

+<LINE>Well, give them their charge, neighbour Dogberry.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>First, who think you the most desertless man to be</LINE>

+<LINE>constable?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>First Watchman</SPEAKER>

+<LINE>Hugh Otecake, sir, or George Seacole; for they can</LINE>

+<LINE>write and read.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Come hither, neighbour Seacole. God hath blessed</LINE>

+<LINE>you with a good name: to be a well-favoured man is</LINE>

+<LINE>the gift of fortune; but to write and read comes by nature.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Second Watchman</SPEAKER>

+<LINE>Both which, master constable,--</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>You have: I knew it would be your answer. Well,</LINE>

+<LINE>for your favour, sir, why, give God thanks, and make</LINE>

+<LINE>no boast of it; and for your writing and reading,</LINE>

+<LINE>let that appear when there is no need of such</LINE>

+<LINE>vanity. You are thought here to be the most</LINE>

+<LINE>senseless and fit man for the constable of the</LINE>

+<LINE>watch; therefore bear you the lantern. This is your</LINE>

+<LINE>charge: you shall comprehend all vagrom men; you are</LINE>

+<LINE>to bid any man stand, in the prince's name.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Second Watchman</SPEAKER>

+<LINE>How if a' will not stand?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Why, then, take no note of him, but let him go; and</LINE>

+<LINE>presently call the rest of the watch together and</LINE>

+<LINE>thank God you are rid of a knave.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>VERGES</SPEAKER>

+<LINE>If he will not stand when he is bidden, he is none</LINE>

+<LINE>of the prince's subjects.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>True, and they are to meddle with none but the</LINE>

+<LINE>prince's subjects. You shall also make no noise in</LINE>

+<LINE>the streets; for, for the watch to babble and to</LINE>

+<LINE>talk is most tolerable and not to be endured.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Watchman</SPEAKER>

+<LINE>We will rather sleep than talk: we know what</LINE>

+<LINE>belongs to a watch.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Why, you speak like an ancient and most quiet</LINE>

+<LINE>watchman; for I cannot see how sleeping should</LINE>

+<LINE>offend: only, have a care that your bills be not</LINE>

+<LINE>stolen. Well, you are to call at all the</LINE>

+<LINE>ale-houses, and bid those that are drunk get them to bed.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Watchman</SPEAKER>

+<LINE>How if they will not?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Why, then, let them alone till they are sober: if</LINE>

+<LINE>they make you not then the better answer, you may</LINE>

+<LINE>say they are not the men you took them for.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Watchman</SPEAKER>

+<LINE>Well, sir.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>If you meet a thief, you may suspect him, by virtue</LINE>

+<LINE>of your office, to be no true man; and, for such</LINE>

+<LINE>kind of men, the less you meddle or make with them,</LINE>

+<LINE>why the more is for your honesty.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Watchman</SPEAKER>

+<LINE>If we know him to be a thief, shall we not lay</LINE>

+<LINE>hands on him?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Truly, by your office, you may; but I think they</LINE>

+<LINE>that touch pitch will be defiled: the most peaceable</LINE>

+<LINE>way for you, if you do take a thief, is to let him</LINE>

+<LINE>show himself what he is and steal out of your company.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>VERGES</SPEAKER>

+<LINE>You have been always called a merciful man, partner.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Truly, I would not hang a dog by my will, much more</LINE>

+<LINE>a man who hath any honesty in him.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>VERGES</SPEAKER>

+<LINE>If you hear a child cry in the night, you must call</LINE>

+<LINE>to the nurse and bid her still it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Watchman</SPEAKER>

+<LINE>How if the nurse be asleep and will not hear us?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Why, then, depart in peace, and let the child wake</LINE>

+<LINE>her with crying; for the ewe that will not hear her</LINE>

+<LINE>lamb when it baes will never answer a calf when he bleats.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>VERGES</SPEAKER>

+<LINE>'Tis very true.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>This is the end of the charge:--you, constable, are</LINE>

+<LINE>to present the prince's own person: if you meet the</LINE>

+<LINE>prince in the night, you may stay him.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>VERGES</SPEAKER>

+<LINE>Nay, by'r our lady, that I think a' cannot.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Five shillings to one on't, with any man that knows</LINE>

+<LINE>the statutes, he may stay him: marry, not without</LINE>

+<LINE>the prince be willing; for, indeed, the watch ought</LINE>

+<LINE>to offend no man; and it is an offence to stay a</LINE>

+<LINE>man against his will.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>VERGES</SPEAKER>

+<LINE>By'r lady, I think it be so.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Ha, ha, ha! Well, masters, good night: an there be</LINE>

+<LINE>any matter of weight chances, call up me: keep your</LINE>

+<LINE>fellows' counsels and your own; and good night.</LINE>

+<LINE>Come, neighbour.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Watchman</SPEAKER>

+<LINE>Well, masters, we hear our charge: let us go sit here</LINE>

+<LINE>upon the church-bench till two, and then all to bed.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>One word more, honest neighbours. I pray you watch</LINE>

+<LINE>about Signior Leonato's door; for the wedding being</LINE>

+<LINE>there to-morrow, there is a great coil to-night.</LINE>

+<LINE>Adieu: be vigitant, I beseech you.</LINE>

+</SPEECH>

+

+<STAGEDIR>Exeunt DOGBERRY and VERGES</STAGEDIR>

+<STAGEDIR>Enter BORACHIO and CONRADE</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>What Conrade!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Watchman</SPEAKER>

+<LINE><STAGEDIR>Aside</STAGEDIR>  Peace! stir not.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Conrade, I say!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>Here, man; I am at thy elbow.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Mass, and my elbow itched; I thought there would a</LINE>

+<LINE>scab follow.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>I will owe thee an answer for that: and now forward</LINE>

+<LINE>with thy tale.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Stand thee close, then, under this pent-house, for</LINE>

+<LINE>it drizzles rain; and I will, like a true drunkard,</LINE>

+<LINE>utter all to thee.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Watchman</SPEAKER>

+<LINE><STAGEDIR>Aside</STAGEDIR>  Some treason, masters: yet stand close.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Therefore know I have earned of Don John a thousand ducats.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>Is it possible that any villany should be so dear?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Thou shouldst rather ask if it were possible any</LINE>

+<LINE>villany should be so rich; for when rich villains</LINE>

+<LINE>have need of poor ones, poor ones may make what</LINE>

+<LINE>price they will.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>I wonder at it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>That shows thou art unconfirmed. Thou knowest that</LINE>

+<LINE>the fashion of a doublet, or a hat, or a cloak, is</LINE>

+<LINE>nothing to a man.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>Yes, it is apparel.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>I mean, the fashion.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>Yes, the fashion is the fashion.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Tush! I may as well say the fool's the fool. But</LINE>

+<LINE>seest thou not what a deformed thief this fashion</LINE>

+<LINE>is?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Watchman</SPEAKER>

+<LINE><STAGEDIR>Aside</STAGEDIR>  I know that Deformed; a' has been a vile</LINE>

+<LINE>thief this seven year; a' goes up and down like a</LINE>

+<LINE>gentleman: I remember his name.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Didst thou not hear somebody?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>No; 'twas the vane on the house.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Seest thou not, I say, what a deformed thief this</LINE>

+<LINE>fashion is? how giddily a' turns about all the hot</LINE>

+<LINE>bloods between fourteen and five-and-thirty?</LINE>

+<LINE>sometimes fashioning them like Pharaoh's soldiers</LINE>

+<LINE>in the reeky painting, sometime like god Bel's</LINE>

+<LINE>priests in the old church-window, sometime like the</LINE>

+<LINE>shaven Hercules in the smirched worm-eaten tapestry,</LINE>

+<LINE>where his codpiece seems as massy as his club?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>All this I see; and I see that the fashion wears</LINE>

+<LINE>out more apparel than the man. But art not thou</LINE>

+<LINE>thyself giddy with the fashion too, that thou hast</LINE>

+<LINE>shifted out of thy tale into telling me of the fashion?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Not so, neither: but know that I have to-night</LINE>

+<LINE>wooed Margaret, the Lady Hero's gentlewoman, by the</LINE>

+<LINE>name of Hero: she leans me out at her mistress'</LINE>

+<LINE>chamber-window, bids me a thousand times good</LINE>

+<LINE>night,--I tell this tale vilely:--I should first</LINE>

+<LINE>tell thee how the prince, Claudio and my master,</LINE>

+<LINE>planted and placed and possessed by my master Don</LINE>

+<LINE>John, saw afar off in the orchard this amiable encounter.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>And thought they Margaret was Hero?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Two of them did, the prince and Claudio; but the</LINE>

+<LINE>devil my master knew she was Margaret; and partly</LINE>

+<LINE>by his oaths, which first possessed them, partly by</LINE>

+<LINE>the dark night, which did deceive them, but chiefly</LINE>

+<LINE>by my villany, which did confirm any slander that</LINE>

+<LINE>Don John had made, away went Claudio enraged; swore</LINE>

+<LINE>he would meet her, as he was appointed, next morning</LINE>

+<LINE>at the temple, and there, before the whole</LINE>

+<LINE>congregation, shame her with what he saw o'er night</LINE>

+<LINE>and send her home again without a husband.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>First Watchman</SPEAKER>

+<LINE>We charge you, in the prince's name, stand!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Second Watchman</SPEAKER>

+<LINE>Call up the right master constable. We have here</LINE>

+<LINE>recovered the most dangerous piece of lechery that</LINE>

+<LINE>ever was known in the commonwealth.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>First Watchman</SPEAKER>

+<LINE>And one Deformed is one of them: I know him; a'</LINE>

+<LINE>wears a lock.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>Masters, masters,--</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Second Watchman</SPEAKER>

+<LINE>You'll be made bring Deformed forth, I warrant you.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>Masters,--</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>First Watchman</SPEAKER>

+<LINE>Never speak: we charge you let us obey you to go with us.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>We are like to prove a goodly commodity, being taken</LINE>

+<LINE>up of these men's bills.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>A commodity in question, I warrant you. Come, we'll obey you.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt</STAGEDIR>

+</SCENE>

+

+<SCENE><TITLE>SCENE IV.  HERO's apartment.</TITLE>

+<STAGEDIR>Enter HERO, MARGARET, and URSULA</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>Good Ursula, wake my cousin Beatrice, and desire</LINE>

+<LINE>her to rise.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>URSULA</SPEAKER>

+<LINE>I will, lady.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>And bid her come hither.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>URSULA</SPEAKER>

+<LINE>Well.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exit</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>Troth, I think your other rabato were better.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>No, pray thee, good Meg, I'll wear this.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>By my troth, 's not so good; and I warrant your</LINE>

+<LINE>cousin will say so.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>My cousin's a fool, and thou art another: I'll wear</LINE>

+<LINE>none but this.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>I like the new tire within excellently, if the hair</LINE>

+<LINE>were a thought browner; and your gown's a most rare</LINE>

+<LINE>fashion, i' faith. I saw the Duchess of Milan's</LINE>

+<LINE>gown that they praise so.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>O, that exceeds, they say.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>By my troth, 's but a night-gown in respect of</LINE>

+<LINE>yours: cloth o' gold, and cuts, and laced with</LINE>

+<LINE>silver, set with pearls, down sleeves, side sleeves,</LINE>

+<LINE>and skirts, round underborne with a bluish tinsel:</LINE>

+<LINE>but for a fine, quaint, graceful and excellent</LINE>

+<LINE>fashion, yours is worth ten on 't.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>God give me joy to wear it! for my heart is</LINE>

+<LINE>exceeding heavy.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>'Twill be heavier soon by the weight of a man.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>Fie upon thee! art not ashamed?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>Of what, lady? of speaking honourably? Is not</LINE>

+<LINE>marriage honourable in a beggar? Is not your lord</LINE>

+<LINE>honourable without marriage? I think you would have</LINE>

+<LINE>me say, 'saving your reverence, a husband:' and bad</LINE>

+<LINE>thinking do not wrest true speaking, I'll offend</LINE>

+<LINE>nobody: is there any harm in 'the heavier for a</LINE>

+<LINE>husband'? None, I think, and it be the right husband</LINE>

+<LINE>and the right wife; otherwise 'tis light, and not</LINE>

+<LINE>heavy: ask my Lady Beatrice else; here she comes.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Enter BEATRICE</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>Good morrow, coz.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Good morrow, sweet Hero.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>Why how now? do you speak in the sick tune?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>I am out of all other tune, methinks.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>Clap's into 'Light o' love;' that goes without a</LINE>

+<LINE>burden: do you sing it, and I'll dance it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Ye light o' love, with your heels! then, if your</LINE>

+<LINE>husband have stables enough, you'll see he shall</LINE>

+<LINE>lack no barns.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>O illegitimate construction! I scorn that with my heels.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>'Tis almost five o'clock, cousin; tis time you were</LINE>

+<LINE>ready. By my troth, I am exceeding ill: heigh-ho!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>For a hawk, a horse, or a husband?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>For the letter that begins them all, H.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>Well, and you be not turned Turk, there's no more</LINE>

+<LINE>sailing by the star.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>What means the fool, trow?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>Nothing I; but God send every one their heart's desire!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>These gloves the count sent me; they are an</LINE>

+<LINE>excellent perfume.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>I am stuffed, cousin; I cannot smell.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>A maid, and stuffed! there's goodly catching of cold.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>O, God help me! God help me! how long have you</LINE>

+<LINE>professed apprehension?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>Even since you left it. Doth not my wit become me rarely?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>It is not seen enough, you should wear it in your</LINE>

+<LINE>cap. By my troth, I am sick.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>Get you some of this distilled Carduus Benedictus,</LINE>

+<LINE>and lay it to your heart: it is the only thing for a qualm.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>There thou prickest her with a thistle.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Benedictus! why Benedictus? you have some moral in</LINE>

+<LINE>this Benedictus.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>Moral! no, by my troth, I have no moral meaning; I</LINE>

+<LINE>meant, plain holy-thistle. You may think perchance</LINE>

+<LINE>that I think you are in love: nay, by'r lady, I am</LINE>

+<LINE>not such a fool to think what I list, nor I list</LINE>

+<LINE>not to think what I can, nor indeed I cannot think,</LINE>

+<LINE>if I would think my heart out of thinking, that you</LINE>

+<LINE>are in love or that you will be in love or that you</LINE>

+<LINE>can be in love. Yet Benedick was such another, and</LINE>

+<LINE>now is he become a man: he swore he would never</LINE>

+<LINE>marry, and yet now, in despite of his heart, he eats</LINE>

+<LINE>his meat without grudging: and how you may be</LINE>

+<LINE>converted I know not, but methinks you look with</LINE>

+<LINE>your eyes as other women do.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>What pace is this that thy tongue keeps?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>Not a false gallop.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Re-enter URSULA</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>URSULA</SPEAKER>

+<LINE>Madam, withdraw: the prince, the count, Signior</LINE>

+<LINE>Benedick, Don John, and all the gallants of the</LINE>

+<LINE>town, are come to fetch you to church.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>Help to dress me, good coz, good Meg, good Ursula.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt</STAGEDIR>

+</SCENE>

+

+<SCENE><TITLE>SCENE V.  Another room in LEONATO'S house.</TITLE>

+<STAGEDIR>Enter LEONATO, with DOGBERRY and VERGES</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>What would you with me, honest neighbour?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Marry, sir, I would have some confidence with you</LINE>

+<LINE>that decerns you nearly.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Brief, I pray you; for you see it is a busy time with me.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Marry, this it is, sir.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>VERGES</SPEAKER>

+<LINE>Yes, in truth it is, sir.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>What is it, my good friends?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Goodman Verges, sir, speaks a little off the</LINE>

+<LINE>matter: an old man, sir, and his wits are not so</LINE>

+<LINE>blunt as, God help, I would desire they were; but,</LINE>

+<LINE>in faith, honest as the skin between his brows.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>VERGES</SPEAKER>

+<LINE>Yes, I thank God I am as honest as any man living</LINE>

+<LINE>that is an old man and no honester than I.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Comparisons are odorous: palabras, neighbour Verges.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Neighbours, you are tedious.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>It pleases your worship to say so, but we are the</LINE>

+<LINE>poor duke's officers; but truly, for mine own part,</LINE>

+<LINE>if I were as tedious as a king, I could find it in</LINE>

+<LINE>my heart to bestow it all of your worship.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>All thy tediousness on me, ah?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Yea, an 'twere a thousand pound more than 'tis; for</LINE>

+<LINE>I hear as good exclamation on your worship as of any</LINE>

+<LINE>man in the city; and though I be but a poor man, I</LINE>

+<LINE>am glad to hear it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>VERGES</SPEAKER>

+<LINE>And so am I.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>I would fain know what you have to say.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>VERGES</SPEAKER>

+<LINE>Marry, sir, our watch to-night, excepting your</LINE>

+<LINE>worship's presence, ha' ta'en a couple of as arrant</LINE>

+<LINE>knaves as any in Messina.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>A good old man, sir; he will be talking: as they</LINE>

+<LINE>say, when the age is in, the wit is out: God help</LINE>

+<LINE>us! it is a world to see. Well said, i' faith,</LINE>

+<LINE>neighbour Verges: well, God's a good man; an two men</LINE>

+<LINE>ride of a horse, one must ride behind. An honest</LINE>

+<LINE>soul, i' faith, sir; by my troth he is, as ever</LINE>

+<LINE>broke bread; but God is to be worshipped; all men</LINE>

+<LINE>are not alike; alas, good neighbour!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Indeed, neighbour, he comes too short of you.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Gifts that God gives.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>I must leave you.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>One word, sir: our watch, sir, have indeed</LINE>

+<LINE>comprehended two aspicious persons, and we would</LINE>

+<LINE>have them this morning examined before your worship.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Take their examination yourself and bring it me: I</LINE>

+<LINE>am now in great haste, as it may appear unto you.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>It shall be suffigance.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Drink some wine ere you go: fare you well.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Enter a Messenger</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>Messenger</SPEAKER>

+<LINE>My lord, they stay for you to give your daughter to</LINE>

+<LINE>her husband.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>I'll wait upon them: I am ready.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt LEONATO and Messenger</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Go, good partner, go, get you to Francis Seacole;</LINE>

+<LINE>bid him bring his pen and inkhorn to the gaol: we</LINE>

+<LINE>are now to examination these men.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>VERGES</SPEAKER>

+<LINE>And we must do it wisely.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>We will spare for no wit, I warrant you; here's</LINE>

+<LINE>that shall drive some of them to a non-come: only</LINE>

+<LINE>get the learned writer to set down our</LINE>

+<LINE>excommunication and meet me at the gaol.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt</STAGEDIR>

+</SCENE>

+

+</ACT>

+

+<ACT><TITLE>ACT IV</TITLE>

+

+<SCENE><TITLE>SCENE I.  A church.</TITLE>

+<STAGEDIR>Enter DON PEDRO, DON JOHN, LEONATO, FRIAR FRANCIS,

+CLAUDIO, BENEDICK, HERO, BEATRICE, and Attendants</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Come, Friar Francis, be brief; only to the plain</LINE>

+<LINE>form of marriage, and you shall recount their</LINE>

+<LINE>particular duties afterwards.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>FRIAR FRANCIS</SPEAKER>

+<LINE>You come hither, my lord, to marry this lady.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>No.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>To be married to her: friar, you come to marry her.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>FRIAR FRANCIS</SPEAKER>

+<LINE>Lady, you come hither to be married to this count.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>I do.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>FRIAR FRANCIS</SPEAKER>

+<LINE>If either of you know any inward impediment why you</LINE>

+<LINE>should not be conjoined, charge you, on your souls,</LINE>

+<LINE>to utter it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Know you any, Hero?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>None, my lord.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>FRIAR FRANCIS</SPEAKER>

+<LINE>Know you any, count?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>I dare make his answer, none.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>O, what men dare do! what men may do! what men daily</LINE>

+<LINE>do, not knowing what they do!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>How now! interjections? Why, then, some be of</LINE>

+<LINE>laughing, as, ah, ha, he!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Stand thee by, friar. Father, by your leave:</LINE>

+<LINE>Will you with free and unconstrained soul</LINE>

+<LINE>Give me this maid, your daughter?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>As freely, son, as God did give her me.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>And what have I to give you back, whose worth</LINE>

+<LINE>May counterpoise this rich and precious gift?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Nothing, unless you render her again.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Sweet prince, you learn me noble thankfulness.</LINE>

+<LINE>There, Leonato, take her back again:</LINE>

+<LINE>Give not this rotten orange to your friend;</LINE>

+<LINE>She's but the sign and semblance of her honour.</LINE>

+<LINE>Behold how like a maid she blushes here!</LINE>

+<LINE>O, what authority and show of truth</LINE>

+<LINE>Can cunning sin cover itself withal!</LINE>

+<LINE>Comes not that blood as modest evidence</LINE>

+<LINE>To witness simple virtue? Would you not swear,</LINE>

+<LINE>All you that see her, that she were a maid,</LINE>

+<LINE>By these exterior shows? But she is none:</LINE>

+<LINE>She knows the heat of a luxurious bed;</LINE>

+<LINE>Her blush is guiltiness, not modesty.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>What do you mean, my lord?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Not to be married,</LINE>

+<LINE>Not to knit my soul to an approved wanton.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Dear my lord, if you, in your own proof,</LINE>

+<LINE>Have vanquish'd the resistance of her youth,</LINE>

+<LINE>And made defeat of her virginity,--</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>I know what you would say: if I have known her,</LINE>

+<LINE>You will say she did embrace me as a husband,</LINE>

+<LINE>And so extenuate the 'forehand sin:</LINE>

+<LINE>No, Leonato,</LINE>

+<LINE>I never tempted her with word too large;</LINE>

+<LINE>But, as a brother to his sister, show'd</LINE>

+<LINE>Bashful sincerity and comely love.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>And seem'd I ever otherwise to you?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Out on thee! Seeming! I will write against it:</LINE>

+<LINE>You seem to me as Dian in her orb,</LINE>

+<LINE>As chaste as is the bud ere it be blown;</LINE>

+<LINE>But you are more intemperate in your blood</LINE>

+<LINE>Than Venus, or those pamper'd animals</LINE>

+<LINE>That rage in savage sensuality.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>Is my lord well, that he doth speak so wide?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Sweet prince, why speak not you?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>What should I speak?</LINE>

+<LINE>I stand dishonour'd, that have gone about</LINE>

+<LINE>To link my dear friend to a common stale.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Are these things spoken, or do I but dream?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>Sir, they are spoken, and these things are true.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>This looks not like a nuptial.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>True! O God!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Leonato, stand I here?</LINE>

+<LINE>Is this the prince? is this the prince's brother?</LINE>

+<LINE>Is this face Hero's? are our eyes our own?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>All this is so: but what of this, my lord?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Let me but move one question to your daughter;</LINE>

+<LINE>And, by that fatherly and kindly power</LINE>

+<LINE>That you have in her, bid her answer truly.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>I charge thee do so, as thou art my child.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>O, God defend me! how am I beset!</LINE>

+<LINE>What kind of catechising call you this?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>To make you answer truly to your name.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>Is it not Hero? Who can blot that name</LINE>

+<LINE>With any just reproach?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Marry, that can Hero;</LINE>

+<LINE>Hero itself can blot out Hero's virtue.</LINE>

+<LINE>What man was he talk'd with you yesternight</LINE>

+<LINE>Out at your window betwixt twelve and one?</LINE>

+<LINE>Now, if you are a maid, answer to this.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>I talk'd with no man at that hour, my lord.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Why, then are you no maiden. Leonato,</LINE>

+<LINE>I am sorry you must hear: upon mine honour,</LINE>

+<LINE>Myself, my brother and this grieved count</LINE>

+<LINE>Did see her, hear her, at that hour last night</LINE>

+<LINE>Talk with a ruffian at her chamber-window</LINE>

+<LINE>Who hath indeed, most like a liberal villain,</LINE>

+<LINE>Confess'd the vile encounters they have had</LINE>

+<LINE>A thousand times in secret.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>Fie, fie! they are not to be named, my lord,</LINE>

+<LINE>Not to be spoke of;</LINE>

+<LINE>There is not chastity enough in language</LINE>

+<LINE>Without offence to utter them. Thus, pretty lady,</LINE>

+<LINE>I am sorry for thy much misgovernment.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>O Hero, what a Hero hadst thou been,</LINE>

+<LINE>If half thy outward graces had been placed</LINE>

+<LINE>About thy thoughts and counsels of thy heart!</LINE>

+<LINE>But fare thee well, most foul, most fair! farewell,</LINE>

+<LINE>Thou pure impiety and impious purity!</LINE>

+<LINE>For thee I'll lock up all the gates of love,</LINE>

+<LINE>And on my eyelids shall conjecture hang,</LINE>

+<LINE>To turn all beauty into thoughts of harm,</LINE>

+<LINE>And never shall it more be gracious.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Hath no man's dagger here a point for me?</LINE>

+</SPEECH>

+

+

+<STAGEDIR>HERO swoons</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Why, how now, cousin! wherefore sink you down?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON JOHN</SPEAKER>

+<LINE>Come, let us go. These things, come thus to light,</LINE>

+<LINE>Smother her spirits up.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt DON PEDRO, DON JOHN, and CLAUDIO</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>How doth the lady?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Dead, I think. Help, uncle!</LINE>

+<LINE>Hero! why, Hero! Uncle! Signior Benedick! Friar!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>O Fate! take not away thy heavy hand.</LINE>

+<LINE>Death is the fairest cover for her shame</LINE>

+<LINE>That may be wish'd for.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>How now, cousin Hero!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>FRIAR FRANCIS</SPEAKER>

+<LINE>Have comfort, lady.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Dost thou look up?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>FRIAR FRANCIS</SPEAKER>

+<LINE>Yea, wherefore should she not?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Wherefore! Why, doth not every earthly thing</LINE>

+<LINE>Cry shame upon her? Could she here deny</LINE>

+<LINE>The story that is printed in her blood?</LINE>

+<LINE>Do not live, Hero; do not ope thine eyes:</LINE>

+<LINE>For, did I think thou wouldst not quickly die,</LINE>

+<LINE>Thought I thy spirits were stronger than thy shames,</LINE>

+<LINE>Myself would, on the rearward of reproaches,</LINE>

+<LINE>Strike at thy life. Grieved I, I had but one?</LINE>

+<LINE>Chid I for that at frugal nature's frame?</LINE>

+<LINE>O, one too much by thee! Why had I one?</LINE>

+<LINE>Why ever wast thou lovely in my eyes?</LINE>

+<LINE>Why had I not with charitable hand</LINE>

+<LINE>Took up a beggar's issue at my gates,</LINE>

+<LINE>Who smirch'd thus and mired with infamy,</LINE>

+<LINE>I might have said 'No part of it is mine;</LINE>

+<LINE>This shame derives itself from unknown loins'?</LINE>

+<LINE>But mine and mine I loved and mine I praised</LINE>

+<LINE>And mine that I was proud on, mine so much</LINE>

+<LINE>That I myself was to myself not mine,</LINE>

+<LINE>Valuing of her,--why, she, O, she is fallen</LINE>

+<LINE>Into a pit of ink, that the wide sea</LINE>

+<LINE>Hath drops too few to wash her clean again</LINE>

+<LINE>And salt too little which may season give</LINE>

+<LINE>To her foul-tainted flesh!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Sir, sir, be patient.</LINE>

+<LINE>For my part, I am so attired in wonder,</LINE>

+<LINE>I know not what to say.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>O, on my soul, my cousin is belied!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Lady, were you her bedfellow last night?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>No, truly not; although, until last night,</LINE>

+<LINE>I have this twelvemonth been her bedfellow.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Confirm'd, confirm'd! O, that is stronger made</LINE>

+<LINE>Which was before barr'd up with ribs of iron!</LINE>

+<LINE>Would the two princes lie, and Claudio lie,</LINE>

+<LINE>Who loved her so, that, speaking of her foulness,</LINE>

+<LINE>Wash'd it with tears? Hence from her! let her die.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>FRIAR FRANCIS</SPEAKER>

+<LINE>Hear me a little; for I have only been</LINE>

+<LINE>Silent so long and given way unto</LINE>

+<LINE>This course of fortune</LINE>

+<LINE>By noting of the lady. I have mark'd</LINE>

+<LINE>A thousand blushing apparitions</LINE>

+<LINE>To start into her face, a thousand innocent shames</LINE>

+<LINE>In angel whiteness beat away those blushes;</LINE>

+<LINE>And in her eye there hath appear'd a fire,</LINE>

+<LINE>To burn the errors that these princes hold</LINE>

+<LINE>Against her maiden truth. Call me a fool;</LINE>

+<LINE>Trust not my reading nor my observations,</LINE>

+<LINE>Which with experimental seal doth warrant</LINE>

+<LINE>The tenor of my book; trust not my age,</LINE>

+<LINE>My reverence, calling, nor divinity,</LINE>

+<LINE>If this sweet lady lie not guiltless here</LINE>

+<LINE>Under some biting error.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Friar, it cannot be.</LINE>

+<LINE>Thou seest that all the grace that she hath left</LINE>

+<LINE>Is that she will not add to her damnation</LINE>

+<LINE>A sin of perjury; she not denies it:</LINE>

+<LINE>Why seek'st thou then to cover with excuse</LINE>

+<LINE>That which appears in proper nakedness?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>FRIAR FRANCIS</SPEAKER>

+<LINE>Lady, what man is he you are accused of?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>They know that do accuse me; I know none:</LINE>

+<LINE>If I know more of any man alive</LINE>

+<LINE>Than that which maiden modesty doth warrant,</LINE>

+<LINE>Let all my sins lack mercy! O my father,</LINE>

+<LINE>Prove you that any man with me conversed</LINE>

+<LINE>At hours unmeet, or that I yesternight</LINE>

+<LINE>Maintain'd the change of words with any creature,</LINE>

+<LINE>Refuse me, hate me, torture me to death!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>FRIAR FRANCIS</SPEAKER>

+<LINE>There is some strange misprision in the princes.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Two of them have the very bent of honour;</LINE>

+<LINE>And if their wisdoms be misled in this,</LINE>

+<LINE>The practise of it lives in John the bastard,</LINE>

+<LINE>Whose spirits toil in frame of villanies.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>I know not. If they speak but truth of her,</LINE>

+<LINE>These hands shall tear her; if they wrong her honour,</LINE>

+<LINE>The proudest of them shall well hear of it.</LINE>

+<LINE>Time hath not yet so dried this blood of mine,</LINE>

+<LINE>Nor age so eat up my invention,</LINE>

+<LINE>Nor fortune made such havoc of my means,</LINE>

+<LINE>Nor my bad life reft me so much of friends,</LINE>

+<LINE>But they shall find, awaked in such a kind,</LINE>

+<LINE>Both strength of limb and policy of mind,</LINE>

+<LINE>Ability in means and choice of friends,</LINE>

+<LINE>To quit me of them throughly.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>FRIAR FRANCIS</SPEAKER>

+<LINE>Pause awhile,</LINE>

+<LINE>And let my counsel sway you in this case.</LINE>

+<LINE>Your daughter here the princes left for dead:</LINE>

+<LINE>Let her awhile be secretly kept in,</LINE>

+<LINE>And publish it that she is dead indeed;</LINE>

+<LINE>Maintain a mourning ostentation</LINE>

+<LINE>And on your family's old monument</LINE>

+<LINE>Hang mournful epitaphs and do all rites</LINE>

+<LINE>That appertain unto a burial.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>What shall become of this? what will this do?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>FRIAR FRANCIS</SPEAKER>

+<LINE>Marry, this well carried shall on her behalf</LINE>

+<LINE>Change slander to remorse; that is some good:</LINE>

+<LINE>But not for that dream I on this strange course,</LINE>

+<LINE>But on this travail look for greater birth.</LINE>

+<LINE>She dying, as it must so be maintain'd,</LINE>

+<LINE>Upon the instant that she was accused,</LINE>

+<LINE>Shall be lamented, pitied and excused</LINE>

+<LINE>Of every hearer: for it so falls out</LINE>

+<LINE>That what we have we prize not to the worth</LINE>

+<LINE>Whiles we enjoy it, but being lack'd and lost,</LINE>

+<LINE>Why, then we rack the value, then we find</LINE>

+<LINE>The virtue that possession would not show us</LINE>

+<LINE>Whiles it was ours. So will it fare with Claudio:</LINE>

+<LINE>When he shall hear she died upon his words,</LINE>

+<LINE>The idea of her life shall sweetly creep</LINE>

+<LINE>Into his study of imagination,</LINE>

+<LINE>And every lovely organ of her life</LINE>

+<LINE>Shall come apparell'd in more precious habit,</LINE>

+<LINE>More moving-delicate and full of life,</LINE>

+<LINE>Into the eye and prospect of his soul,</LINE>

+<LINE>Than when she lived indeed; then shall he mourn,</LINE>

+<LINE>If ever love had interest in his liver,</LINE>

+<LINE>And wish he had not so accused her,</LINE>

+<LINE>No, though he thought his accusation true.</LINE>

+<LINE>Let this be so, and doubt not but success</LINE>

+<LINE>Will fashion the event in better shape</LINE>

+<LINE>Than I can lay it down in likelihood.</LINE>

+<LINE>But if all aim but this be levell'd false,</LINE>

+<LINE>The supposition of the lady's death</LINE>

+<LINE>Will quench the wonder of her infamy:</LINE>

+<LINE>And if it sort not well, you may conceal her,</LINE>

+<LINE>As best befits her wounded reputation,</LINE>

+<LINE>In some reclusive and religious life,</LINE>

+<LINE>Out of all eyes, tongues, minds and injuries.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Signior Leonato, let the friar advise you:</LINE>

+<LINE>And though you know my inwardness and love</LINE>

+<LINE>Is very much unto the prince and Claudio,</LINE>

+<LINE>Yet, by mine honour, I will deal in this</LINE>

+<LINE>As secretly and justly as your soul</LINE>

+<LINE>Should with your body.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Being that I flow in grief,</LINE>

+<LINE>The smallest twine may lead me.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>FRIAR FRANCIS</SPEAKER>

+<LINE>'Tis well consented: presently away;</LINE>

+<LINE>For to strange sores strangely they strain the cure.</LINE>

+<LINE>Come, lady, die to live: this wedding-day</LINE>

+<LINE>Perhaps is but prolong'd: have patience and endure.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt all but BENEDICK and BEATRICE</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Lady Beatrice, have you wept all this while?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Yea, and I will weep a while longer.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>I will not desire that.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>You have no reason; I do it freely.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Surely I do believe your fair cousin is wronged.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Ah, how much might the man deserve of me that would right her!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Is there any way to show such friendship?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>A very even way, but no such friend.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>May a man do it?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>It is a man's office, but not yours.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>I do love nothing in the world so well as you: is</LINE>

+<LINE>not that strange?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>As strange as the thing I know not. It were as</LINE>

+<LINE>possible for me to say I loved nothing so well as</LINE>

+<LINE>you: but believe me not; and yet I lie not; I</LINE>

+<LINE>confess nothing, nor I deny nothing. I am sorry for my cousin.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>By my sword, Beatrice, thou lovest me.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Do not swear, and eat it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>I will swear by it that you love me; and I will make</LINE>

+<LINE>him eat it that says I love not you.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Will you not eat your word?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>With no sauce that can be devised to it. I protest</LINE>

+<LINE>I love thee.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Why, then, God forgive me!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>What offence, sweet Beatrice?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>You have stayed me in a happy hour: I was about to</LINE>

+<LINE>protest I loved you.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>And do it with all thy heart.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>I love you with so much of my heart that none is</LINE>

+<LINE>left to protest.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Come, bid me do any thing for thee.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Kill Claudio.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Ha! not for the wide world.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>You kill me to deny it. Farewell.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Tarry, sweet Beatrice.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>I am gone, though I am here: there is no love in</LINE>

+<LINE>you: nay, I pray you, let me go.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Beatrice,--</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>In faith, I will go.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>We'll be friends first.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>You dare easier be friends with me than fight with mine enemy.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Is Claudio thine enemy?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Is he not approved in the height a villain, that</LINE>

+<LINE>hath slandered, scorned, dishonoured my kinswoman? O</LINE>

+<LINE>that I were a man! What, bear her in hand until they</LINE>

+<LINE>come to take hands; and then, with public</LINE>

+<LINE>accusation, uncovered slander, unmitigated rancour,</LINE>

+<LINE>--O God, that I were a man! I would eat his heart</LINE>

+<LINE>in the market-place.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Hear me, Beatrice,--</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Talk with a man out at a window! A proper saying!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Nay, but, Beatrice,--</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Sweet Hero! She is wronged, she is slandered, she is undone.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Beat--</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Princes and counties! Surely, a princely testimony,</LINE>

+<LINE>a goodly count, Count Comfect; a sweet gallant,</LINE>

+<LINE>surely! O that I were a man for his sake! or that I</LINE>

+<LINE>had any friend would be a man for my sake! But</LINE>

+<LINE>manhood is melted into courtesies, valour into</LINE>

+<LINE>compliment, and men are only turned into tongue, and</LINE>

+<LINE>trim ones too: he is now as valiant as Hercules</LINE>

+<LINE>that only tells a lie and swears it. I cannot be a</LINE>

+<LINE>man with wishing, therefore I will die a woman with grieving.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Tarry, good Beatrice. By this hand, I love thee.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Use it for my love some other way than swearing by it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Think you in your soul the Count Claudio hath wronged Hero?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Yea, as sure as I have a thought or a soul.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Enough, I am engaged; I will challenge him. I will</LINE>

+<LINE>kiss your hand, and so I leave you. By this hand,</LINE>

+<LINE>Claudio shall render me a dear account. As you</LINE>

+<LINE>hear of me, so think of me. Go, comfort your</LINE>

+<LINE>cousin: I must say she is dead: and so, farewell.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt</STAGEDIR>

+</SCENE>

+

+<SCENE><TITLE>SCENE II.  A prison.</TITLE>

+<STAGEDIR>Enter DOGBERRY, VERGES, and Sexton, in gowns; and

+the Watch, with CONRADE and BORACHIO</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Is our whole dissembly appeared?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>VERGES</SPEAKER>

+<LINE>O, a stool and a cushion for the sexton.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Sexton</SPEAKER>

+<LINE>Which be the malefactors?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Marry, that am I and my partner.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>VERGES</SPEAKER>

+<LINE>Nay, that's certain; we have the exhibition to examine.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Sexton</SPEAKER>

+<LINE>But which are the offenders that are to be</LINE>

+<LINE>examined? let them come before master constable.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Yea, marry, let them come before me. What is your</LINE>

+<LINE>name, friend?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Borachio.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Pray, write down, Borachio. Yours, sirrah?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>I am a gentleman, sir, and my name is Conrade.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Write down, master gentleman Conrade. Masters, do</LINE>

+<LINE>you serve God?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Yea, sir, we hope.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Write down, that they hope they serve God: and</LINE>

+<LINE>write God first; for God defend but God should go</LINE>

+<LINE>before such villains! Masters, it is proved already</LINE>

+<LINE>that you are little better than false knaves; and it</LINE>

+<LINE>will go near to be thought so shortly. How answer</LINE>

+<LINE>you for yourselves?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>Marry, sir, we say we are none.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>A marvellous witty fellow, I assure you: but I</LINE>

+<LINE>will go about with him. Come you hither, sirrah; a</LINE>

+<LINE>word in your ear: sir, I say to you, it is thought</LINE>

+<LINE>you are false knaves.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Sir, I say to you we are none.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Well, stand aside. 'Fore God, they are both in a</LINE>

+<LINE>tale. Have you writ down, that they are none?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Sexton</SPEAKER>

+<LINE>Master constable, you go not the way to examine:</LINE>

+<LINE>you must call forth the watch that are their accusers.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Yea, marry, that's the eftest way. Let the watch</LINE>

+<LINE>come forth. Masters, I charge you, in the prince's</LINE>

+<LINE>name, accuse these men.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>First Watchman</SPEAKER>

+<LINE>This man said, sir, that Don John, the prince's</LINE>

+<LINE>brother, was a villain.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Write down Prince John a villain. Why, this is flat</LINE>

+<LINE>perjury, to call a prince's brother villain.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Master constable,--</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Pray thee, fellow, peace: I do not like thy look,</LINE>

+<LINE>I promise thee.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Sexton</SPEAKER>

+<LINE>What heard you him say else?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Second Watchman</SPEAKER>

+<LINE>Marry, that he had received a thousand ducats of</LINE>

+<LINE>Don John for accusing the Lady Hero wrongfully.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Flat burglary as ever was committed.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>VERGES</SPEAKER>

+<LINE>Yea, by mass, that it is.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Sexton</SPEAKER>

+<LINE>What else, fellow?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>First Watchman</SPEAKER>

+<LINE>And that Count Claudio did mean, upon his words, to</LINE>

+<LINE>disgrace Hero before the whole assembly. and not marry her.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>O villain! thou wilt be condemned into everlasting</LINE>

+<LINE>redemption for this.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Sexton</SPEAKER>

+<LINE>What else?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Watchman</SPEAKER>

+<LINE>This is all.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Sexton</SPEAKER>

+<LINE>And this is more, masters, than you can deny.</LINE>

+<LINE>Prince John is this morning secretly stolen away;</LINE>

+<LINE>Hero was in this manner accused, in this very manner</LINE>

+<LINE>refused, and upon the grief of this suddenly died.</LINE>

+<LINE>Master constable, let these men be bound, and</LINE>

+<LINE>brought to Leonato's: I will go before and show</LINE>

+<LINE>him their examination.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exit</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Come, let them be opinioned.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>VERGES</SPEAKER>

+<LINE>Let them be in the hands--</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>Off, coxcomb!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>God's my life, where's the sexton? let him write</LINE>

+<LINE>down the prince's officer coxcomb. Come, bind them.</LINE>

+<LINE>Thou naughty varlet!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CONRADE</SPEAKER>

+<LINE>Away! you are an ass, you are an ass.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Dost thou not suspect my place? dost thou not</LINE>

+<LINE>suspect my years? O that he were here to write me</LINE>

+<LINE>down an ass! But, masters, remember that I am an</LINE>

+<LINE>ass; though it be not written down, yet forget not</LINE>

+<LINE>that I am an ass. No, thou villain, thou art full of</LINE>

+<LINE>piety, as shall be proved upon thee by good witness.</LINE>

+<LINE>I am a wise fellow, and, which is more, an officer,</LINE>

+<LINE>and, which is more, a householder, and, which is</LINE>

+<LINE>more, as pretty a piece of flesh as any is in</LINE>

+<LINE>Messina, and one that knows the law, go to; and a</LINE>

+<LINE>rich fellow enough, go to; and a fellow that hath</LINE>

+<LINE>had losses, and one that hath two gowns and every</LINE>

+<LINE>thing handsome about him. Bring him away. O that</LINE>

+<LINE>I had been writ down an ass!</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt</STAGEDIR>

+</SCENE>

+

+</ACT>

+

+<ACT><TITLE>ACT V</TITLE>

+

+<SCENE><TITLE>SCENE I.  Before LEONATO'S house.</TITLE>

+<STAGEDIR>Enter LEONATO and ANTONIO</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>If you go on thus, you will kill yourself:</LINE>

+<LINE>And 'tis not wisdom thus to second grief</LINE>

+<LINE>Against yourself.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>I pray thee, cease thy counsel,</LINE>

+<LINE>Which falls into mine ears as profitless</LINE>

+<LINE>As water in a sieve: give not me counsel;</LINE>

+<LINE>Nor let no comforter delight mine ear</LINE>

+<LINE>But such a one whose wrongs do suit with mine.</LINE>

+<LINE>Bring me a father that so loved his child,</LINE>

+<LINE>Whose joy of her is overwhelm'd like mine,</LINE>

+<LINE>And bid him speak of patience;</LINE>

+<LINE>Measure his woe the length and breadth of mine</LINE>

+<LINE>And let it answer every strain for strain,</LINE>

+<LINE>As thus for thus and such a grief for such,</LINE>

+<LINE>In every lineament, branch, shape, and form:</LINE>

+<LINE>If such a one will smile and stroke his beard,</LINE>

+<LINE>Bid sorrow wag, cry 'hem!' when he should groan,</LINE>

+<LINE>Patch grief with proverbs, make misfortune drunk</LINE>

+<LINE>With candle-wasters; bring him yet to me,</LINE>

+<LINE>And I of him will gather patience.</LINE>

+<LINE>But there is no such man: for, brother, men</LINE>

+<LINE>Can counsel and speak comfort to that grief</LINE>

+<LINE>Which they themselves not feel; but, tasting it,</LINE>

+<LINE>Their counsel turns to passion, which before</LINE>

+<LINE>Would give preceptial medicine to rage,</LINE>

+<LINE>Fetter strong madness in a silken thread,</LINE>

+<LINE>Charm ache with air and agony with words:</LINE>

+<LINE>No, no; 'tis all men's office to speak patience</LINE>

+<LINE>To those that wring under the load of sorrow,</LINE>

+<LINE>But no man's virtue nor sufficiency</LINE>

+<LINE>To be so moral when he shall endure</LINE>

+<LINE>The like himself. Therefore give me no counsel:</LINE>

+<LINE>My griefs cry louder than advertisement.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>Therein do men from children nothing differ.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>I pray thee, peace. I will be flesh and blood;</LINE>

+<LINE>For there was never yet philosopher</LINE>

+<LINE>That could endure the toothache patiently,</LINE>

+<LINE>However they have writ the style of gods</LINE>

+<LINE>And made a push at chance and sufferance.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>Yet bend not all the harm upon yourself;</LINE>

+<LINE>Make those that do offend you suffer too.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>There thou speak'st reason: nay, I will do so.</LINE>

+<LINE>My soul doth tell me Hero is belied;</LINE>

+<LINE>And that shall Claudio know; so shall the prince</LINE>

+<LINE>And all of them that thus dishonour her.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>Here comes the prince and Claudio hastily.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Enter DON PEDRO and CLAUDIO</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Good den, good den.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Good day to both of you.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Hear you. my lords,--</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>We have some haste, Leonato.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Some haste, my lord! well, fare you well, my lord:</LINE>

+<LINE>Are you so hasty now? well, all is one.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Nay, do not quarrel with us, good old man.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>If he could right himself with quarreling,</LINE>

+<LINE>Some of us would lie low.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Who wrongs him?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Marry, thou dost wrong me; thou dissembler, thou:--</LINE>

+<LINE>Nay, never lay thy hand upon thy sword;</LINE>

+<LINE>I fear thee not.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Marry, beshrew my hand,</LINE>

+<LINE>If it should give your age such cause of fear:</LINE>

+<LINE>In faith, my hand meant nothing to my sword.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Tush, tush, man; never fleer and jest at me:</LINE>

+<LINE>I speak not like a dotard nor a fool,</LINE>

+<LINE>As under privilege of age to brag</LINE>

+<LINE>What I have done being young, or what would do</LINE>

+<LINE>Were I not old. Know, Claudio, to thy head,</LINE>

+<LINE>Thou hast so wrong'd mine innocent child and me</LINE>

+<LINE>That I am forced to lay my reverence by</LINE>

+<LINE>And, with grey hairs and bruise of many days,</LINE>

+<LINE>Do challenge thee to trial of a man.</LINE>

+<LINE>I say thou hast belied mine innocent child;</LINE>

+<LINE>Thy slander hath gone through and through her heart,</LINE>

+<LINE>And she lies buried with her ancestors;</LINE>

+<LINE>O, in a tomb where never scandal slept,</LINE>

+<LINE>Save this of hers, framed by thy villany!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>My villany?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Thine, Claudio; thine, I say.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>You say not right, old man.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>My lord, my lord,</LINE>

+<LINE>I'll prove it on his body, if he dare,</LINE>

+<LINE>Despite his nice fence and his active practise,</LINE>

+<LINE>His May of youth and bloom of lustihood.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Away! I will not have to do with you.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Canst thou so daff me? Thou hast kill'd my child:</LINE>

+<LINE>If thou kill'st me, boy, thou shalt kill a man.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>He shall kill two of us, and men indeed:</LINE>

+<LINE>But that's no matter; let him kill one first;</LINE>

+<LINE>Win me and wear me; let him answer me.</LINE>

+<LINE>Come, follow me, boy; come, sir boy, come, follow me:</LINE>

+<LINE>Sir boy, I'll whip you from your foining fence;</LINE>

+<LINE>Nay, as I am a gentleman, I will.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Brother,--</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>Content yourself. God knows I loved my niece;</LINE>

+<LINE>And she is dead, slander'd to death by villains,</LINE>

+<LINE>That dare as well answer a man indeed</LINE>

+<LINE>As I dare take a serpent by the tongue:</LINE>

+<LINE>Boys, apes, braggarts, Jacks, milksops!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Brother Antony,--</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>Hold you content. What, man! I know them, yea,</LINE>

+<LINE>And what they weigh, even to the utmost scruple,--</LINE>

+<LINE>Scrambling, out-facing, fashion-monging boys,</LINE>

+<LINE>That lie and cog and flout, deprave and slander,</LINE>

+<LINE>Go anticly, show outward hideousness,</LINE>

+<LINE>And speak off half a dozen dangerous words,</LINE>

+<LINE>How they might hurt their enemies, if they durst;</LINE>

+<LINE>And this is all.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>But, brother Antony,--</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>Come, 'tis no matter:</LINE>

+<LINE>Do not you meddle; let me deal in this.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Gentlemen both, we will not wake your patience.</LINE>

+<LINE>My heart is sorry for your daughter's death:</LINE>

+<LINE>But, on my honour, she was charged with nothing</LINE>

+<LINE>But what was true and very full of proof.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>My lord, my lord,--</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>I will not hear you.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>No? Come, brother; away! I will be heard.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>And shall, or some of us will smart for it.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt LEONATO and ANTONIO</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>See, see; here comes the man we went to seek.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Enter BENEDICK</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Now, signior, what news?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Good day, my lord.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Welcome, signior: you are almost come to part</LINE>

+<LINE>almost a fray.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>We had like to have had our two noses snapped off</LINE>

+<LINE>with two old men without teeth.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Leonato and his brother. What thinkest thou? Had</LINE>

+<LINE>we fought, I doubt we should have been too young for them.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>In a false quarrel there is no true valour. I came</LINE>

+<LINE>to seek you both.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>We have been up and down to seek thee; for we are</LINE>

+<LINE>high-proof melancholy and would fain have it beaten</LINE>

+<LINE>away. Wilt thou use thy wit?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>It is in my scabbard: shall I draw it?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Dost thou wear thy wit by thy side?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Never any did so, though very many have been beside</LINE>

+<LINE>their wit. I will bid thee draw, as we do the</LINE>

+<LINE>minstrels; draw, to pleasure us.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>As I am an honest man, he looks pale. Art thou</LINE>

+<LINE>sick, or angry?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>What, courage, man! What though care killed a cat,</LINE>

+<LINE>thou hast mettle enough in thee to kill care.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Sir, I shall meet your wit in the career, and you</LINE>

+<LINE>charge it against me. I pray you choose another subject.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Nay, then, give him another staff: this last was</LINE>

+<LINE>broke cross.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>By this light, he changes more and more: I think</LINE>

+<LINE>he be angry indeed.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>If he be, he knows how to turn his girdle.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Shall I speak a word in your ear?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>God bless me from a challenge!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE><STAGEDIR>Aside to CLAUDIO</STAGEDIR>  You are a villain; I jest not:</LINE>

+<LINE>I will make it good how you dare, with what you</LINE>

+<LINE>dare, and when you dare. Do me right, or I will</LINE>

+<LINE>protest your cowardice. You have killed a sweet</LINE>

+<LINE>lady, and her death shall fall heavy on you. Let me</LINE>

+<LINE>hear from you.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Well, I will meet you, so I may have good cheer.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>What, a feast, a feast?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>I' faith, I thank him; he hath bid me to a calf's</LINE>

+<LINE>head and a capon; the which if I do not carve most</LINE>

+<LINE>curiously, say my knife's naught. Shall I not find</LINE>

+<LINE>a woodcock too?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Sir, your wit ambles well; it goes easily.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>I'll tell thee how Beatrice praised thy wit the</LINE>

+<LINE>other day. I said, thou hadst a fine wit: 'True,'</LINE>

+<LINE>said she, 'a fine little one.' 'No,' said I, 'a</LINE>

+<LINE>great wit:' 'Right,' says she, 'a great gross one.'</LINE>

+<LINE>'Nay,' said I, 'a good wit:' 'Just,' said she, 'it</LINE>

+<LINE>hurts nobody.' 'Nay,' said I, 'the gentleman</LINE>

+<LINE>is wise:' 'Certain,' said she, 'a wise gentleman.'</LINE>

+<LINE>'Nay,' said I, 'he hath the tongues:' 'That I</LINE>

+<LINE>believe,' said she, 'for he swore a thing to me on</LINE>

+<LINE>Monday night, which he forswore on Tuesday morning;</LINE>

+<LINE>there's a double tongue; there's two tongues.' Thus</LINE>

+<LINE>did she, an hour together, transshape thy particular</LINE>

+<LINE>virtues: yet at last she concluded with a sigh, thou</LINE>

+<LINE>wast the properest man in Italy.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>For the which she wept heartily and said she cared</LINE>

+<LINE>not.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Yea, that she did: but yet, for all that, an if she</LINE>

+<LINE>did not hate him deadly, she would love him dearly:</LINE>

+<LINE>the old man's daughter told us all.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>All, all; and, moreover, God saw him when he was</LINE>

+<LINE>hid in the garden.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>But when shall we set the savage bull's horns on</LINE>

+<LINE>the sensible Benedick's head?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Yea, and text underneath, 'Here dwells Benedick the</LINE>

+<LINE>married man'?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Fare you well, boy: you know my mind. I will leave</LINE>

+<LINE>you now to your gossip-like humour: you break jests</LINE>

+<LINE>as braggarts do their blades, which God be thanked,</LINE>

+<LINE>hurt not. My lord, for your many courtesies I thank</LINE>

+<LINE>you: I must discontinue your company: your brother</LINE>

+<LINE>the bastard is fled from Messina: you have among</LINE>

+<LINE>you killed a sweet and innocent lady. For my Lord</LINE>

+<LINE>Lackbeard there, he and I shall meet: and, till</LINE>

+<LINE>then, peace be with him.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exit</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>He is in earnest.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>In most profound earnest; and, I'll warrant you, for</LINE>

+<LINE>the love of Beatrice.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>And hath challenged thee.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Most sincerely.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>What a pretty thing man is when he goes in his</LINE>

+<LINE>doublet and hose and leaves off his wit!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>He is then a giant to an ape; but then is an ape a</LINE>

+<LINE>doctor to such a man.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>But, soft you, let me be: pluck up, my heart, and</LINE>

+<LINE>be sad. Did he not say, my brother was fled?</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Enter DOGBERRY, VERGES, and the Watch, with CONRADE

+and BORACHIO</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Come you, sir: if justice cannot tame you, she</LINE>

+<LINE>shall ne'er weigh more reasons in her balance: nay,</LINE>

+<LINE>an you be a cursing hypocrite once, you must be looked to.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>How now? two of my brother's men bound! Borachio</LINE>

+<LINE>one!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Hearken after their offence, my lord.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Officers, what offence have these men done?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Marry, sir, they have committed false report;</LINE>

+<LINE>moreover, they have spoken untruths; secondarily,</LINE>

+<LINE>they are slanders; sixth and lastly, they have</LINE>

+<LINE>belied a lady; thirdly, they have verified unjust</LINE>

+<LINE>things; and, to conclude, they are lying knaves.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>First, I ask thee what they have done; thirdly, I</LINE>

+<LINE>ask thee what's their offence; sixth and lastly, why</LINE>

+<LINE>they are committed; and, to conclude, what you lay</LINE>

+<LINE>to their charge.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Rightly reasoned, and in his own division: and, by</LINE>

+<LINE>my troth, there's one meaning well suited.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Who have you offended, masters, that you are thus</LINE>

+<LINE>bound to your answer? this learned constable is</LINE>

+<LINE>too cunning to be understood: what's your offence?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Sweet prince, let me go no farther to mine answer:</LINE>

+<LINE>do you hear me, and let this count kill me. I have</LINE>

+<LINE>deceived even your very eyes: what your wisdoms</LINE>

+<LINE>could not discover, these shallow fools have brought</LINE>

+<LINE>to light: who in the night overheard me confessing</LINE>

+<LINE>to this man how Don John your brother incensed me</LINE>

+<LINE>to slander the Lady Hero, how you were brought into</LINE>

+<LINE>the orchard and saw me court Margaret in Hero's</LINE>

+<LINE>garments, how you disgraced her, when you should</LINE>

+<LINE>marry her: my villany they have upon record; which</LINE>

+<LINE>I had rather seal with my death than repeat over</LINE>

+<LINE>to my shame. The lady is dead upon mine and my</LINE>

+<LINE>master's false accusation; and, briefly, I desire</LINE>

+<LINE>nothing but the reward of a villain.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Runs not this speech like iron through your blood?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>I have drunk poison whiles he utter'd it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>But did my brother set thee on to this?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Yea, and paid me richly for the practise of it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>He is composed and framed of treachery:</LINE>

+<LINE>And fled he is upon this villany.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Sweet Hero! now thy image doth appear</LINE>

+<LINE>In the rare semblance that I loved it first.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Come, bring away the plaintiffs: by this time our</LINE>

+<LINE>sexton hath reformed Signior Leonato of the matter:</LINE>

+<LINE>and, masters, do not forget to specify, when time</LINE>

+<LINE>and place shall serve, that I am an ass.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>VERGES</SPEAKER>

+<LINE>Here, here comes master Signior Leonato, and the</LINE>

+<LINE>Sexton too.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Re-enter LEONATO and ANTONIO, with the Sexton</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Which is the villain? let me see his eyes,</LINE>

+<LINE>That, when I note another man like him,</LINE>

+<LINE>I may avoid him: which of these is he?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>If you would know your wronger, look on me.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Art thou the slave that with thy breath hast kill'd</LINE>

+<LINE>Mine innocent child?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>Yea, even I alone.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>No, not so, villain; thou beliest thyself:</LINE>

+<LINE>Here stand a pair of honourable men;</LINE>

+<LINE>A third is fled, that had a hand in it.</LINE>

+<LINE>I thank you, princes, for my daughter's death:</LINE>

+<LINE>Record it with your high and worthy deeds:</LINE>

+<LINE>'Twas bravely done, if you bethink you of it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>I know not how to pray your patience;</LINE>

+<LINE>Yet I must speak. Choose your revenge yourself;</LINE>

+<LINE>Impose me to what penance your invention</LINE>

+<LINE>Can lay upon my sin: yet sinn'd I not</LINE>

+<LINE>But in mistaking.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>By my soul, nor I:</LINE>

+<LINE>And yet, to satisfy this good old man,</LINE>

+<LINE>I would bend under any heavy weight</LINE>

+<LINE>That he'll enjoin me to.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>I cannot bid you bid my daughter live;</LINE>

+<LINE>That were impossible: but, I pray you both,</LINE>

+<LINE>Possess the people in Messina here</LINE>

+<LINE>How innocent she died; and if your love</LINE>

+<LINE>Can labour ought in sad invention,</LINE>

+<LINE>Hang her an epitaph upon her tomb</LINE>

+<LINE>And sing it to her bones, sing it to-night:</LINE>

+<LINE>To-morrow morning come you to my house,</LINE>

+<LINE>And since you could not be my son-in-law,</LINE>

+<LINE>Be yet my nephew: my brother hath a daughter,</LINE>

+<LINE>Almost the copy of my child that's dead,</LINE>

+<LINE>And she alone is heir to both of us:</LINE>

+<LINE>Give her the right you should have given her cousin,</LINE>

+<LINE>And so dies my revenge.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>O noble sir,</LINE>

+<LINE>Your over-kindness doth wring tears from me!</LINE>

+<LINE>I do embrace your offer; and dispose</LINE>

+<LINE>For henceforth of poor Claudio.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>To-morrow then I will expect your coming;</LINE>

+<LINE>To-night I take my leave. This naughty man</LINE>

+<LINE>Shall face to face be brought to Margaret,</LINE>

+<LINE>Who I believe was pack'd in all this wrong,</LINE>

+<LINE>Hired to it by your brother.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BORACHIO</SPEAKER>

+<LINE>No, by my soul, she was not,</LINE>

+<LINE>Nor knew not what she did when she spoke to me,</LINE>

+<LINE>But always hath been just and virtuous</LINE>

+<LINE>In any thing that I do know by her.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Moreover, sir, which indeed is not under white and</LINE>

+<LINE>black, this plaintiff here, the offender, did call</LINE>

+<LINE>me ass: I beseech you, let it be remembered in his</LINE>

+<LINE>punishment. And also, the watch heard them talk of</LINE>

+<LINE>one Deformed: they say be wears a key in his ear and</LINE>

+<LINE>a lock hanging by it, and borrows money in God's</LINE>

+<LINE>name, the which he hath used so long and never paid</LINE>

+<LINE>that now men grow hard-hearted and will lend nothing</LINE>

+<LINE>for God's sake: pray you, examine him upon that point.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>I thank thee for thy care and honest pains.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>Your worship speaks like a most thankful and</LINE>

+<LINE>reverend youth; and I praise God for you.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>There's for thy pains.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>God save the foundation!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Go, I discharge thee of thy prisoner, and I thank thee.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DOGBERRY</SPEAKER>

+<LINE>I leave an arrant knave with your worship; which I</LINE>

+<LINE>beseech your worship to correct yourself, for the</LINE>

+<LINE>example of others. God keep your worship! I wish</LINE>

+<LINE>your worship well; God restore you to health! I</LINE>

+<LINE>humbly give you leave to depart; and if a merry</LINE>

+<LINE>meeting may be wished, God prohibit it! Come, neighbour.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt DOGBERRY and VERGES</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Until to-morrow morning, lords, farewell.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>Farewell, my lords: we look for you to-morrow.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>We will not fail.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>To-night I'll mourn with Hero.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE><STAGEDIR>To the Watch</STAGEDIR>  Bring you these fellows on. We'll</LINE>

+<LINE>talk with Margaret,</LINE>

+<LINE>How her acquaintance grew with this lewd fellow.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt, severally</STAGEDIR>

+</SCENE>

+

+<SCENE><TITLE>SCENE II.  LEONATO'S garden.</TITLE>

+<STAGEDIR>Enter BENEDICK and MARGARET, meeting</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Pray thee, sweet Mistress Margaret, deserve well at</LINE>

+<LINE>my hands by helping me to the speech of Beatrice.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>Will you then write me a sonnet in praise of my beauty?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>In so high a style, Margaret, that no man living</LINE>

+<LINE>shall come over it; for, in most comely truth, thou</LINE>

+<LINE>deservest it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>To have no man come over me! why, shall I always</LINE>

+<LINE>keep below stairs?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Thy wit is as quick as the greyhound's mouth; it catches.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>And yours as blunt as the fencer's foils, which hit,</LINE>

+<LINE>but hurt not.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>A most manly wit, Margaret; it will not hurt a</LINE>

+<LINE>woman: and so, I pray thee, call Beatrice: I give</LINE>

+<LINE>thee the bucklers.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>Give us the swords; we have bucklers of our own.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>If you use them, Margaret, you must put in the</LINE>

+<LINE>pikes with a vice; and they are dangerous weapons for maids.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>MARGARET</SPEAKER>

+<LINE>Well, I will call Beatrice to you, who I think hath legs.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>And therefore will come.</LINE>

+<STAGEDIR>Exit MARGARET</STAGEDIR>

+<STAGEDIR>Sings</STAGEDIR>

+<LINE>The god of love,</LINE>

+<LINE>That sits above,</LINE>

+<LINE>And knows me, and knows me,</LINE>

+<LINE>How pitiful I deserve,--</LINE>

+<LINE>I mean in singing; but in loving, Leander the good</LINE>

+<LINE>swimmer, Troilus the first employer of panders, and</LINE>

+<LINE>a whole bookful of these quondam carpet-mangers,</LINE>

+<LINE>whose names yet run smoothly in the even road of a</LINE>

+<LINE>blank verse, why, they were never so truly turned</LINE>

+<LINE>over and over as my poor self in love. Marry, I</LINE>

+<LINE>cannot show it in rhyme; I have tried: I can find</LINE>

+<LINE>out no rhyme to 'lady' but 'baby,' an innocent</LINE>

+<LINE>rhyme; for 'scorn,' 'horn,' a hard rhyme; for,</LINE>

+<LINE>'school,' 'fool,' a babbling rhyme; very ominous</LINE>

+<LINE>endings: no, I was not born under a rhyming planet,</LINE>

+<LINE>nor I cannot woo in festival terms.</LINE>

+<STAGEDIR>Enter BEATRICE</STAGEDIR>

+<LINE>Sweet Beatrice, wouldst thou come when I called thee?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Yea, signior, and depart when you bid me.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>O, stay but till then!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>'Then' is spoken; fare you well now: and yet, ere</LINE>

+<LINE>I go, let me go with that I came; which is, with</LINE>

+<LINE>knowing what hath passed between you and Claudio.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Only foul words; and thereupon I will kiss thee.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Foul words is but foul wind, and foul wind is but</LINE>

+<LINE>foul breath, and foul breath is noisome; therefore I</LINE>

+<LINE>will depart unkissed.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Thou hast frighted the word out of his right sense,</LINE>

+<LINE>so forcible is thy wit. But I must tell thee</LINE>

+<LINE>plainly, Claudio undergoes my challenge; and either</LINE>

+<LINE>I must shortly hear from him, or I will subscribe</LINE>

+<LINE>him a coward. And, I pray thee now, tell me for</LINE>

+<LINE>which of my bad parts didst thou first fall in love with me?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>For them all together; which maintained so politic</LINE>

+<LINE>a state of evil that they will not admit any good</LINE>

+<LINE>part to intermingle with them. But for which of my</LINE>

+<LINE>good parts did you first suffer love for me?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Suffer love! a good epithet! I do suffer love</LINE>

+<LINE>indeed, for I love thee against my will.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>In spite of your heart, I think; alas, poor heart!</LINE>

+<LINE>If you spite it for my sake, I will spite it for</LINE>

+<LINE>yours; for I will never love that which my friend hates.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Thou and I are too wise to woo peaceably.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>It appears not in this confession: there's not one</LINE>

+<LINE>wise man among twenty that will praise himself.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>An old, an old instance, Beatrice, that lived in</LINE>

+<LINE>the lime of good neighbours. If a man do not erect</LINE>

+<LINE>in this age his own tomb ere he dies, he shall live</LINE>

+<LINE>no longer in monument than the bell rings and the</LINE>

+<LINE>widow weeps.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>And how long is that, think you?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Question: why, an hour in clamour and a quarter in</LINE>

+<LINE>rheum: therefore is it most expedient for the</LINE>

+<LINE>wise, if Don Worm, his conscience, find no</LINE>

+<LINE>impediment to the contrary, to be the trumpet of his</LINE>

+<LINE>own virtues, as I am to myself. So much for</LINE>

+<LINE>praising myself, who, I myself will bear witness, is</LINE>

+<LINE>praiseworthy: and now tell me, how doth your cousin?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Very ill.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>And how do you?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Very ill too.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Serve God, love me and mend. There will I leave</LINE>

+<LINE>you too, for here comes one in haste.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Enter URSULA</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>URSULA</SPEAKER>

+<LINE>Madam, you must come to your uncle. Yonder's old</LINE>

+<LINE>coil at home: it is proved my Lady Hero hath been</LINE>

+<LINE>falsely accused, the prince and Claudio mightily</LINE>

+<LINE>abused; and Don John is the author of all, who is</LINE>

+<LINE>fed and gone. Will you come presently?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Will you go hear this news, signior?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>I will live in thy heart, die in thy lap, and be</LINE>

+<LINE>buried in thy eyes; and moreover I will go with</LINE>

+<LINE>thee to thy uncle's.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt</STAGEDIR>

+</SCENE>

+

+<SCENE><TITLE>SCENE III.  A church.</TITLE>

+<STAGEDIR>Enter DON PEDRO, CLAUDIO, and three or four

+with tapers</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Is this the monument of Leonato?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>Lord</SPEAKER>

+<LINE>It is, my lord.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE><STAGEDIR>Reading out of a scroll</STAGEDIR></LINE>

+<LINE>Done to death by slanderous tongues</LINE>

+<LINE>Was the Hero that here lies:</LINE>

+<LINE>Death, in guerdon of her wrongs,</LINE>

+<LINE>Gives her fame which never dies.</LINE>

+<LINE>So the life that died with shame</LINE>

+<LINE>Lives in death with glorious fame.</LINE>

+<LINE>Hang thou there upon the tomb,</LINE>

+<LINE>Praising her when I am dumb.</LINE>

+<LINE>Now, music, sound, and sing your solemn hymn.</LINE>

+<SUBHEAD>SONG.</SUBHEAD>

+<LINE>Pardon, goddess of the night,</LINE>

+<LINE>Those that slew thy virgin knight;</LINE>

+<LINE>For the which, with songs of woe,</LINE>

+<LINE>Round about her tomb they go.</LINE>

+<LINE>Midnight, assist our moan;</LINE>

+<LINE>Help us to sigh and groan,</LINE>

+<LINE>Heavily, heavily:</LINE>

+<LINE>Graves, yawn and yield your dead,</LINE>

+<LINE>Till death be uttered,</LINE>

+<LINE>Heavily, heavily.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Now, unto thy bones good night!</LINE>

+<LINE>Yearly will I do this rite.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Good morrow, masters; put your torches out:</LINE>

+<LINE>The wolves have prey'd; and look, the gentle day,</LINE>

+<LINE>Before the wheels of Phoebus, round about</LINE>

+<LINE>Dapples the drowsy east with spots of grey.</LINE>

+<LINE>Thanks to you all, and leave us: fare you well.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Good morrow, masters: each his several way.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Come, let us hence, and put on other weeds;</LINE>

+<LINE>And then to Leonato's we will go.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>And Hymen now with luckier issue speed's</LINE>

+<LINE>Than this for whom we render'd up this woe.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exeunt</STAGEDIR>

+</SCENE>

+

+<SCENE><TITLE>SCENE IV.  A room in LEONATO'S house.</TITLE>

+<STAGEDIR>Enter LEONATO, ANTONIO, BENEDICK, BEATRICE,

+MARGARET, URSULA, FRIAR FRANCIS, and HERO</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>FRIAR FRANCIS</SPEAKER>

+<LINE>Did I not tell you she was innocent?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>So are the prince and Claudio, who accused her</LINE>

+<LINE>Upon the error that you heard debated:</LINE>

+<LINE>But Margaret was in some fault for this,</LINE>

+<LINE>Although against her will, as it appears</LINE>

+<LINE>In the true course of all the question.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>Well, I am glad that all things sort so well.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>And so am I, being else by faith enforced</LINE>

+<LINE>To call young Claudio to a reckoning for it.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Well, daughter, and you gentle-women all,</LINE>

+<LINE>Withdraw into a chamber by yourselves,</LINE>

+<LINE>And when I send for you, come hither mask'd.</LINE>

+<STAGEDIR>Exeunt Ladies</STAGEDIR>

+<LINE>The prince and Claudio promised by this hour</LINE>

+<LINE>To visit me. You know your office, brother:</LINE>

+<LINE>You must be father to your brother's daughter</LINE>

+<LINE>And give her to young Claudio.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>Which I will do with confirm'd countenance.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Friar, I must entreat your pains, I think.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>FRIAR FRANCIS</SPEAKER>

+<LINE>To do what, signior?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>To bind me, or undo me; one of them.</LINE>

+<LINE>Signior Leonato, truth it is, good signior,</LINE>

+<LINE>Your niece regards me with an eye of favour.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>That eye my daughter lent her: 'tis most true.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>And I do with an eye of love requite her.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>The sight whereof I think you had from me,</LINE>

+<LINE>From Claudio and the prince: but what's your will?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Your answer, sir, is enigmatical:</LINE>

+<LINE>But, for my will, my will is your good will</LINE>

+<LINE>May stand with ours, this day to be conjoin'd</LINE>

+<LINE>In the state of honourable marriage:</LINE>

+<LINE>In which, good friar, I shall desire your help.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>My heart is with your liking.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>FRIAR FRANCIS</SPEAKER>

+<LINE>And my help.</LINE>

+<LINE>Here comes the prince and Claudio.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Enter DON PEDRO and CLAUDIO, and two or

+three others</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Good morrow to this fair assembly.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Good morrow, prince; good morrow, Claudio:</LINE>

+<LINE>We here attend you. Are you yet determined</LINE>

+<LINE>To-day to marry with my brother's daughter?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>I'll hold my mind, were she an Ethiope.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Call her forth, brother; here's the friar ready.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Exit ANTONIO</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>Good morrow, Benedick. Why, what's the matter,</LINE>

+<LINE>That you have such a February face,</LINE>

+<LINE>So full of frost, of storm and cloudiness?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>I think he thinks upon the savage bull.</LINE>

+<LINE>Tush, fear not, man; we'll tip thy horns with gold</LINE>

+<LINE>And all Europa shall rejoice at thee,</LINE>

+<LINE>As once Europa did at lusty Jove,</LINE>

+<LINE>When he would play the noble beast in love.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Bull Jove, sir, had an amiable low;</LINE>

+<LINE>And some such strange bull leap'd your father's cow,</LINE>

+<LINE>And got a calf in that same noble feat</LINE>

+<LINE>Much like to you, for you have just his bleat.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>For this I owe you: here comes other reckonings.</LINE>

+<STAGEDIR>Re-enter ANTONIO, with the Ladies masked</STAGEDIR>

+<LINE>Which is the lady I must seize upon?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>ANTONIO</SPEAKER>

+<LINE>This same is she, and I do give you her.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Why, then she's mine. Sweet, let me see your face.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>No, that you shall not, till you take her hand</LINE>

+<LINE>Before this friar and swear to marry her.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Give me your hand: before this holy friar,</LINE>

+<LINE>I am your husband, if you like of me.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>And when I lived, I was your other wife:</LINE>

+<STAGEDIR>Unmasking</STAGEDIR>

+<LINE>And when you loved, you were my other husband.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>Another Hero!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>Nothing certainer:</LINE>

+<LINE>One Hero died defiled, but I do live,</LINE>

+<LINE>And surely as I live, I am a maid.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>The former Hero! Hero that is dead!</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>She died, my lord, but whiles her slander lived.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>FRIAR FRANCIS</SPEAKER>

+<LINE>All this amazement can I qualify:</LINE>

+<LINE>When after that the holy rites are ended,</LINE>

+<LINE>I'll tell you largely of fair Hero's death:</LINE>

+<LINE>Meantime let wonder seem familiar,</LINE>

+<LINE>And to the chapel let us presently.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Soft and fair, friar. Which is Beatrice?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE><STAGEDIR>Unmasking</STAGEDIR>  I answer to that name. What is your will?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Do not you love me?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Why, no; no more than reason.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Why, then your uncle and the prince and Claudio</LINE>

+<LINE>Have been deceived; they swore you did.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Do not you love me?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Troth, no; no more than reason.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>Why, then my cousin Margaret and Ursula</LINE>

+<LINE>Are much deceived; for they did swear you did.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>They swore that you were almost sick for me.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>They swore that you were well-nigh dead for me.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>'Tis no such matter. Then you do not love me?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>No, truly, but in friendly recompense.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>Come, cousin, I am sure you love the gentleman.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>And I'll be sworn upon't that he loves her;</LINE>

+<LINE>For here's a paper written in his hand,</LINE>

+<LINE>A halting sonnet of his own pure brain,</LINE>

+<LINE>Fashion'd to Beatrice.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>HERO</SPEAKER>

+<LINE>And here's another</LINE>

+<LINE>Writ in my cousin's hand, stolen from her pocket,</LINE>

+<LINE>Containing her affection unto Benedick.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>A miracle! here's our own hands against our hearts.</LINE>

+<LINE>Come, I will have thee; but, by this light, I take</LINE>

+<LINE>thee for pity.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BEATRICE</SPEAKER>

+<LINE>I would not deny you; but, by this good day, I yield</LINE>

+<LINE>upon great persuasion; and partly to save your life,</LINE>

+<LINE>for I was told you were in a consumption.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Peace! I will stop your mouth.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Kissing her</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>DON PEDRO</SPEAKER>

+<LINE>How dost thou, Benedick, the married man?</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>I'll tell thee what, prince; a college of</LINE>

+<LINE>wit-crackers cannot flout me out of my humour. Dost</LINE>

+<LINE>thou think I  care for a satire or an epigram? No:</LINE>

+<LINE>if a man will be beaten with brains, a' shall wear</LINE>

+<LINE>nothing handsome about him. In brief, since I do</LINE>

+<LINE>purpose to marry, I will think nothing to any</LINE>

+<LINE>purpose that the world can say against it; and</LINE>

+<LINE>therefore never flout at me for what I have said</LINE>

+<LINE>against it; for man is a giddy thing, and this is my</LINE>

+<LINE>conclusion. For thy part, Claudio, I did think to</LINE>

+<LINE>have beaten thee, but in that thou art like to be my</LINE>

+<LINE>kinsman, live unbruised and love my cousin.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>CLAUDIO</SPEAKER>

+<LINE>I had well hoped thou wouldst have denied Beatrice,</LINE>

+<LINE>that I might have cudgelled thee out of thy single</LINE>

+<LINE>life, to make thee a double-dealer; which, out of</LINE>

+<LINE>question, thou wilt be, if my cousin do not look</LINE>

+<LINE>exceedingly narrowly to thee.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Come, come, we are friends: let's have a dance ere</LINE>

+<LINE>we are married, that we may lighten our own hearts</LINE>

+<LINE>and our wives' heels.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>LEONATO</SPEAKER>

+<LINE>We'll have dancing afterward.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>First, of my word; therefore play, music. Prince,</LINE>

+<LINE>thou art sad; get thee a wife, get thee a wife:</LINE>

+<LINE>there is no staff more reverend than one tipped with horn.</LINE>

+</SPEECH>

+

+

+<STAGEDIR>Enter a Messenger</STAGEDIR>

+

+<SPEECH>

+<SPEAKER>Messenger</SPEAKER>

+<LINE>My lord, your brother John is ta'en in flight,</LINE>

+<LINE>And brought with armed men back to Messina.</LINE>

+</SPEECH>

+

+<SPEECH>

+<SPEAKER>BENEDICK</SPEAKER>

+<LINE>Think not on him till to-morrow:</LINE>

+<LINE>I'll devise thee brave punishments for him.</LINE>

+<LINE>Strike up, pipers.</LINE>

+</SPEECH>

+

+<STAGEDIR>Dance</STAGEDIR>

+<STAGEDIR>Exeunt</STAGEDIR>

+</SCENE>

+</ACT>

+</PLAY>

diff --git a/axiom/modules/axiom-tests/test-resources/xml/namespaces.xml b/axiom/modules/axiom-tests/test-resources/xml/namespaces.xml
new file mode 100644
index 0000000..c5021f0
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/namespaces.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>

+<foo:a xmlns:foo="http://fooNamespace/">

+  <b>

+    <c>Hello</c>

+  </b>

+

+  <foo:d>

+    <foo:e>Hey</foo:e>

+  </foo:d>

+

+  <bar:f xmlns:bar="http://barNamespace/">

+    <bar:g>Hey2</bar:g>

+  </bar:f>

+

+  <alias:x xmlns:alias="http://fooNamespace/">

+    <alias:y>Hey3</alias:y>

+  </alias:x>

+</foo:a>

diff --git a/axiom/modules/axiom-tests/test-resources/xml/nitf.xml b/axiom/modules/axiom-tests/test-resources/xml/nitf.xml
new file mode 100644
index 0000000..f379a19
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/nitf.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<nitf>

+

+  <!-- Example of markup of URLs (at the bottom of the story) -->

+

+ <head>

+  <meta name="ap-cycle" content="AP"/>

+  <meta name="ap-online-code" content="1700"/>

+  <meta name="ap-company" content="CO:Media Metrix Inc;TS:MMXI;IG:SVC;"/>

+  <meta name="ap-routing" content="ENTITLEMENTS,pfONLINE,pf1700"/>

+  <meta name="ap-format" content="bx"/>

+  <meta name="ap-category" content="f"/>

+  <meta name="ap-selector" content="-----"/>

+  <meta name="ap-transref" content="V0347"/>

+  <docdata>

+   <doc-id regsrc="AP" id-string="D76UIMO80"/>

+   <urgency ed-urg="7"/>

+   <date.issue norm="20000911T185842Z"/>

+   <du-key key="Napster Traffic"/>

+   <doc.copyright holder="(AP)"/>

+  </docdata>

+ </head>

+ <body>

+  <body.head>

+   <hedline>

+    <hl1>Use of Napster Quadruples</hl1>

+   </hedline>

+   <byline>By PETER SVENSSON

+    <byttl>AP Business Writer</byttl>

+   </byline>

+   <distributor>The Associated Press</distributor>

+   <dateline>

+    <location>NEW YORK</location>

+   </dateline>

+  </body.head>

+  <body.content>

+   <block>

+    <p>Despite the uncertain legality of the Napster online music-sharing service, the number of people

+using it more than quadrupled in just five months, Media Metrix said Monday.</p>

+    <p>That made Napster the fastest-growing software application ever recorded by the Internet research

+company.</p>

+    <p>From 1.1 million home users in the United States in February, the first month Media Metrix

+tracked the application, Napster use rocketed to 4.9 million users in July.</p>

+    <p>That represents 6 percent of U.S. home PC users who have modems, said Media Metrix, which pays

+people to install monitoring software on their computers.</p>

+    <p>It estimates total usage from a panel of about 50,000 people in the United States.</p>

+    <p>Napster was also used at work by 887,000 people in July, Media Metrix said.</p>

+    <p>Napster Inc. has been sued by the recording industry for allegedly enabling copyright

+infringement. The federal government weighed in on the case Friday, saying the service is not protected

+under a key copyright law, as the San Mateo, Calif., company claims.</p>

+    <p>Bruce Ryon, head of Media Metrix&apos;s New Media Group, said Napster was used by &quot;the full spectrum of PC users, not just the youth with time on their hands and a passion for music.&quot;</p>

+    <p>The Napster program allows users to copy digital music files from the hard drives of other

+users over the Internet.</p>

+    <p>Napster Inc. said last week that 28 million people had downloaded its program. It does not reveal

+its own figures for how many people actually use the software.</p>

+    <p>Because the program connects to the company&apos;s computers over the Internet every time

+it is run, Napster Inc. can track usage exactly.</p>

+    <p>__</p>

+    <p>On the Net:</p>

+    <p><a href="http://www.napster.com">

+http://www.napster.com</a></p>

+    <p><a href="http://www.mediametrix.com">

+http://www.mediametrix.com</a></p>

+   </block>

+  </body.content>

+ </body>

+</nitf>

diff --git a/axiom/modules/axiom-tests/test-resources/xml/numbers.xml b/axiom/modules/axiom-tests/test-resources/xml/numbers.xml
new file mode 100644
index 0000000..f2a05e7
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/numbers.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>

+

+<numbers>

+  <set>

+    <nr>3</nr>

+    <nr>24</nr>

+    <nr>55</nr>

+    <nr>11</nr>

+    <nr>2</nr>

+    <nr>-3</nr>

+  </set>

+  <set>

+    <nr value="66"/>

+    <nr value="123"/>

+    <nr value="55"/>

+    <nr value="9999"/>

+  </set>

+</numbers>

diff --git a/axiom/modules/axiom-tests/test-resources/xml/pi.xml b/axiom/modules/axiom-tests/test-resources/xml/pi.xml
new file mode 100644
index 0000000..5edcedd
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/pi.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>

+<foo>

+	<?cheese is tasty?>

+	<bar>

+		<baz/>

+		<cheese/>

+		<baz/>

+		<?toast is tasty?>

+		<cheese/>

+		<baz/>

+	</bar>

+	<?cheese is gooey?>

+</foo>

diff --git a/axiom/modules/axiom-tests/test-resources/xml/pi2.xml b/axiom/modules/axiom-tests/test-resources/xml/pi2.xml
new file mode 100644
index 0000000..7b6a11a
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/pi2.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>

+<a>

+  <b>foo</b>

+  <?toc order-by="x"?>

+  <c>bar</c>

+</a>

diff --git a/axiom/modules/axiom-tests/test-resources/xml/simple.xml b/axiom/modules/axiom-tests/test-resources/xml/simple.xml
new file mode 100644
index 0000000..342f6f1
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/simple.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?>

+<root><a>a</a><b>b</b><c><d>d</d></c></root>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/xml/spaces.xml b/axiom/modules/axiom-tests/test-resources/xml/spaces.xml
new file mode 100644
index 0000000..1cdd5b7
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/spaces.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>

+<foo>

+    <bar>baz

+        <cheese id="3"/>

+        baz

+        <cheese/>

+        baz

+    </bar>

+    <doc><![CDATA[<foo>]]></doc>

+</foo>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/xml/spaces2.xml b/axiom/modules/axiom-tests/test-resources/xml/spaces2.xml
new file mode 100644
index 0000000..3151fcc
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/spaces2.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>

+<foo>

+    <bar>baz

+        <cheese id="3"/>

+        baz

+        <cheese/>

+        baz

+    </bar>

+    <doc>&lt;foo&gt;</doc>

+</foo>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/xml/test/tests.xml b/axiom/modules/axiom-tests/test-resources/xml/test/tests.xml
new file mode 100644
index 0000000..575fd9d
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/test/tests.xml
@@ -0,0 +1,685 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<tests xmlns:var="http://jaxen.org/test-harness/var">

+    <!-- test for jaxen-24 -->

+   <document url="xml/jaxen24.xml">

+       <context select="/body/div">

+           <test select="preceding::*[1]" count="1"/>

+           <valueOf select="local-name(preceding::*[1])">span</valueOf>

+       </context>

+        <!-- jaxen-58 -->

+       <context select="/">

+           <test select="//preceding::x" count="0"/>

+           <test select="//following::x" count="0"/>

+           <test select="/descendant::*/preceding::x" count="0"/>

+           <test select="/descendant::node()/preceding::x" count="0"/>

+       </context>

+   </document>

+

+    <!-- test for jaxen-3 -->

+  <document url="xml/simple.xml">

+    <context select="/">

+      <valueOf select="string()">abd</valueOf>

+    </context>

+    <context select="/root">

+      <valueOf select="string()">abd</valueOf>

+    </context>

+    <context select="/root/a">

+      <valueOf select="string()">a</valueOf>

+    </context>

+    <context select="/root/c">

+      <valueOf select="string()">d</valueOf>

+    </context>

+  </document>

+

+

+    <!-- test for jaxen-3 -->

+  <document url="xml/jaxen3.xml">

+    <context select="/">

+      <test select="/Configuration/hostname/attrlist/hostname[. = 'CE-A'] " count="1"/>

+    </context>

+  </document>

+

+    <!-- parser test cases all of which should fail-->

+  <document url="xml/numbers.xml">

+    <context select="/">

+        <!-- repeated xpaths, jaxen-35 -->

+      <test exception="true" select="/numbers numbers" count="0"/>

+        <!-- invalid xpath, jaxen-34 -->

+      <test exception="true" select="/a/b[c > d]efg" count="0"/>

+        <!-- invalid xpath, jaxen-27 -->

+      <test exception="true" select="/inv/child::" count="0"/>

+        <!-- invalid xpath, jaxen-26 -->

+      <test exception="true" select="/invoice/@test[abcd" count="0"/>

+      <test exception="true" select="/invoice/@test[abcd > x" count="0"/>

+

+        <!-- unterminated string -->

+      <test exception="true" select="string-length('a" count="0"/>

+      <!-- various edge cases where code threw no exception -->

+      <test exception="true" select="/descendant::()" count="0"/>

+      <test exception="true" select="(1 + 1" count="0"/>

+

+    </context>

+  </document>

+

+

+  <!-- test cases for the use of underscores in names -->

+  <document url="xml/underscore.xml">

+    <context select="/">

+      <test select="/root/@a" count="1"/>

+      <test select="/root/@_a" count="1"/>

+      <test select="/root/b" count="1"/>

+      <test select="/root/_b" count="1"/>

+      <valueOf select="/root/@a">1</valueOf>

+      <valueOf select="/root/@_a">2</valueOf>

+      <valueOf select="/root/b">1</valueOf>

+      <valueOf select="/root/_b">2</valueOf>

+    </context>

+  </document>

+

+  <!-- test cases for the use of = with nodesets -->

+  <document url="xml/web.xml">

+    <context select="/">

+      <valueOf select="/web-app/servlet/servlet-name = 'file'">true</valueOf>

+      <valueOf select="/web-app/servlet/servlet-name = 'snoop'">true</valueOf>

+    </context>

+  </document>

+

+  <document url="xml/numbers.xml">

+    <context select="/">

+      <valueOf select="/numbers/set/nr = '-3'">true</valueOf>

+      <valueOf select="/numbers/set/nr = -3">true</valueOf>

+      <valueOf select="/numbers/set/nr = 24">true</valueOf>

+      <valueOf select="/numbers/set/nr/@value = '9999'">true</valueOf>

+      <valueOf select="/numbers/set/nr/@value = 9999.0">true</valueOf>

+      <valueOf select="/numbers/set/nr/@value = 66">true</valueOf>

+    </context>

+  </document>

+

+  <!-- test basic math... -->

+  <document url="xml/numbers.xml">

+    <context select="/">

+      <valueOf select="(8 * 2 + 1) = 17">true</valueOf>

+      <valueOf select="(1 + 8 * 2) = 17">true</valueOf>

+      <valueOf select="(7 - 3 + 1) = 5">true</valueOf>

+      <valueOf select="(8 - 4 + 5 - 6) = 3">true</valueOf>

+      <!-- left-assoc tests, comments show WRONG evaluation -->

+      <!-- 3 - 2 - 1 != 2 -->

+      <valueOf select="3 - 2 - 1">0</valueOf>

+      <!-- 8 div 4 div 2 != 4 -->

+      <valueOf select="8 div 4 div 2">1</valueOf>

+      <!-- 3 mod 5 mod 7 != 1 -->

+      <valueOf select="3 mod 7 mod 5">3</valueOf>

+        <!-- 1=(2=2) is true-->

+      <valueOf select="1 = 2 = 2">false</valueOf>

+        <!--  2!=(3!=1) => 2!=1 => true, (2!=3)!=1 => 1!=1 => false -->

+      <valueOf select="2 != 3 != 1">false</valueOf>

+        <!-- 3 > (2 > 1) is true -->

+      <valueOf select="3 &gt; 2 &gt; 1">false</valueOf>

+        <!-- 3 >= (2 >= 2) is true -->

+      <valueOf select="3 &gt;= 2 &gt;= 2">false</valueOf>

+        <!-- 1 < (2 < 3) is false -->

+      <valueOf select="1 &lt; 2 &lt; 3">true</valueOf>

+        <!-- 0 <= (2 <= 3) is true -->

+      <valueOf select="2 &lt;= 2 &lt;= 3">true</valueOf>

+    </context>

+  </document>

+

+  <!-- test cases for preceding axis with different node types -->

+  <document url="xml/pi2.xml">

+    <context select="/a/c">

+      <test select="//processing-instruction()" count="1"/>

+      <test select="preceding-sibling::*" count="1"/>

+      <test select="preceding-sibling::node()" count="5"/>

+      <test select="preceding-sibling::*[1]" count="1"/>

+      <test select="preceding-sibling::processing-instruction()" count="1"/>

+      <valueOf select="preceding-sibling::processing-instruction()">order-by="x"</valueOf>

+      <valueOf select="preceding-sibling::*[1]">foo</valueOf>

+      <valueOf select="preceding-sibling::node()[2]">order-by="x"</valueOf>

+    </context>

+  </document>

+

+  <document url="xml/id.xml">

+    <context select="/"

+	     var:foobar="foobar"

+	     var:foo="foo">

+      <valueOf select="$foobar">foobar</valueOf>

+      <test select="/foo[@id=$foobar]" count="1"/>

+      <test select="/foo[@id='$foobar']" count="0"/>

+      <test select="/foo[concat($foo, 'bar')=@id]" count="1"/>

+      <test select="CD_Library/artist[@name=$artist]" count="0"/>

+    </context>

+  </document>

+

+  <document url="xml/id.xml">

+    <context select="/">

+      <!-- attributes have a parent: their element -->

+      <test select="/foo/@id/parent::foo" count="1"/>

+    </context>

+    <!-- attributes can also be used as context nodes -->

+    <context select="/foo/@id">

+      <test select="parent::foo" count="1"/>

+    </context>

+  </document>

+

+  <document url="xml/pi.xml">

+    <context select="/">

+      <test select="//processing-instruction()" count="3"/>

+      <test select="//processing-instruction('cheese')" count="2"/>

+      <test select="//processing-instruction('toast')" count="1">

+	<valueOf select="string()">is tasty</valueOf>

+      </test>

+    </context>

+

+  </document>

+

+  <!-- test evaluate() extension function -->

+  <document url="xml/evaluate.xml">

+    <context select="/">

+      <test select="evaluate('//jumps/*')" count="3"/>

+      <test select="evaluate('//jumps/object/dog')" count="1"/>

+      <test select="evaluate('//jumps/object')/evaluate" count="0"/>

+      <test select="evaluate('//jumps/object')/dog" count="1"/>

+      <test select="evaluate('//jumps/*')/dog" count="1"/>

+      <test select="//metatest[ evaluate(@select) = . ]" count="1"/>

+    </context>

+  </document>

+  

+  <document url="xml/numbers.xml">

+    <context select="/numbers/set[1]">

+      <test select="*[-3 = .]" count="1"/>

+      <valueOf select="54 &lt; *">true</valueOf>

+      <valueOf select="55 &lt;= *">true</valueOf>

+      <valueOf select="69 &lt; *">false</valueOf>

+      <valueOf select="-2 &gt; *">true</valueOf>

+      <valueOf select="-3 &gt;= *">true</valueOf>

+      <valueOf select="-4 &gt;= *">false</valueOf>

+    </context>

+    <!-- TODO

+    This context should work, but needs a fixed version of saxpath to parse the right-hand side

+    of the greater-than expression.

+    <context select="/numbers/set[2]">

+      <valueOf select="1 &gt; nr/@value">false</valueOf>

+      <valueOf select="55 &gt; nr/@value">false</valueOf>

+      <valueOf select="55 &gt;= nr/@value">true</valueOf>

+      <valueOf select="1000000 &gt; nr/@value">true</valueOf>

+    </context>

+    -->

+  </document>

+

+

+  <!-- test sibling axes -->

+  <document url="xml/axis.xml">

+

+    <context select="/root">

+      <test select="preceding-sibling::*" count="0"/>

+    </context>

+

+    <context select="/root/a/a.3">

+      <test select="preceding::*" count="2"/>

+    </context>

+

+    <context select="/root/a/a.3">

+      <test select="preceding-sibling::*" count="2"/>

+    </context>

+

+    <context select="/">

+      <valueOf select="name(/root/a/a.3/preceding-sibling::*[1])">a.2</valueOf>

+      <valueOf select="name(/root/a/a.3/preceding-sibling::*[2])">a.1</valueOf>

+    </context>

+

+    <context select="/">

+      <valueOf select="name(/root/a/a.3/following-sibling::*[1])">a.4</valueOf>

+      <valueOf select="name(/root/a/a.3/following-sibling::*[2])">a.5</valueOf>

+    </context>

+

+  </document>

+

+

+  <document url="xml/web.xml">

+

+    <context select="/">

+      <valueOf select="/web-app/servlet[1]/servlet-name">snoop</valueOf>

+      <valueOf select="/web-app/servlet[1]/servlet-name/text()">snoop</valueOf>

+      <valueOf select="/web-app/servlet[2]/servlet-name">file</valueOf>

+      <valueOf select="/web-app/servlet[2]/servlet-name/text()">file</valueOf>

+    </context>

+

+    <context select="/web-app/servlet[1]">

+      <valueOf select="servlet-name">snoop</valueOf>

+      <valueOf select="servlet-name/text()">snoop</valueOf>

+    </context>

+    

+    <context select="/web-app/servlet[2]/servlet-name">

+      <test select="preceding::*" count="3"/>

+    </context>

+

+    <context select="/web-app/servlet[2]/servlet-name">

+      <test select="following::*" count="13"/>

+    </context>

+

+  </document>

+

+

+  <!-- test name -->

+

+  <document url="xml/web.xml">

+    <context select="/">

+      

+      <test select="*" count="1">

+	<valueOf select="name()">web-app</valueOf>

+      </test>

+

+      <!-- NOTE that the child::node() tests only work if the

+      XML document does not comments or PIs

+      -->

+      

+      <test select="./*" count="1">

+	<valueOf select="name()">web-app</valueOf>

+      </test>

+      <test select="child::*" count="1">

+	<valueOf select="name()">web-app</valueOf>

+      </test>

+      <test select="/*" count="1">

+	<valueOf select="name()">web-app</valueOf>

+      </test>

+      <test select="/child::node()" count="1">

+	<valueOf select="name(.)">web-app</valueOf>

+      </test>

+      <test select="child::node()" count="1">

+	<valueOf select="name(.)">web-app</valueOf>

+      </test>

+

+      <!-- empty names -->

+

+      <valueOf select="name()"></valueOf>

+      <valueOf select="name(.)"></valueOf>

+      <valueOf select="name(parent::*)"></valueOf>

+      <valueOf select="name(/)"></valueOf>

+      <valueOf select="name(/.)"></valueOf>

+      <valueOf select="name(/self::node())"></valueOf>

+

+      <!-- name of root elemet -->

+      <valueOf select="name(node())">web-app</valueOf>

+      <valueOf select="name(/node())">web-app</valueOf>

+      <valueOf select="name(/*)">web-app</valueOf>

+      <valueOf select="name(/child::*)">web-app</valueOf>

+      <valueOf select="name(/child::node())">web-app</valueOf>

+      <valueOf select="name(/child::node())">web-app</valueOf>

+      <valueOf select="name(child::node())">web-app</valueOf>

+      <valueOf select="name(./*)">web-app</valueOf>

+      <valueOf select="name(*)">web-app</valueOf>

+

+    </context>

+

+    <context select="/*">

+      <!-- empty names -->

+      <valueOf select="name(..)"></valueOf>

+      <valueOf select="name(parent::node())"></valueOf>

+      <valueOf select="name(parent::*)"></valueOf>

+

+      <!-- name of root elemet -->

+      <valueOf select="name()">web-app</valueOf>

+      <valueOf select="name(.)">web-app</valueOf>

+      <valueOf select="name(../*)">web-app</valueOf>

+      <valueOf select="name(../child::node())">web-app</valueOf>

+    </context>

+  </document>

+

+

+

+  <!-- test predicates -->

+

+  <document url="xml/nitf.xml">

+    <context select="/nitf/head/docdata">

+      <test select="doc-id[@regsrc='AP' and @id-string='D76UIMO80']" count="1"/>

+    </context>

+    <context select="/nitf/head">

+      <test select="meta[@name='ap-cycle']" count="1"/>

+      <test select="meta[@content='AP']" count="1"/>

+      <test select="meta[@name and @content]" count="8"/>

+      <test select="meta[@name='ap-cycle' and @content='AP']" count="1"/>

+      <test select="meta[@name != 'ap-cycle']" count="7"/>

+    </context>

+    <context select="/">

+      <test select="/nitf/head/meta[@name='ap-cycle']" count="1"/>

+      <test select="/nitf/head/meta[@content='AP']" count="1"/>

+      <test select="/nitf/head/meta[@name and @content]" count="8"/>

+      <test select="/nitf/head/meta[@name='ap-cycle' and @content='AP']" count="1"/>

+      <test select="/nitf/head/meta[@name != 'ap-cycle']" count="7"/>

+    </context>

+  </document>

+

+

+  <document url="xml/moreover.xml">

+    <context select="/">

+      <test select="/child::node()" count="1"/>

+      <test select="/*" count="1"/>

+

+      <test select="/*/article" count="20"/>

+      <test select="//*" count="221"/>

+      <test select="//*[local-name()='article']" count="20"/>

+      <test select="//article" count="20"/>

+      <test select="/*/*[@code]" count="20"/>

+

+      <test select="/moreovernews/article[@code='13563275']" count="1"/>

+

+      <test select="/moreovernews/article[@code='13563275']">

+	<valueOf select="url">http://c.moreover.com/click/here.pl?x13563273</valueOf>

+      </test>

+      <test select="/*/article[@code='13563275']">

+	<valueOf select="url">http://c.moreover.com/click/here.pl?x13563273</valueOf>

+      </test>

+      <test select="//article[@code='13563275']">

+	<valueOf select="url">http://c.moreover.com/click/here.pl?x13563273</valueOf>

+      </test>

+      <test select="//*[@code='13563275']">

+	<valueOf select="url">http://c.moreover.com/click/here.pl?x13563273</valueOf>

+      </test>

+      <test select="/child::node()/child::node()[@code='13563275']">

+	<valueOf select="url">http://c.moreover.com/click/here.pl?x13563273</valueOf>

+      </test>

+      <test select="/*/*[@code='13563275']">

+	<valueOf select="url">http://c.moreover.com/click/here.pl?x13563273</valueOf>

+      </test>

+    </context>

+  </document>

+

+

+

+  <!-- test other node types-->

+

+  <document url="xml/contents.xml">

+    <context select="/">

+      <test select="processing-instruction()" count="3"/>

+      <test select="/processing-instruction()" count="3"/>

+      <test select="/comment()" count="1"/>

+      <test select="comment()" count="1"/>

+      <test select="/child::node()/comment()" count="2"/>

+      <test select="/*/comment()" count="2"/>

+      <test select="//comment()" count="3"/>

+    </context>

+  </document>

+

+

+

+  <!-- test positioning -->

+

+  <document url="xml/fibo.xml">

+    <context select="/">

+      <test select="/*/fibonacci[position() &lt; 10]" count="9"/>

+      <valueOf select="sum(//fibonacci)">196417</valueOf>

+      <valueOf select="sum(//fibonacci/@index)">325</valueOf>

+      <valueOf select="/*/fibonacci[2]">1</valueOf>

+      <valueOf select="/*/fibonacci[ count(/*/fibonacci) ]">75025</valueOf>

+      <valueOf select="/*/fibonacci[ count(/*/fibonacci) - 1 ]">46368</valueOf>

+    </context>

+  </document>

+

+

+  <!-- test number functions -->

+

+  <!-- test Axes -->

+

+  <document url="xml/web.xml">

+    <context select="/">

+      <test select="descendant-or-self::*" count="19"/>

+      <test select="descendant::*" count="19"/>

+      <test select="/descendant::*" count="19"/>

+      <test select="/descendant-or-self::*" count="19"/>

+      <test select="/descendant::servlet" count="2"/>

+      <test select="/descendant-or-self::servlet" count="2"/>

+      <test select="descendant-or-self::servlet" count="2"/>

+      <test select="descendant::servlet" count="2"/>

+      <test select="/*/servlet" count="2"/>

+      <valueOf select="count(/*/servlet)">2</valueOf>

+      <test select="//servlet" count="2"/>

+      <valueOf select="count(//servlet)">2</valueOf>

+    </context>

+    <context select="/web-app">

+      <test select="/descendant::servlet" count="2"/>

+      <test select="/descendant-or-self::servlet" count="2"/>

+      <test select="descendant-or-self::servlet" count="2"/>

+      <test select="descendant::servlet" count="2"/>

+    </context>

+  </document>

+

+  <document url="xml/much_ado.xml">

+    <context select="/">

+      <test select="/descendant::ACT" count="5"/>

+      <test select="descendant::ACT" count="5"/>

+      <valueOf select="/PLAY/TITLE">Much Ado about Nothing</valueOf>

+      <valueOf select="2+2">4</valueOf>

+      <valueOf select="5 * 4 + 1">21</valueOf>

+      <valueOf select="count(descendant::ACT)">5</valueOf>

+      <valueOf select="10 + count(descendant::ACT) * 5">35</valueOf>

+      <valueOf select="(10 + count(descendant::ACT)) * 5">75</valueOf>

+    </context>

+    <context select="/PLAY/ACT[2]/SCENE[1]">

+      <test select="/descendant::ACT" count="5"/>

+      <test select="../../descendant::ACT" count="5"/>

+      <test select="/PLAY/ACT[2]/SCENE[1]/descendant::SPEAKER" count="141"/>

+      <test select="descendant::SPEAKER" count="141"/>

+      <valueOf select="count(descendant::*)+1">646</valueOf>

+      <valueOf select="count(descendant::SPEAKER)+1">142</valueOf>

+      <valueOf select="count(ancestor::*)">2</valueOf>

+      <valueOf select="count(ancestor::PLAY)">1</valueOf>

+      <valueOf select="count(ancestor-or-self::*)">3</valueOf>

+      <valueOf select="count(ancestor-or-self::PLAY)">1</valueOf>

+      <valueOf select="5+count(ancestor::*)-1">6</valueOf>

+    </context>

+    <context select="/">

+      <!-- Test correct predicate application -->

+      <valueOf select="count(/PLAY/ACT/SCENE[1])">5</valueOf>

+    </context>

+  </document>

+

+  <!-- test axis node ordering -->

+  <document url="xml/web.xml">

+    <context select="/">

+      <!-- Reported as Jira issue JAXEN-24 -->

+      <test select="//servlet-mapping/preceding::*[1][name()='description']" count="1"/>

+      <test select="/web-app/servlet//description/following::*[1][name()='servlet-mapping']" count="1"/>

+      <test select="/web-app/servlet//description/following::*[2][name()='servlet-name']" count="1"/>

+    </context>

+  </document>

+  

+  <!-- test document function -->

+  <document url="xml/text.xml">

+    <context select="/">

+      <test select="document('xml/web.xml')" count="1">

+	<valueOf select="/web-app/servlet[1]/servlet-name">snoop</valueOf>

+	<valueOf select="/web-app/servlet[1]/servlet-name/text()">snoop</valueOf>

+      </test>

+      <valueOf select="document('xml/web.xml')/web-app/servlet[1]/servlet-name">snoop</valueOf>

+    </context>

+    <!-- Test to check if the context changes when an extension function is used.

+    First test is an example, second is the actual test.

+    -->

+    <context select="/foo/bar/cheese[1]">

+      <valueOf select="concat(./@id,'foo',@id)">3foo3</valueOf>

+      <valueOf select="concat(./@id,document('xml/web.xml')/web-app/servlet[1]/servlet-name,./@id)">3snoop3</valueOf>

+    </context>

+  </document>

+

+  <document url="xml/message.xml">

+    <context select="/">

+      <valueOf select="/message/body/data/items/item[name/text()='parentinfo']/value">Pruefgebiete</valueOf>

+      <valueOf select="document('xml/message.xml')/message/body/data/items/item[name/text()='parentinfo']/value">Pruefgebiete</valueOf>

+    </context>

+  </document>

+

+  <document url="xml/simple.xml">

+

+    <!-- test behaviour of AbsoluteLocationPath -->

+    <context select="/root/a">

+      <valueOf select="concat( ., /root/b )">ab</valueOf>

+      <valueOf select="concat( ../b, . )">ba</valueOf>

+      <valueOf select="concat( /root/b, . )">ba</valueOf>

+      <valueOf select="concat( /root/c/d, ../b )">db</valueOf>

+    </context>

+

+    <!-- test the translate() function -->

+    <context select="/">

+      <valueOf select="translate( '', '', '' )"></valueOf>

+      <valueOf select="translate( 'abcd', '', '' )">abcd</valueOf>

+      <valueOf select="translate( 'abcd', 'abcd', 'abcd' )">abcd</valueOf>

+      <valueOf select="translate( 'abcd', 'dcba', 'dcba' )">abcd</valueOf>

+      <valueOf select="translate( 'abcd', 'abcd', 'dcba' )">dcba</valueOf>

+      <valueOf select="translate( 'abcd', 'abcd', 'ab' )">ab</valueOf>

+      <valueOf select="translate( 'abcd', 'cdab', 'cd' )">cd</valueOf>

+      <valueOf select="translate( 'abcd', 'acbd', 'xy' )">xy</valueOf>

+      <valueOf select="translate( 'abcd', 'abcdb', 'abcdb' )">abcd</valueOf>

+      <valueOf select="translate( 'abcd', 'abcd', 'abcdb' )">abcd</valueOf>

+    </context>

+

+    <context select="/">

+      <valueOf select="substring('12345', 1.5, 2.6)">234</valueOf>

+      <valueOf select="substring('12345', 0, 3)">12</valueOf>

+      <valueOf select="substring('12345', 0 div 0, 3)"></valueOf>

+      <valueOf select="substring('12345', 1, 0 div 0)"></valueOf>

+      <valueOf select="substring('12345', -42, 1 div 0)">12345</valueOf>

+      <valueOf select="substring('12345', -1 div 0, 1 div 0)"></valueOf>

+      <valueOf select="substring('12345', 3)">345</valueOf>

+      <valueOf select="substring('12345',1,15)">12345</valueOf>

+    </context>

+

+	<!-- Some tests for the normalize-space() function -->

+	

+	<context select="/">

+	  <valueOf select="normalize-space('    abc    ')">abc</valueOf>

+	  <valueOf select="normalize-space(' a  b  c  ')">a b c</valueOf>

+	  <valueOf select="normalize-space(' a &#x0d; b &#x0a;  c  ')">a b c</valueOf>

+	  <!-- Next test case addresses issue JAXEN-22 -->

+	  <valueOf select="normalize-space(' ')"></valueOf>

+	  <!-- Next test case addresses issue JAXEN-29 -->

+	  <valueOf select="normalize-space('')"></valueOf>

+	</context>

+  </document>

+

+

+

+  <!-- test cases for String extension functions -->

+  <document url="xml/web.xml">

+    <context select="/web-app/servlet[1]">

+      <valueOf select="upper-case( servlet-class )">SNOOPSERVLET</valueOf>

+      <valueOf select="lower-case( servlet-class )">snoopservlet</valueOf>

+      <valueOf select="upper-case( servlet-class, 'fr' )">SNOOPSERVLET</valueOf>

+      <valueOf select="upper-case( servlet-class, 'fr-CA' )">SNOOPSERVLET</valueOf>

+      <valueOf select="upper-case( servlet-class, 'es-ES-Traditional_WIN' )">SNOOPSERVLET</valueOf>

+      <valueOf select="ends-with( servlet-class, 'Servlet' )">true</valueOf>

+      <valueOf select="ends-with( servlet-class, 'S' )">false</valueOf>

+    </context>

+  </document>

+

+  <!-- test cases for the lang() function -->

+  <document url="xml/lang.xml">

+    <context select="/">

+      <test select="/e1/e2[lang('hr')]" count="0"/>

+      <test select="/e1/e2/e3[lang('en')]" count="1"/>

+      <test select="/e1/e2/e3[lang('en-US')]" count="1"/>

+      <test select="/e1/e2/e3[lang('en-GB')]" count="0"/>

+      <test select="/e1/e2/e3[lang('hu')]" count="2"/>

+      <test select="/e1/e2/e3[lang('hu-HU')]" count="0"/>

+      <test select="/e1/e2/e3[lang('es')]" count="1"/>

+      <test select="/e1/e2/e3[lang('es-BR')]" count="0"/>

+    </context>

+  </document>

+

+  <!-- test namespace -->

+  <document url="xml/namespaces.xml">

+    <context select="/"

+	     xmlns:foo="http://fooNamespace/"

+	     xmlns:voo="http://fooNamespace/"

+	     xmlns:bar="http://barNamespace/"

+	     xmlns:alias="http://fooNamespace/">

+      <test select="/*" count="1"/>

+      <test select="/foo:a" count="1"/>

+      <test select="/foo:a/b" count="1"/>

+      <test select="/voo:a/b/c" count="1"/>

+      <test select="/voo:a/bar:f" count="1"/>

+      <test select="/*[namespace-uri()='http://fooNamespace/' and local-name()='a']" count="1"/>

+      <test select="/*[local-name()='a' and namespace-uri()='http://fooNamespace/']/*[local-name()='x' and namespace-uri()='http://fooNamespace/']" count="1"/>

+      <test select="/*[local-name()='a' and namespace-uri()='http://fooNamespace/']/*[local-name()='x' and namespace-uri()='http://fooNamespace/']/*[local-name()='y' and namespace-uri()='http://fooNamespace/']" count="1"/>

+    </context>

+    <!-- the prefix here and in the document have no relation; it's their

+    namespace-uri binding that counts -->

+    <context select="/" xmlns:foo="http://somethingElse/">

+      <test select="/foo:a/b/c" count="0"/>

+    </context>

+

+    <context select="/"

+	     xmlns:foo="http://fooNamespace/"

+	     xmlns:bar="http://barNamespace/"

+	     xmlns:alias="http://fooNamespace/">

+      <valueOf select="/foo:a/b/c">Hello</valueOf>

+      <valueOf select="/foo:a/foo:d/foo:e">Hey</valueOf>

+      <valueOf select="/foo:a/alias:x/alias:y">Hey3</valueOf>

+      <valueOf select="/foo:a/foo:x/foo:y">Hey3</valueOf>

+      <valueOf select="/*[local-name()='a' and namespace-uri()='http://fooNamespace/']/*[local-name()='x' and namespace-uri()='http://fooNamespace/']/*[local-name()='y' and namespace-uri()='http://fooNamespace/']">Hey3</valueOf>

+    </context>

+

+  </document>

+

+  <document url="xml/defaultNamespace.xml">

+    <context select="/">

+      <!-- NOTE: /a/b/c selects elements in no namespace only! -->

+      <test select="/a/b/c" count="0"/>

+      <!--

+        The following test uses an unbound prefix 'x' and should throw an exception.

+        Addresses issue JAXEN-18.

+        Turns out this isn't really tested as the test didn't fail when the exception wasn't thrown.

+      <test select="/x:a/x:b/x:c" count="0" exception="true"/>

+      -->

+    </context>

+    <context select="/"

+	     xmlns:dummy="http://dummyNamespace/">

+      <test select="/dummy:a/dummy:b/dummy:c" count="1"/>

+    </context>

+  </document>

+  <document url="xml/text.xml">

+    <context select="/">

+      <test select="/foo/bar/text()" count="3"/>

+      <valueOf select="normalize-space(/foo/bar/text())">baz</valueOf>

+    </context>

+  </document>

+

+  <document url="xml/testNamespaces.xml">

+    <context select="/">

+      <!-- the root is not an element, so no namespaces -->

+      <test select="namespace::*" count="0" debug="off"/>

+      <test select="/namespace::*" count="0" debug="off"/>

+      <!-- must count the default xml: prefix as well -->

+      <test select="/Template/Application1/namespace::*" count="3" debug="off"/>

+      <test select="/Template/Application2/namespace::*" count="3" debug="off"/>

+

+      <!-- every element has separate copies -->

+      <test select="//namespace::*" count="25" debug="off"/>

+    </context>

+

+    <context select="/Template/Application1">

+      <!-- must count the default xml: prefix as well -->

+      <test select="namespace::*" count="3" debug="off"/>

+      <test select="/namespace::*" count="0" debug="off"/>

+      <test select="/Template/Application1/namespace::*" count="3" debug="off"/>

+      <test select="/Template/Application2/namespace::*" count="3" debug="off"/>

+      <test select="//namespace::*" count="25" debug="off"/>

+      <test select="//namespace::xplt" count="8" debug="off"/>

+      <!-- the name test literally matches the prefix as given in the

+      document, and does not use the uri -->

+      <test xmlns:somethingelse="http://www.xxxx.com/"

+	    select="//namespace::somethingelse" count="0" debug="off"/>

+    </context>

+  </document>

+

+  <document url="xml/testNamespaces.xml">

+    <context select="/">

+      <!-- namespace nodes have their element as their parent -->

+      <test select="/Template/namespace::xml/parent::Template" count="1"/>

+    </context>

+    <!-- namespace nodes can also be used as context nodes -->

+    <context select="/Template/namespace::xml">

+      <test select="parent::Template" count="1"/>

+    </context>

+  </document>

+

+</tests>

diff --git a/axiom/modules/axiom-tests/test-resources/xml/test/tests.xsl b/axiom/modules/axiom-tests/test-resources/xml/test/tests.xsl
new file mode 100644
index 0000000..d8a6c41
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/test/tests.xsl
@@ -0,0 +1,369 @@
+<stylesheet	xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:var="http://jaxen.org/test-harness/var">

+<!-- this is what I used to generate XPathTestBase. After generating I fixed the illegal strings (its quicker

+than fixing the xsl for that few errors) and reformatted the code. Its unlikely this code will be needed

+again, its just in cvs for completeness -->

+    <output method="text"/>

+    <template match="/">

+        <text>

+            /*

+ * $Header: /home/projects/jaxen/scm/jaxen/src/java/test/org/jaxen/XPathTestBase.java,v 1.32 2005/06/15 23:52:40 bewins Exp $

+ * $Revision: 1.32 $

+ * $Date: 2005/06/15 23:52:40 $

+ *

+ * ====================================================================

+ *

+ * Copyright (C) 2000-2002 bob mcwhirter &amp; James Strachan.

+ * All rights reserved.

+ *

+ * Redistribution and use in source and binary forms, with or without

+ * modification, are permitted provided that the following conditions

+ * are met:

+ *

+ * 1. Redistributions of source code must retain the above copyright

+ *    notice, this list of conditions, and the following disclaimer.

+ *

+ * 2. Redistributions in binary form must reproduce the above copyright

+ *    notice, this list of conditions, and the disclaimer that follows

+ *    these conditions in the documentation and/or other materials

+ *    provided with the distribution.

+ *

+ * 3. The name "Jaxen" must not be used to endorse or promote products

+ *    derived from this software without prior written permission.  For

+ *    written permission, please contact license@jaxen.org.

+ *

+ * 4. Products derived from this software may not be called "Jaxen", nor

+ *    may "Jaxen" appear in their name, without prior written permission

+ *    from the Jaxen Project Management (pm@jaxen.org).

+ *

+ * In addition, we request (but do not require) that you include in the

+ * end-user documentation provided with the redistribution and/or in the

+ * software itself an acknowledgement equivalent to the following:

+ *     "This product includes software developed by the

+ *      Jaxen Project (http://www.jaxen.org/)."

+ * Alternatively, the acknowledgment may be graphical using the logos

+ * available at http://www.jaxen.org/

+ *

+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED

+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES

+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE

+ * DISCLAIMED.  IN NO EVENT SHALL THE Jaxen AUTHORS OR THE PROJECT

+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,

+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT

+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF

+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND

+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,

+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT

+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF

+ * SUCH DAMAGE.

+ *

+ * ====================================================================

+ * This software consists of voluntary contributions made by many

+ * individuals on behalf of the Jaxen Project and was originally

+ * created by bob mcwhirter &lt;bob@werken.com> and

+ * James Strachan &lt;jstrachan@apache.org>.  For more information on the

+ * Jaxen Project, please see &lt;http://www.jaxen.org/>.

+ *

+ * $Id: XPathTestBase.java,v 1.32 2005/06/15 23:52:40 bewins Exp $

+ */

+

+

+package org.jaxen;

+

+import junit.framework.TestCase;

+import org.jaxen.function.StringFunction;

+import org.jaxen.saxpath.helpers.XPathReaderFactory;

+

+import javax.xml.parsers.ParserConfigurationException;

+import java.util.ArrayList;

+import java.util.Iterator;

+import java.util.List;

+

+public abstract class XPathTestBase extends TestCase

+{

+    protected static String VAR_URI   = "http://jaxen.org/test-harness/var";

+    protected static String TESTS_XML = "xml/test/tests.xml";

+

+    protected static boolean verbose = true;

+    protected static boolean debug = true;

+    private ContextSupport  contextSupport;

+

+    public XPathTestBase(String name)

+    {

+        super( name );

+    }

+

+    public void setUp() throws ParserConfigurationException

+    {

+        this.contextSupport = null;

+        System.setProperty( XPathReaderFactory.DRIVER_PROPERTY,

+                            "" );

+        log( "-----------------------------" );

+    }

+

+    public void log(String text)

+    {

+        log( verbose,

+             text );

+    }

+

+    public void log(boolean actualVerbose,

+                    String text)

+    {

+        if ( ! actualVerbose )

+        {

+            return;

+        }

+

+        System.out.println( text );

+    }

+

+    protected void assertCountXPath(int expectedSize, Object context, String xpathStr) throws JaxenException {

+        try

+        {

+            assertCountXPath2(expectedSize, context, xpathStr);

+        }

+        catch (UnsupportedAxisException e)

+        {

+            log ( debug,

+                  "      ## SKIPPED -- Unsupported Axis" );

+        }

+    }

+

+    protected Object assertCountXPath2(int expectedSize, Object context, String xpathStr) throws JaxenException {

+        log ( debug,

+              "  Select :: " + xpathStr );

+        BaseXPath xpath = new BaseXPath( xpathStr );

+        List results = xpath.selectNodes( getContext( context ) );

+        log ( debug,

+              "    Expected Size :: " + expectedSize );

+        log ( debug,

+              "    Result Size   :: " + results.size() );

+

+        if ( expectedSize != results.size() )

+        {

+            log ( debug,

+                  "      ## FAILED" );

+            log ( debug,

+                  "      ## xpath: " + xpath + " = " + xpath.debug() );

+

+            Iterator resultIter = results.iterator();

+

+            while ( resultIter.hasNext() )

+            {

+                log ( debug,

+                      "      --> " + resultIter.next() );

+            }

+        }

+        assertEquals( xpathStr,

+                      expectedSize,

+                      results.size() );

+        if (expectedSize > 0) {

+            return results.get(0);

+        }

+        return null;

+    }

+

+    protected void assertInvalidXPath(Object context, String xpathStr) throws JaxenException {

+        try 

+        {

+            log ( debug,

+                  "  Select :: " + xpathStr );

+            BaseXPath xpath = new BaseXPath( xpathStr );

+            List results = xpath.selectNodes( getContext( context ) );

+            log ( debug,

+                  "    Result Size   :: " + results.size() );

+            fail("An exception was expected.");

+        }

+        catch (UnsupportedAxisException e)

+        {

+            log ( debug,

+                  "      ## SKIPPED -- Unsupported Axis" );

+        }

+        catch (JaxenException e) {

+            log (debug, "    Caught expected exception "+e.getMessage());

+        }

+    }

+

+    protected void assertValueOfXPath(String expected, Object context, String xpathStr) throws JaxenException {

+        try

+        {

+            BaseXPath xpath = new BaseXPath( xpathStr );

+            Object node = xpath.evaluate( getContext( context ) );

+            

+            String result = StringFunction.evaluate( node,

+                                                     getNavigator() );

+            

+            log ( debug,

+                  "  Select :: " + xpathStr );

+            log ( debug,

+                  "    Expected :: " + expected );

+            log ( debug,

+                  "    Result   :: " + result );

+            

+            if ( ! expected.equals( result ) )

+            {

+                log ( debug,

+                      "      ## FAILED" );

+                log ( debug,

+                      "      ## xpath: " + xpath + " = " + xpath.debug() );

+            }

+            

+            assertEquals( xpathStr,

+                          expected,

+                          result );

+        }

+        catch (UnsupportedAxisException e)

+        {

+            log ( debug,

+                  "      ## SKIPPED -- Unsupported Axis " );

+

+        }        

+    }

+    protected Context getContext(Object contextNode)

+    {

+        Context context = new Context( getContextSupport() );

+

+        List list = new ArrayList( 1 );

+        list.add( contextNode );

+        context.setNodeSet( list );

+

+        return context;

+    }

+

+    public ContextSupport getContextSupport()

+    {

+        if ( this.contextSupport == null )

+        {

+            this.contextSupport = new ContextSupport( new SimpleNamespaceContext(),

+                                                      XPathFunctionContext.getInstance(),

+                                                      new SimpleVariableContext(),

+                                                      getNavigator() );

+        }

+

+        return this.contextSupport;

+    }

+

+    public abstract Navigator getNavigator();

+

+    public abstract Object getDocument(String url) throws Exception;

+

+    public void testGetNodeType() throws FunctionCallException, UnsupportedAxisException

+    {

+        Navigator nav = getNavigator();

+        Object document = nav.getDocument("xml/testNamespaces.xml");

+        int count = 0;

+        Iterator descendantOrSelfAxisIterator = nav.getDescendantOrSelfAxisIterator(document);

+        while (descendantOrSelfAxisIterator.hasNext()) {

+            Object node = descendantOrSelfAxisIterator.next();

+            Iterator namespaceAxisIterator = nav.getNamespaceAxisIterator(node);

+            while (namespaceAxisIterator.hasNext()) {

+                count++;

+                assertEquals("Node type mismatch", Pattern.NAMESPACE_NODE, nav.getNodeType(namespaceAxisIterator.next()));

+            }

+        }

+        assertEquals(25, count);

+    }

+

+        </text>

+        <apply-templates select="node()|@*"/>

+        <text>

+}            

+        </text>

+    </template>

+    <template match="context">

+        <text>

+    public void test</text><value-of select="generate-id()"/><text>() throws JaxenException {

+        Navigator nav = getNavigator();

+        String url = "</text><value-of select="../@url"/><text>";

+        log( "Document [" + url + "]" );

+        Object document = nav.getDocument(url);

+

+        XPath contextpath = new BaseXPath("</text><value-of select="@select"/><text>", nav);

+        log( "Initial Context :: " + contextpath );

+        List list = contextpath.selectNodes(document);

+        </text>

+        <if test="count(namespace::*) > count(../namespace::*)">

+        <text>

+        SimpleNamespaceContext nsContext = new SimpleNamespaceContext();</text>

+            <for-each select="namespace::*[local-name() != 'var' and local-name() != 'xml']">

+                <text>

+        nsContext.addNamespace( "</text><value-of select="local-name()"/><text>", "</text><value-of select="."/><text>" );</text>

+           </for-each>

+            <text>

+        getContextSupport().setNamespaceContext( nsContext );</text>

+        </if>

+        <if test="@*[namespace-uri() = 'http://jaxen.org/test-harness/var']">

+        <text>

+        SimpleVariableContext varContext = new SimpleVariableContext();</text>

+            <for-each select="@*[namespace-uri() = 'http://jaxen.org/test-harness/var']">

+                <text>

+        varContext.setVariableValue(null, "</text><value-of select="local-name()"/><text>", "</text><value-of select="."/><text>" );</text>

+           </for-each>

+            <text>

+        getContextSupport().setVariableContext( varContext );</text>

+        </if>

+        <text>

+        Iterator iter = list.iterator();

+        while (iter.hasNext()) {

+            Object context = iter.next();</text>

+            <apply-templates select="node()|@*"/>

+        <text>

+        }

+    }</text>

+    </template>

+    <template match="test[@exception]">

+        <text>

+            assertInvalidXPath(context, "</text><value-of select='@select'/><text>");</text>

+    </template>

+    <template match="test[valueOf]">

+        <choose>

+            <when test="@count">

+                <text>

+            try

+            {

+                Object result = assertCountXPath2(</text><value-of select="@count"/><text>, context, "</text><value-of select="@select"/><text>");</text>

+        <for-each select="valueOf">

+            <text>

+                assertValueOfXPath("</text><value-of select="."/><text>", result, "</text><value-of select="@select"/><text>");</text>

+        </for-each>

+        <text>

+            }

+            catch (UnsupportedAxisException e)

+            {

+                log ( debug, "      ## SKIPPED -- Unsupported Axis" );

+            }</text>

+            </when>

+            <otherwise>

+                <text>

+            try

+            {

+                BaseXPath xpath = new BaseXPath( "</text><value-of select="@select"/><text>" );

+                List results = xpath.selectNodes( getContext( context ) );

+                Object result = results.get(0);</text>

+        <for-each select="valueOf">

+            <text>

+                assertValueOfXPath("</text><value-of select="."/><text>", result, "</text><value-of select="@select"/><text>");</text>

+        </for-each>

+        <text>

+            }

+            catch (UnsupportedAxisException e)

+            {

+                log ( debug, "      ## SKIPPED -- Unsupported Axis" );

+            }</text>

+            </otherwise>

+        </choose>

+    </template>

+    <template match="test">

+        <text>

+            assertCountXPath(</text><value-of select="@count"/><text>, context, "</text><value-of select="@select"/><text>");</text>

+    </template>

+    <template match="valueOf">

+        <text>

+            assertValueOfXPath("</text><value-of select="."/>", context, "<value-of select="@select"/><text>");</text>

+    </template>

+    <template match="comment()"><text>

+    /*</text><value-of select="."/><text>

+    */</text>

+    </template>

+    <template match="node()|@*"><apply-templates select="node()|@*"/></template>    

+</stylesheet>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/xml/testNamespaces.xml b/axiom/modules/axiom-tests/test-resources/xml/testNamespaces.xml
new file mode 100644
index 0000000..df3ead1
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/testNamespaces.xml
@@ -0,0 +1,22 @@
+<Template> 

+  <Application1 xmlns:xplt="http://www.xxxx.com/"

+                xmlns:xpl="http://www.xxxx.com/"

+                version="3.0"

+                randomAttribute="foo"

+  >

+    <xpl:insertText/> 

+    <xplt:anyElement> 

+      <Name/> 

+    </xplt:anyElement> 

+  </Application1> 

+

+  <Application2 xmlns:xplt="http://www.xxxx.com/"

+                xmlns:xpl="http://www.xxxx.com/"

+                version="3.0"

+  > 

+    <xpl:insertText/> 

+    <xplt:anyElement> 

+      <Name/> 

+    </xplt:anyElement> 

+  </Application2> 

+</Template>

diff --git a/axiom/modules/axiom-tests/test-resources/xml/text.xml b/axiom/modules/axiom-tests/test-resources/xml/text.xml
new file mode 100644
index 0000000..0a84c9a
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/text.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>

+<foo>

+	<bar>

+		baz

+		<cheese id="3"/>

+		baz

+		<cheese/>

+		baz

+	</bar>

+</foo>

diff --git a/axiom/modules/axiom-tests/test-resources/xml/underscore.xml b/axiom/modules/axiom-tests/test-resources/xml/underscore.xml
new file mode 100644
index 0000000..fc7f417
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/underscore.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" ?>

+<root a="1" _a="2">

+  <b>1</b>

+  <_b>2</_b>

+</root>

+  

diff --git a/axiom/modules/axiom-tests/test-resources/xml/web.xml b/axiom/modules/axiom-tests/test-resources/xml/web.xml
new file mode 100644
index 0000000..b014618
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/web.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>

+<web-app>

+  <servlet>

+    <servlet-name>snoop</servlet-name>

+    <servlet-class>SnoopServlet</servlet-class>

+  </servlet>

+  <servlet>

+    <servlet-name>file</servlet-name>

+    <servlet-class>ViewFile</servlet-class>

+    <init-param>

+      <param-name>initial</param-name>

+      <param-value>

+        1000

+      </param-value>

+      <description>

+        The initial value for the counter  <!-- optional -->

+      </description>

+    </init-param>

+  </servlet>

+  <servlet-mapping>

+    <servlet-name>

+      mv

+    </servlet-name>

+    <url-pattern>

+      *.wm

+    </url-pattern>

+  </servlet-mapping>

+

+  <distributed/>

+

+  <security-role>

+    <role-name>

+     manager

+    </role-name>

+    <role-name>

+     director

+    </role-name>

+    <role-name>

+     president

+    </role-name>

+  </security-role>

+</web-app>
\ No newline at end of file
diff --git a/axiom/modules/axiom-tests/test-resources/xml/web2.xml b/axiom/modules/axiom-tests/test-resources/xml/web2.xml
new file mode 100644
index 0000000..183e487
--- /dev/null
+++ b/axiom/modules/axiom-tests/test-resources/xml/web2.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>

+<root>

+  <b>

+    <d />

+  </b>

+  <c />

+</root>

diff --git a/axiom/pom.xml b/axiom/pom.xml
new file mode 100644
index 0000000..f5b7874
--- /dev/null
+++ b/axiom/pom.xml
@@ -0,0 +1,447 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+        xmlns="http://maven.apache.org/POM/4.0.0"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.ws.commons.axiom</groupId>
+    <artifactId>axiom-parent</artifactId>
+    <name>Axiom</name>
+    <version>SNAPSHOT</version>
+    <!-- Should better be ${axiom.version} -->
+    <packaging>pom</packaging>
+    <description>AXIOM API</description>
+    <url>http://ws.apache.org/commons/axiom/</url>
+    <issueManagement>
+        <system>JIRA</system>
+        <url>http://issues.apache.org/jira/browse/WSCOMMONS</url>
+    </issueManagement>
+    <ciManagement>
+        <system>Continuum</system>
+        <url>unknown</url>
+        <notifiers>
+            <notifier>
+                <configuration>
+                    <address>commons-dev@ws.apache.org</address>
+                </configuration>
+            </notifier>
+        </notifiers>
+    </ciManagement>
+    <mailingLists>
+        <mailingList>
+            <name>WS Commons Developers</name>
+            <subscribe>commons-dev-subscribe@ws.apache.org</subscribe>
+            <unsubscribe>commons-dev-unsubscribe@ws.apache.org</unsubscribe>
+            <post>commons-dev@ws.apache.org</post>
+            <archive>http://mail-archives.apache.org/mod_mbox/ws-commons-dev/</archive>
+        </mailingList>
+    </mailingLists>
+    <inceptionYear>2004</inceptionYear>
+    <developers>
+        <developer>
+            <name>Saminda Abeyruwan</name>
+            <id>saminda</id>
+            <email>saminda AT wso2.com</email>
+            <organization>WSO2</organization>
+        </developer>
+        <developer>
+            <name>Afkham Azeez</name>
+            <id>azeez</id>
+            <email>azeez AT wso2.com</email>
+            <organization>WSO2</organization>
+        </developer>
+        <developer>
+            <name>Eran Chinthaka</name>
+            <id>chinthaka</id>
+            <email>chinthaka AT wso2.com</email>
+            <organization>WSO2</organization>
+            <url>http://www.apache.org/~chinthaka</url>
+        </developer>
+        <developer>
+            <name>Glen Daniels</name>
+            <id>gdaniels</id>
+            <email>gdaniels AT apache.org</email>
+            <organization>Sonic Software</organization>
+        </developer>
+        <developer>
+            <name>Jaliya Ekanayake</name>
+            <id>jaliya</id>
+            <email>jaliya AT opensource.lk</email>
+            <organization>Virtusa / Lanka Software Foundation</organization>
+            <url>http://www.apache.org/~jaliya</url>
+        </developer>
+        <developer>
+            <name>Ruchith Fernando</name>
+            <id>ruchith</id>
+            <email>ruchith AT wso2.com</email>
+            <organization>WSO2</organization>
+        </developer>
+    	<developer>
+      	    <id>thilina</id>
+            <name>Thilina Gunarathne</name>
+            <email>thilina AT wso2.com</email>
+            <url>http://www.apache.org/~thilina</url>
+            <organization>WSO2</organization>
+        </developer>
+        <developer>
+            <name>Chathura Herath</name>
+            <id>chathura</id>
+            <email>chathura AT opensource.lk</email>
+            <organization>LSF/MIT</organization>
+            <url>www.apache.org/~chathura</url>
+        </developer>
+        <developer>
+            <name>Deepal Jayasinghe</name>
+            <id>deepal</id>
+            <email>deepal AT wso2.com</email>
+            <organization>WSO2</organization>
+            <url>http://www.apache.org/~deepal</url>
+        </developer>
+        <developer>
+            <name>Chatra Nakkawita</name>
+            <id>chatra</id>
+            <email>chatra AT WSO2.com</email>
+            <organization>WSO2</organization>
+        </developer>
+        <developer>
+            <name>Srinath Perera</name>
+            <id>hemapani</id>
+            <email>hemapani AT apache.org</email>
+            <organization>Lanka Software Foundation</organization>
+            <url>http://www.apache.org/~hemapani</url>
+        </developer>
+        <developer>
+            <name>Ajith Ranabahu</name>
+            <id>ajith</id>
+            <email>ajith AT wso2.com</email>
+            <organization>WSO2</organization>
+            <url>http://www.apache.org/~ajith</url>
+        </developer>
+        <developer>
+            <name>Venkat Reddy</name>
+            <id>venkat</id>
+            <email>vreddyp AT gmail.com</email>
+            <organization>Computer Associates</organization>
+        </developer>
+        <developer>
+            <name>Ashutosh Shahi</name>
+            <id>ashu</id>
+            <email>Ashutosh.Shahi AT ca.com</email>
+            <organization>Computer Associates</organization>
+        </developer>
+        <developer>
+            <name>Aleksander Slominski</name>
+            <id>alek</id>
+            <email>aslom AT cs.indiana.edu</email>
+            <organization>Indiana University Extreme! Computing Lab</organization>
+        </developer>
+        <developer>
+            <name>Davanum Srinivas</name>
+            <id>dims</id>
+            <email>dims AT wso2.com</email>
+            <organization>WSO2</organization>
+        </developer>
+        <developer>
+            <name>Jayachandra Sekhara Rao Sunkara</name>
+            <id>jaya</id>
+            <email>jayachandra AT gmail.com</email>
+            <organization>Computer Associates</organization>
+        </developer>
+        <developer>
+            <name>Dasarath Weerathunga</name>
+            <id>dasarath</id>
+            <email>dasarath AT opensource.lk</email>
+            <organization>Lanka Software Foundation</organization>
+        </developer>
+        <developer>
+            <name>Sanjiva Weerawarana</name>
+            <id>sanjiva</id>
+            <email>sanjiva AT wso2.com</email>
+            <organization>WSO2</organization>
+        </developer>
+    </developers>
+    <contributors>
+
+        <contributor>
+            <name>Dharshana Dias</name>
+            <email/>
+            <organization>Lanka Software Foundation / University of Moratuwa</organization>
+        </contributor>
+        <contributor>
+            <name>Anushka Kumara</name>
+            <email>anushkakumar AT gmail.com</email>
+            <organization>Lanka Software Foundation / University of Moratuwa</organization>
+        </contributor>
+        <contributor>
+            <name>Chinthaka Thilakarathne</name>
+            <email/>
+            <organization>Lanka Software Foundation / University of Moratuwa</organization>
+        </contributor>
+        <contributor>
+            <name>Jochen Wiedmann</name>
+            <email>jochen.wiedmann AT gmail.com</email>
+        </contributor>
+    </contributors>
+    <licenses>
+        <license>
+            <name>The Apache Software License, Version 2.0</name>
+            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+            <distribution>repo</distribution>
+        </license>
+    </licenses>
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/axiom</connection>
+        <developerConnection>
+            scm:svn:https://svn.apache.org/repos/asf/webservices/commons/trunk/modules/axiom</developerConnection>
+        <url>http://svn.apache.org/viewcvs.cgi/webservices/commons/trunk/modules/axiom</url>
+    </scm>
+    <organization>
+        <name>Apache Software Foundation</name>
+        <url>http://www.apache.org/</url>
+    </organization>
+    <profiles>
+        <profile>
+            <id>release</id>
+            <activation>
+                <property>
+                    <name>release</name>
+                    <value></value>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <artifactId>maven-javadoc-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>jar</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                        <configuration>
+                            <attach>true</attach>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <inherited>true</inherited>
+                <configuration>
+                    <source>1.3</source>
+                    <target>1.3</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <configuration>
+                    <descriptors>
+                        <descriptor>src/main/assembly/bin.xml</descriptor>
+                        <descriptor>src/main/assembly/src.xml</descriptor>
+                    </descriptors>
+                    <tarLongFileMode>gnu</tarLongFileMode>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-source-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <attach>true</attach>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    <pluginRepositories>
+        <pluginRepository>
+            <id>snapshot</id>
+            <name>Snapshot repository</name>
+            <url>http://snapshots.maven.codehaus.org/maven2/</url>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
+        </pluginRepository>
+        <pluginRepository>
+            <id>snapshot-apache</id>
+            <name>Apache Snapshot repository</name>
+            <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
+        </pluginRepository>
+    </pluginRepositories>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>xml-apis</groupId>
+                <artifactId>xml-apis</artifactId>
+                <version>1.3.03</version>
+            </dependency>
+            <dependency>
+                <groupId>stax</groupId>
+                <artifactId>stax-api</artifactId>
+                <version>1.0.1</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.ws.commons.axiom</groupId>
+                <artifactId>axiom-api</artifactId>
+                <version>${axiom.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.ws.commons.axiom</groupId>
+                <artifactId>axiom-impl</artifactId>
+                <version>${axiom.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.ws.commons.axiom</groupId>
+                <artifactId>axiom-dom</artifactId>
+                <version>${axiom.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>commons-logging</groupId>
+                <artifactId>commons-logging</artifactId>
+                <version>1.0.4</version>
+                <exclusions>
+                    <exclusion>
+                        <artifactId>avalon-framework</artifactId>
+                        <groupId>avalon-framework</groupId>
+                    </exclusion>
+                    <exclusion>
+                        <artifactId>logkit</artifactId>
+                        <groupId>logkit</groupId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>stax</groupId>
+                <artifactId>stax-api</artifactId>
+                <version>1.0</version>
+                <scope>compile</scope>
+            </dependency>
+            <dependency>
+                <groupId>woodstox</groupId>
+                <artifactId>wstx-asl</artifactId>
+                <version>3.0.0</version>
+            </dependency>
+            <dependency>
+                <groupId>jaxen</groupId>
+                <artifactId>jaxen</artifactId>
+                <version>1.1-beta-9</version>
+                <exclusions>
+                    <exclusion>
+                        <artifactId>dom4j</artifactId>
+                        <groupId>dom4j</groupId>
+                    </exclusion>
+                    <exclusion>
+                        <artifactId>xom</artifactId>
+                        <groupId>xom</groupId>
+                    </exclusion>
+                    <exclusion>
+                        <artifactId>jdom</artifactId>
+                        <groupId>jdom</groupId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>xerces</groupId>
+                        <artifactId>xmlParserAPIs</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>javax.mail</groupId>
+                <artifactId>mail</artifactId>
+                <version>1.4</version>
+            </dependency>
+            <dependency>
+                <groupId>junit</groupId>
+                <artifactId>junit</artifactId>
+                <version>3.8.2</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>xmlunit</groupId>
+                <artifactId>xmlunit</artifactId>
+                <version>1.0</version>
+                <scope>test</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+    <reporting>
+        <plugins>
+            <!--<plugin>-->
+                <!--<inherited>false</inherited>-->
+                <!--<artifactId>maven-javadoc-plugin</artifactId>-->
+                <!--<configuration>-->
+                    <!--<aggregate>true</aggregate>-->
+                <!--</configuration>-->
+            <!--</plugin>-->
+            <!--<plugin>-->
+                <!--<artifactId>maven-changes-plugin</artifactId>-->
+                <!--<reportSets>-->
+                    <!--<reportSet>-->
+                        <!--<reports>-->
+                            <!--<report>changes-report</report>-->
+                        <!--</reports>-->
+                    <!--</reportSet>-->
+                <!--</reportSets>-->
+            <!--</plugin>-->
+            <plugin>
+                <artifactId>maven-project-info-reports-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>jdepend-maven-plugin</artifactId>
+                <version>2.0-beta-1-SNAPSHOT</version>
+            </plugin>
+            <!--<plugin>-->
+                <!--<groupId>org.codehaus.mojo</groupId>-->
+                <!--<artifactId>jxr-maven-plugin</artifactId>-->
+                <!--<version>2.0-beta-2-SNAPSHOT</version>-->
+            <!--</plugin>-->
+            <plugin>
+                <artifactId>maven-site-plugin</artifactId>
+                <inherited>false</inherited>
+            </plugin>
+        </plugins>
+    </reporting>
+    <distributionManagement>
+        <repository>
+            <id>apache-repo</id>
+            <name>Maven Central Repository</name>
+            <url>scpexe://people.apache.org//www/people.apache.org/repo/m2-ibiblio-rsync-repository</url>
+        </repository>
+        <snapshotRepository>
+            <id>apache-snapshots</id>
+            <name>Apache Development Repository</name>
+            <url>scpexe://people.apache.org//www/people.apache.org/repo/m2-snapshot-repository</url>
+        </snapshotRepository>
+        <site>
+            <id>website</id>
+            <url>scpexe://people.apache.org/www/ws.apache.org/commons/axiom</url>
+        </site>
+    </distributionManagement>
+    <modules>
+        <module>modules/axiom-api</module>
+        <module>modules/axiom-impl</module>
+        <module>modules/axiom-dom</module>
+        <module>modules/axiom-tests</module>
+    </modules>
+    <properties>
+        <axiom.version>SNAPSHOT</axiom.version>
+    </properties>
+</project>
diff --git a/axiom/project.properties b/axiom/project.properties
new file mode 100644
index 0000000..01f012d
--- /dev/null
+++ b/axiom/project.properties
@@ -0,0 +1,76 @@
+# -------------------------------------------------------------------

+# Copyright 2001-2004 The Apache Software Foundation.

+#

+# Licensed 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.

+# -------------------------------------------------------------------

+

+maven.multiproject.type=jar

+

+# -------------------------------------------------------------------

+#                Project Information

+# -------------------------------------------------------------------

+axiom.version=SNAPSHOT

+

+# -------------------------------------------------------------------

+#                Dependency Repositories

+# -------------------------------------------------------------------

+maven.repo.remote=\

+http://www.ibiblio.org/maven,\

+https://maven-repository.dev.java.net/nonav/repository/,\

+http://people.apache.org/repo/m1-ibiblio-rsync-repository/,\

+http://people.apache.org/repository/,\

+http://mirrors.sunsite.dk/maven/,\

+http://ws.zones.apache.org/~dims/maven/

+

+# -------------------------------------------------------------------

+#                JUnit

+# -------------------------------------------------------------------

+maven.junit.jvmargs=-Xmx256m -Djava.awt.headless=true

+maven.junit.fork=true

+

+# -------------------------------------------------------------------

+#                Compile

+# -------------------------------------------------------------------

+maven.compile.optimize=false

+maven.compile.fork=true

+maven.compile.target=1.3

+maven.compile.source=1.3

+

+# -------------------------------------------------------------------

+#                Versions of dependencies

+# -------------------------------------------------------------------

+commons.logging.version=1.0.4

+activation.version=1.1

+javamail.version=1.4

+jaxen.version=1.1-beta-9

+junit.version=3.8.2

+log4j.version=1.2.13

+stax.api.version=1.0.1

+xmlunit.version=1.0

+xml_apis.version=1.3.03

+stax.impl.groupid=woodstox

+stax.impl.artifactid=wstx

+stax.impl.version=asl-3.0.0

+

+# -------------------------------------------------------------------

+#                xdoc

+# -------------------------------------------------------------------

+maven.xdoc.date=left

+maven.xdoc.version=${pom.currentVersion}

+maven.xdoc.includeProjectDocumentation=no

+maven.html2xdoc.enabled=true

+maven.html2xdoc.dir=src/site/xdoc

+maven.pdf.navigationFile=navigation-pdf.xml

+maven.allreports.disable=true

+

+

diff --git a/axiom/project.xml b/axiom/project.xml
new file mode 100644
index 0000000..f9169a5
--- /dev/null
+++ b/axiom/project.xml
@@ -0,0 +1,347 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<!--

+/*

+ * Copyright 2001-2004 The Apache Software Foundation.

+ *

+ * Licensed 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.

+ */

+ -->

+<project>

+    <name>Axis2.0</name>

+    <pomVersion>3</pomVersion>

+    <!-- a unique name for this project -->

+    <name>Apache AXIOM</name>

+    <id>axiom</id>

+    <groupId>ws-commons</groupId>

+    <package>org.apache.commons</package>

+    <currentVersion>${axiom.version}</currentVersion>

+    <!-- details about the organization that 'owns' the project -->

+    <organization>

+        <name>Apache Software Foundation</name>

+        <url>http://www.apache.org/</url>

+        <logo>http://www.apache.org/images/asf-logo.gif</logo>

+    </organization>

+    <inceptionYear>2004</inceptionYear>

+    <package>org.apache.commons</package>

+    <logo>http://www.apache.org/images/asf-logo.gif</logo>

+    <description>AXIOM, The Object Model of Axis 2.0. This helps Axis 2.0 to have a light weight,

+        efficient object model on StAX</description>

+    <shortDescription>AXIOM</shortDescription>

+    <!-- the project home page -->

+    <url>http://ws.apache.org/commons/axiom</url>

+    <issueTrackingUrl>http://issues.apache.org/jira/browse/WSCOMMONS</issueTrackingUrl>

+    <siteAddress>ws.apache.org/commons/axiom</siteAddress>

+    <siteDirectory>/www/ws.apache.org/commons/axiom/</siteDirectory>

+    <distributionDirectory>/www/ws.apache.org/builds/</distributionDirectory>

+    <mailingLists>

+        <mailingList>

+            <name>Commons Developer List</name>

+            <subscribe>commons-dev-subscribe@ws.apache.org</subscribe>

+            <unsubscribe>commons-dev-unsubscribe@ws.apache.org</unsubscribe>

+            <archive>http://mail-archives.apache.org/mod_mbox/ws-commons-dev/</archive>

+        </mailingList>

+    </mailingLists>

+

+    <!-- ========== -->

+    <!-- Developers -->

+    <!-- ========== -->

+    <developers>

+        <developer>

+            <name>Saminda Abeyruwan</name>

+            <id>saminda</id>

+            <email>saminda AT wso2.com</email>

+            <organization>WSO2</organization>

+        </developer>

+        <developer>

+            <name>Afkham Azeez</name>

+            <id>azeez</id>

+            <email>azeez AT wso2.com</email>

+            <organization>WSO2</organization>

+        </developer>

+        <developer>

+            <name>Eran Chinthaka</name>

+            <id>chinthaka</id>

+            <email>chinthaka AT wso2.com</email>

+            <organization>WSO2</organization>

+            <url>http://www.apache.org/~chinthaka</url>

+        </developer>

+        <developer>

+            <name>Glen Daniels</name>

+            <id>gdaniels</id>

+            <email>gdaniels AT apache.org</email>

+            <organization>Sonic Software</organization>

+        </developer>

+        <developer>

+            <name>Jaliya Ekanayake</name>

+            <id>jaliya</id>

+            <email>jaliya AT opensource.lk</email>

+            <organization>Virtusa / Lanka Software Foundation</organization>

+            <url>http://www.apache.org/~jaliya</url>

+        </developer>

+        <developer>

+            <name>Ruchith Fernando</name>

+            <id>ruchith</id>

+            <email>ruchith AT wso2.com</email>

+            <organization>WSO2</organization>

+        </developer>

+        <developer>

+            <name>Thilina Gunarathne</name>

+            <id>thilina</id>

+            <email>thilina AT opensource.lk</email>

+            <organization>Lanka Software Foundation</organization>

+        </developer>

+        <developer>

+            <name>Chathura Herath</name>

+            <id>chathura</id>

+            <email>chathura AT opensource.lk</email>

+            <organization>LSF/MIT</organization>

+            <url>www.apache.org/~chathura</url>

+        </developer>

+        <developer>

+            <name>Deepal Jayasinghe</name>

+            <id>deepal</id>

+            <email>deepal AT wso2.com</email>

+            <organization>WSO2</organization>

+            <url>http://www.apache.org/~deepal</url>

+        </developer>

+        <developer>

+            <name>Chatra Nakkawita</name>

+            <id>chatra</id>

+            <email>chatra AT WSO2.com</email>

+            <organization>WSO2</organization>

+        </developer>

+        <developer>

+            <name>Srinath Perera</name>

+            <id>hemapani</id>

+            <email>hemapani AT apache.org</email>

+            <organization>Lanka Software Foundation</organization>

+            <url>http://www.apache.org/~hemapani</url>

+        </developer>

+        <developer>

+            <name>Ajith Ranabahu</name>

+            <id>ajith</id>

+            <email>ajith AT wso2.com</email>

+            <organization>WSO2</organization>

+            <url>http://www.apache.org/~ajith</url>

+        </developer>

+        <developer>

+            <name>Venkat Reddy</name>

+            <id>venkat</id>

+            <email>vreddyp AT gmail.com</email>

+            <organization>Computer Associates</organization>

+        </developer>

+        <developer>

+            <name>Ashutosh Shahi</name>

+            <id>ashu</id>

+            <email>Ashutosh.Shahi AT ca.com</email>

+            <organization>Computer Associates</organization>

+        </developer>

+        <developer>

+            <name>Aleksander Slominski</name>

+            <id>alek</id>

+            <email>aslom AT cs.indiana.edu</email>

+            <organization>Indiana University Extreme! Computing Lab</organization>

+        </developer>

+        <developer>

+            <name>Davanum Srinivas</name>

+            <id>dims</id>

+            <email>dims AT wso2.com</email>

+            <organization>WSO2</organization>

+        </developer>

+        <developer>

+            <name>Jayachandra Sekhara Rao Sunkara</name>

+            <id>jaya</id>

+            <email>jayachandra AT gmail.com</email>

+            <organization>Computer Associates</organization>

+        </developer>

+        <developer>

+            <name>Dasarath Weerathunga</name>

+            <id>dasarath</id>

+            <email>dasarath AT opensource.lk</email>

+            <organization>Lanka Software Foundation</organization>

+        </developer>

+        <developer>

+            <name>Sanjiva Weerawarana</name>

+            <id>sanjiva</id>

+            <email>sanjiva AT wso2.com</email>

+            <organization>WSO2</organization>

+        </developer>

+    </developers>

+    <contributors>

+

+        <contributor>

+            <name>Dharshana Dias</name>

+            <email/>

+            <organization>Lanka Software Foundation / University of Moratuwa</organization>

+        </contributor>

+        <contributor>

+            <name>Anushka Kumara</name>

+            <email>anushkakumar AT gmail.com</email>

+            <organization>Lanka Software Foundation / University of Moratuwa</organization>

+        </contributor>

+        <contributor>

+            <name>Chinthaka Thilakarathne</name>

+            <email/>

+            <organization>Lanka Software Foundation / University of Moratuwa</organization>

+        </contributor>

+    </contributors>

+

+

+    <build>

+        <nagEmailAddress></nagEmailAddress>

+        <sourceDirectory>src</sourceDirectory>

+        <unitTestSourceDirectory>modules/axiom-tests/src/test/java</unitTestSourceDirectory>

+

+        <unitTest>

+            <excludes>

+                <exclude>**/*SpacesTest.java</exclude>

+                <exclude>**/*AbstractOMSerializationTest.java</exclude>

+            </excludes>

+            <includes>

+                <include>**/*Test.java</include>

+            </includes>

+

+            <resources>

+                <resource>

+                    <directory>${basedir}/modules/axiom-tests/test-resources</directory>

+                </resource>

+                <resource>

+                    <directory>conf</directory>

+                    <includes>

+                        <include>**/*.properties</include>

+                    </includes>

+                </resource>

+                <resource>

+                    <directory>src</directory>

+                    <includes>

+                        <include>**/*.properties</include>

+                        <include>**/*.xml</include>

+                    </includes>

+                </resource>

+            </resources>

+        </unitTest>

+

+        <resources>

+            <resource>

+                <directory>conf</directory>

+                <includes>

+                    <include>**/*.properties</include>

+                </includes>

+            </resource>

+            <resource>

+                <directory>src</directory>

+                <includes>

+                    <include>**/*.properties</include>

+                    <include>**/*.xml</include>

+                </includes>

+            </resource>

+            <resource>

+                <directory>${basedir}</directory>

+                <targetPath>META-INF</targetPath>

+                <includes>

+                    <include>NOTICE.txt</include>

+                    <include>LICENSE.txt</include>

+                </includes>

+            </resource>

+        </resources>

+    </build>

+

+    <reports>

+        <report>maven-junit-report-plugin</report>

+    </reports>

+

+    <dependencies>

+        <!-- external JARs -->

+

+        <dependency>

+            <groupId>commons-logging</groupId>

+            <artifactId>commons-logging</artifactId>

+            <version>${commons.logging.version}</version>

+            <properties>

+                <module>true</module>

+            </properties>

+        </dependency>

+        <dependency>

+            <groupId>${stax.impl.groupid}</groupId>

+            <artifactId>${stax.impl.artifactid}</artifactId>

+            <version>${stax.impl.version}</version>

+            <properties>

+                <module>true</module>

+            </properties>

+        </dependency>

+        <dependency>

+            <groupId>stax</groupId>

+            <artifactId>stax-api</artifactId>

+            <version>${stax.api.version}</version>

+            <properties>

+                <module>true</module>

+            </properties>

+        </dependency>

+        <dependency>

+            <groupId>log4j</groupId>

+            <artifactId>log4j</artifactId>

+            <version>${log4j.version}</version>

+            <properties>

+                <module>true</module>

+            </properties>

+            <url>http://dist.codehaus.org/stax/jars/</url>

+        </dependency>

+

+        <dependency>

+            <groupId>jaxen</groupId>

+            <artifactId>jaxen</artifactId>

+            <version>${jaxen.version}</version>

+            <properties>

+                <module>true</module>

+            </properties>

+            <url>http://www.ibiblio.org/maven/jaxen/jars/</url>

+        </dependency>

+        <dependency>

+            <groupId>xmlunit</groupId>

+            <artifactId>xmlunit</artifactId>

+            <version>${xmlunit.version}</version>

+            <properties>

+                <module>true</module>

+            </properties>

+            <url>http://www.ibiblio.org/maven/xmlunit/jars/</url>

+        </dependency>

+

+        <dependency>

+            <groupId>javax.mail</groupId>

+            <artifactId>mail</artifactId>

+            <version>${javamail.version}</version>

+            <properties>

+                <module>true</module>

+            </properties>

+        </dependency>

+

+        <dependency>

+            <groupId>javax.activation</groupId>

+            <artifactId>activation</artifactId>

+            <version>${activation.version}</version>

+            <properties>

+                <module>true</module>

+            </properties>

+        </dependency>

+

+        <dependency>

+            <groupId>xml-apis</groupId>

+            <artifactId>xml-apis</artifactId>

+            <version>${xml_apis.version}</version>

+            <properties>

+                <module>true</module>

+            </properties>

+        </dependency>

+    </dependencies>

+

+</project>

diff --git a/axiom/src/changes/changes.xml b/axiom/src/changes/changes.xml
new file mode 100755
index 0000000..ba5be34
--- /dev/null
+++ b/axiom/src/changes/changes.xml
@@ -0,0 +1,14 @@
+<document>
+  <properties>
+    <title>Changes in Apache Axiom</title>
+  </properties>
+  <body>
+    <release version="1.1" date="Not yet released">
+      <action dev="jochen" type="add">
+        Added support for Maven 2 as the build system.
+      </action>
+    </release>
+    <release version="1.0" date="02-Max-2006">
+    </release>
+  </body>
+</document>
diff --git a/axiom/src/main/assembly/bin.xml b/axiom/src/main/assembly/bin.xml
new file mode 100644
index 0000000..f5d9a0f
--- /dev/null
+++ b/axiom/src/main/assembly/bin.xml
@@ -0,0 +1,37 @@
+<assembly>
+  <id>bin</id>
+  <formats>
+    <format>tar.gz</format>
+  </formats>
+  <includeSiteDirectory>true</includeSiteDirectory>
+  <fileSets>
+    <fileSet>
+      <includes>
+		<include>LICENSE.txt</include>
+        <include>NOTICE.txt</include>
+        <include>legal/**/*</include>
+      </includes>
+    </fileSet>
+    <fileSet>
+      <directory>modules/axiom-api/target</directory>
+      <outputDirectory>/lib</outputDirectory>
+      <includes>
+        <include>*.jar</include>
+      </includes>
+    </fileSet>
+    <fileSet>
+      <directory>modules/axiom-impl/target</directory>
+      <outputDirectory>/lib</outputDirectory>
+      <includes>
+        <include>*.jar</include>
+      </includes>
+    </fileSet>
+    <fileSet>
+      <directory>modules/axiom-dom/target</directory>
+      <outputDirectory>/lib</outputDirectory>
+      <includes>
+        <include>*.jar</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</assembly>
diff --git a/axiom/src/main/assembly/src.xml b/axiom/src/main/assembly/src.xml
new file mode 100755
index 0000000..a6212a7
--- /dev/null
+++ b/axiom/src/main/assembly/src.xml
@@ -0,0 +1,41 @@
+<assembly>
+  <id>src</id>
+  <formats>
+    <format>tar.gz</format>
+  </formats>
+  <fileSets>
+    <fileSet>
+      <includes>
+		<include>*.txt</include>
+		<include>pom.xml</include>
+        <include>maven.xml</include>
+        <include>project.properties</include>
+        <include>project.xml</include>
+        <include>.project</include>
+        <include>.classpath</include>
+      </includes>
+    </fileSet>
+    <fileSet>
+      <directory>.settings</directory>
+    </fileSet>
+    <fileSet>
+      <directory>legal</directory>
+    </fileSet>
+    <fileSet>
+      <directory>modules</directory>
+      <excludes>
+        <exclude>axiom-api/target</exclude>
+        <exclude>axiom-api/target/**/*</exclude>
+        <exclude>axiom-impl/target</exclude>
+        <exclude>axiom-impl/target/**/*</exclude>
+        <exclude>axiom-dom/target</exclude>
+        <exclude>axiom-dom/target/**/*</exclude>
+        <exclude>axiom-tests/target</exclude>
+        <exclude>axiom-tests/target/**/*</exclude>
+      </excludes>
+    </fileSet>
+    <fileSet>
+      <directory>src</directory>
+    </fileSet>
+  </fileSets>
+</assembly>
diff --git a/axiom/src/site/apt/index.apt b/axiom/src/site/apt/index.apt
new file mode 100644
index 0000000..62c355d
--- /dev/null
+++ b/axiom/src/site/apt/index.apt
@@ -0,0 +1,60 @@
+           -----------------------------------
+           Apache Axiom - The XML Object Model
+           -----------------------------------
+
+Welcome to Apache Axiom
+
+  AXIOM stands for AXis Object Model (also known as OM - Object Model) and refers to the XML
+  infoset model that was initially developed for Apache Axis2. XML infoset refers to the
+  information included inside the XML and for programmatical manipulation it is convenient
+  to have a representation of this XML infoset in a language specific manner. For an object
+  oriented language the obvious choice is a model made up of objects. DOM and JDOM are two
+  such XML models. OM is conceptually similar to such an XML model by its external behavior
+  but deep down it is very much different.
+
+Latest Release
+
+  <<18th September 2006 - Apache Axiom Version 1.1.1 Released!>>
+
+  \[{{{http://ws.apache.org/commons/axiom/download.cgi}Download AXIOM 1.1.1}}\]
+
+  Apache AXIOM is a StAX-based, XML Infoset compliant object model which supports on-demand building
+  of the object tree. It supports a novel "pull-through" model which allows one to turn off the tree
+  building and directly access the underlying pull event stream. It also has built in support for XML
+  Optimized Packaging (XOP) and MTOM, the combination of which allows XML to carry binary data
+  efficiently and in a transparent manner. The combination of these is an easy to use API with a very
+  high performant architecture!
+
+  Developed as part of Apache Axis2, Apache AXIOM is the core of Apache Axis2. However, it is a pure
+  standalone XML Infoset model with novel features and can be used independently of Apache Axis2.
+
+Key Features
+
+    * Full XML Infoset compliant XML object model
+
+    * StAX based builders with on-demand building and pull-through
+
+    * XOP/MTOM support offering direct binary support
+
+    * Convenient SOAP Infoset API on top of AXIOM
+
+    * Two implementations included:
+
+        * Linked list based implementation
+
+        * W3C DOM supporting implementation
+
+    * High performant
+
+What's New in This Release
+
+    * Improved XML serialization
+
+    * DOM Hash implementation
+
+    * Improved MTOM handling
+
+    * Improved tree handling with multiple partial built elements
+
+    * Numerous bug fixes
+
diff --git a/axiom/src/site/resources/svn.html b/axiom/src/site/resources/svn.html
new file mode 100755
index 0000000..e0545b5
--- /dev/null
+++ b/axiom/src/site/resources/svn.html
@@ -0,0 +1,129 @@
+<html>
+<head>
+  <meta http-equiv="content-type" content="">
+  <title>Developing Apache Axiom</title>
+</head>
+
+<body lang="en">
+<h1>Developing Apache Axiom</h1>
+
+<p>This document will give you information on how to use SVN (Subversion) in
+order to get an SVN checkout/update and making commits to repository etc in
+the process of contributing to Apache projects (specifically Axiom).
+Instructions on configuring IDEs for development and using Maven1/Maven2 to
+build the project is also included here.</p>
+
+<h2>Content</h2>
+<ul>
+  <li><a href="#svn">Working with Subversion (SVN)</a></li>
+  <li><a href="#checkout">Checkout Apache Axiom from Subversion</a></li>
+  <li><a href="#maven">Installing Maven 1.x or 2.x</a></li>
+  <li><a href="#ide">Configuring your IDE</a></li>
+</ul>
+<a name="svn"></a>
+
+<h2>Working with Subversion (SVN)</h2>
+
+<p>The Axiom development team uses Subversion (SVN) for source control.
+Subversion is a compelling replacement for CVS (Concurrent Versioning
+System), developed under the auspices of the Tigris community and is licensed
+under an Apache compatible license. To learn more about Subversion or to
+download the latest distribution, visit the <a
+href="http:///subversion.tigris.org" target="_blank">Subversion project
+site</a>.  If you are looking for guidance on setting up and installing
+Subversion, please read the ASF <a
+href="http://www.apache.org/dev/version-control.html" target="_blank">Source
+Code Repositories page</a>.</p>
+<a name="checkout"></a>
+
+<h2>Checkout Axiom From Subversion</h2>
+
+<p>When checking out the latest version of Axiom from the Foundation's
+Subversion repository you must use one of the following URLs depending on
+your level of access to the Axiom source code:</p>
+<ul>
+  <li><b>If you are not a committer:</b> Use <a
+    href="http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/axiom"
+    target="_blank">http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/axiom</a></li>
+  <li><b>If you are a committer:</b> Use <a
+    href="https://svn.apache.org/repos/asf/webservices/commons/trunk/modules/axiom"
+    target="_blank">https://svn.apache.org/repos/asf/webservices/commons/trunk/modules/axiom</a></li>
+</ul>
+If you are a committer, make sure that you have selected an svnpasswd.  To do
+this you must log into svn.apache.org.  For more information, please read the
+ASF <a href="http://www.apache.org/dev/version-control.html"
+target="_blank">Source Code Repositories page</a>.
+
+<p>Once you have successfully installed Subversion, you can check out Axiom
+trunk by following these steps:</p>
+<ol type="1">
+  <li>Run <strong>svn co &lt;repository URL&gt; axiom</strong> where
+    repository URL is one of the URLs from the previous list.</li>
+  <li>This step will checkout the latest version of the Axiom codebase to a
+    directory named "axiom". The second parameter to the svn co selects a
+    directory to create on your local machine. If you want to checkout Axiom
+    to a different directory, feel free to change Axiom to any other
+    directory name.</li>
+  <li>To update your working copy to the latest version from the repository.
+    Execute the <strong>svn update</strong> command.</li>
+  <li>If you would like to submit a patch, you can execute <strong>svn
+    diff</strong> to create a unified diff for submission to the WS-Commons
+    JIRA issue tracker.</li>
+</ol>
+<a name="maven"></a>
+
+<h2>Installing Maven</h2>
+
+<p>Axiom's build currently supports Maven2 as well as Maven1. Maven is a
+build system that allows for the reuse of common build projects across
+multiple projects. For information about obtaining, installing, and
+configuring Maven, please see the <a href="http://maven.apache.org"
+target="_blank">Maven project page</a>.</p>
+
+<p>To use Maven1 to build the Axiom project, follow these simple steps:</p>
+<ol type="1">
+  <li>Install <a href="http://maven.apache.org/maven-1.x/"
+    target="_blank">Maven1</a>. See <a
+    href="http://maven.apache.org/maven-1.x/start/install.html"
+    target="_blank">here</a> for instructions.
+    <ul>
+      <li>Create a MAVEN_HOME environment variable.</li>
+      <li>Add MAVEN_HOME/bin to your PATH</li>
+    </ul>
+  </li>
+  <li>Go to the axiom folder in the command prompt and type
+    <strong>maven</strong>.</li>
+  <li>Maven will then automatically download all the jars, compile, test and
+    build the Axiom deliverables.</li>
+</ol>
+
+<p>To use Maven2 to build the Axiom project, follow these simple steps:</p>
+<ol type="1">
+  <li>Install <a href="http://maven.apache.org/" target="_blank">Maven2</a>.
+    See <a href="http://maven.apache.org/download.html#installation"
+    target="_blank">here</a> for instructions.</li>
+  <li>Go to the axiom folder in the command prompt and type <strong>mvn
+    install</strong>.</li>
+  <li>Maven2 will then automatically download all the jars, compile, test and
+    build the Axiom deliverables.</li>
+</ol>
+<a name="ide"></a>
+
+<h2>Configuring your IDE</h2>
+
+<p>The Axiom development team uses a variety of development tools from vi to
+emacs to eclipse to IntelliJ IDEA. The following section is not an
+endorsement of a specific set of tools, it is simply meant as a pointer to
+ease the process of getting started with Axiom development.</p>
+
+<p>With Maven 1:</p>
+<ul>
+  <li><strong>IntelliJ IDEA-</strong> type <strong>maven
+    idea:multiproject</strong>. This will generate the necessary IDEA .ipr,
+    .iml and .iws project files</li>
+  <li><strong>eclipse</strong>- The Maven eclipse plugin does not support
+    Maven multiprojects. You will need to execute <strong>maven
+    eclipse</strong> from each of the module directories.</li>
+</ul>
+</body>
+</html>
diff --git a/axiom/src/site/site.xml b/axiom/src/site/site.xml
new file mode 100644
index 0000000..eab0563
--- /dev/null
+++ b/axiom/src/site/site.xml
@@ -0,0 +1,34 @@
+<project name="Axiom">
+    <bannerLeft>
+        <name>Apache Axiom</name>
+        <src>http://ws.apache.org/images/project-logo.jpg</src>
+        <href>http://ws.apache.org/</href>
+    </bannerLeft>
+    <body>
+        <links>
+            <item name="Apache" href="http://www.apache.org/"/>
+            <item name="WebServices" href="http://ws.apache.org/"/>
+            <item name="Commons" href="http://ws.apache.org/commons/"/>
+            <item name="Axiom" href="http://ws.apache.org/commons/axiom/index.html"/>
+        </links>
+
+        <menu name="AXIOM">
+            <item name="About" href="index.html"/>
+            <item name="Downloads">
+                <item name="Releases" href="download.cgi"/>
+                <item name="Source Code" href="source-repository.html"/>
+            </item>
+            <item name="Documentation">
+                <item name="OM Tutorial" href="OMTutorial.html"/>
+                <item name="Javadocs" href="/apidocs/index.html"/>
+                <item name="View Source" href="http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/?root=Apache-SVN"/>
+            </item>
+            <item name="Project Information">
+                <item name="Mailing Lists" href="/mail-lists.html"/>
+                <item name="Project Team" href="/team-list.html"/>
+                <item name="Issue Tracking" href="issue-tracking.html"/>
+            </item>
+            <item name="License" href="/license.html"/>
+        </menu>
+    </body>
+</project>
diff --git a/axiom/src/site/xdoc/OMTutorial.xml b/axiom/src/site/xdoc/OMTutorial.xml
new file mode 100755
index 0000000..61b884e
--- /dev/null
+++ b/axiom/src/site/xdoc/OMTutorial.xml
@@ -0,0 +1,645 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<document>
+    <properties>
+        <title>OM Tutorial</title>
+    </properties>
+
+    <head>
+        <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
+        <meta content="text/html; charset=iso-8859-1"/>
+    </head>
+
+	<body lang="en">
+<!-- Header section 
+<table width="100%">
+<tr>
+<td align="left"><h1>Apache Axis2</h1></td>
+<td align="right"><img alt="" src="images/axis2.jpg"/></td>
+</tr>
+</table>
+end of header section -->
+
+
+<a name="intro"></a>
+<h2>Introduction</h2>
+<a name="what"></a>
+<h3>What is OM?</h3>
+
+<p>OM stands for Object Model (also known as AXIOM - AXis Object Model) and
+refers to the XML infoset model that is initially developed for Apache Axis2.
+XML infoset refers to the information included inside the XML, and for
+programmatic manipulation it is convenient to have a representation of this
+XML infoset in a language specific manner. For an object oriented language
+the obvious choice is a model made up of objects. <a
+href="http://www.w3.org/DOM/">DOM</a> and <a
+href="http://www.jdom.org/">JDOM</a> are two such XML models. OM is
+conceptually similar to such an XML model by its external behavior but deep
+down it is very much different. The objective of this tutorial is to
+introduce the basics of OM and explain the best practices to be followed
+while using OM. However, before diving in to the deep end of OM it is better
+to skim the surface and see what it is all about!</p>
+<a name="whom"></a>
+<h3>For whom is this Tutorial?</h3>
+
+<p>This tutorial can be used by anyone who is interested in OM and needs to
+gain a deeper knowledge about the model. However, it is assumed that the
+reader has a basic understanding of the concepts of XML (such as <a
+href="http://www.w3.org/TR/REC-xml-names/">Namespaces</a>) and a working
+knowledge of tools such as <a href="http://ant.apache.org/">Ant</a>.
+Knowledge in similar object models such as DOM will be quite helpful in
+understanding OM, mainly to highlight the differences and similarities
+between the two, but such knowledge is not assumed. Several links are listed
+in the <a href="#links">Appendix</a> that will help understand the basics of
+XML.</p>
+<a name="pullparsing"></a>
+<h3>What is Pull Parsing?</h3>
+Pull parsing is a recent trend in XML processing. The previously popular XML
+processing frameworks such as <a
+href="http://en.wikipedia.org/wiki/Simple_API_for_XML">SAX</a> and <a
+href="http://en.wikipedia.org/wiki/Document_Object_Model">DOM</a> were
+"push-based" which means the control of the parsing was in the hands of the
+parser itself. This approach is fine and easy to use, but it was not
+efficient in handling large XML documents since a complete memory model will
+be generated in the memory. Pull parsing inverts the control and hence the
+parser only proceeds at the users command. The user can decide to store or
+discard events generated from the parser. OM is based on pull parsing. To
+learn more about XML pull parsing see the <a
+href="http://www.bearcave.com/software/java/xml/xmlpull.html">XML pull
+parsing introduction</a>.
+<a name="history"></a>
+<h3>A Bit of History</h3>
+
+<p>The original OM was proposed as a store for the pull parser events for
+later processing, at the Axis summit held in Colombo, Sri Lanka, in September
+2004. However, this approach was soon improved and OM was pursued as a
+complete <a href="http://dret.net/glossary/xmlinfoset">XML infoset</a> model
+due to its flexibility. Several implementation techniques were attempted
+during the initial phases. The two most promising techniques were the table
+based technique and the link list based technique. During the intermediate
+performance tests the link list based technique proved to be much more memory
+efficient for smaller and mid sized XML documents. The advantage of the table
+based OM was only visible for the large and very large XML documents, and
+hence, the link list based technique was chosen as the most suitable. Initial
+efforts were focused on implementing the XML infoset (XML Information Set)
+items which are relevant to the SOAP specification (DTD support, Processing
+Instruction support, etc were not considered). The advantage of having a
+tight integration was evident at this stage and this resulted in having SOAP
+specific interfaces as part of OM rather than a layer on top of it. OM was
+deliberately made <a
+href="http://en.wikipedia.org/wiki/Application_programming_interface">API</a>
+centric. It allows the implementations to take place independently and
+swapped without affecting the program later.</p>
+<a name="features"></a>
+<h3>Features of OM</h3>
+
+<p>OM is a lightweight, deferred built XML infoset representation based on
+StAX (<a href="http://www.jcp.org/en/jsr/detail?id=173">JSR 173</a>), which
+is the standard streaming pull parser API. The object model can be
+manipulated as flexibly as any other object model (Such as <a
+href="http://www.jdom.org/">JDOM</a>), but underneath, the objects will be
+created only when they are absolutely required. This leads to much less
+memory intensive programming. Following is a short feature overview of OM.</p>
+<ul>
+  <li><strong>Lightweight</strong>: OM is specifically targeted to be
+    lightweight. This is achieved by reducing the depth of the hierarchy,
+    number of methods and the attributes enclosed in the objects. This makes
+    the objects less memory intensive.</li>
+  <li><strong>Deferred building</strong>: By far this is the most important
+    feature of OM. The objects are not made unless a need arises for them.
+    This passes the control of building over to the object model itself
+    rather than an external builder.</li>
+  <li><strong>Pull based</strong>: For a deferred building mechanism a pull
+    based parser is required. OM is based on <a
+    href="http://today.java.net/pub/a/today/2006/07/20/introduction-to-stax.html">StAX</a>,
+    the standard pull parser API.</li>
+</ul>
+<!-- Special section -->
+
+<p class="special"></p>
+
+<table width="100%">
+  <tbody>
+    <tr>
+      <td><img src="images/OM005.gif" alt="Remember this" width="35" height="57"/></td>
+      <td class="special-td">OM is tightly bound to StAX API. To work with OM
+        a StAX compliant parser and the API <i>must</i> be present in the
+        classpath.</td>
+      <td></td>
+    </tr>
+  </tbody>
+</table>
+<!-- End of special section -->
+
+<p>The Following image shows how OM API is viewed by the user</p>
+<!-- Image -->
+<br/>
+<p align="center" class="img"><img alt="" src="images/archi006.jpg"
+class="img" width="490" height="282"/></p>
+<br/>
+
+<p align="center" class="img-title">Figure 1</p><br/>
+<!--  End of Image -->
+
+<p>OM Builder wraps the raw xml character stream through the StAX reader API.
+Hence, the complexities of the pull event stream is transparent to the
+user.</p>
+<a name="caching"></a>
+<h3>A Bit About Caching</h3>
+
+<p>Since OM is a deferred built object model, It incorporates the concept of
+caching. Caching refers to the creation of the objects while parsing the pull
+stream. The reason why this is so important is because caching can be turned
+off in certain situations. If so the  parser proceeds without building the
+object structure. User can extract the raw pull stream from OM and use that
+instead of the OM. In this case it is sometimes beneficial to switch off
+caching. The <a href="#advanced">Advanced Operations</a> section explains
+more on accessing the raw pull stream and switching on and off the
+caching.</p>
+<a name="soap"></a>
+<h3>Where Does SOAP Come into Play?</h3>
+
+<p>In a nutshell <a
+href="http://www.w3schools.com/SOAP/soap_intro.asp">SOAP</a> is an
+information exchange protocol based on XML. SOAP has a defined set of XML
+elements that should be used in messages. Since Axis2 is a "SOAP Engine" and
+OM is built for Axis2, a set of SOAP specific objects were also defined along
+with OM. These SOAP Objects are extensions of the general OM objects. <!--<p>This abstraction provides</p>
+<ul>
+<li>deferred building support</li>
+<li>Caching</li>
+</ul>
+<p>AXIOM has the flexibility to plug in any builder which implements the given builders interface.  The upcoming sections of this tutorial deal with the creation and usage of OM for manipulating SOAP (and to some extent nonSOAP) based XML documents.</p>
+-->
+</p>
+<a name="working"></a>
+<h2>Working with OM</h2>
+<a name="binary"></a>
+<h3>Obtaining the OM Binary</h3>
+
+<p>There are two methods through which the OM-binary can be obtained:</p>
+<ol>
+  <li>The easiest way to obtain the OM binary is to <a
+    href="http://ws.apache.org/commons/axiom/download.cgi">download</a> the
+    latest release. After the source download, OM-binary can be built. For
+    both MS Windows and Linux, move it to the project directory and execute
+    the command "maven jar". All other necessary jars will be automatically
+    downloaded. When the build is completed successfully, the
+    axiom-api-&lt;version&gt;.jar and axiom-impl-&lt;version&gt;.jar can be
+    found in the newly created "targets" directory.</li>
+  <li>However, more adventurous users can build the OM from source, which is
+    described in the next section. Detailed information on getting source
+    from SVN repository is found <a href="svn.html"
+  target="_blank">here</a>.</li>
+</ol>
+
+<p>Once the OM-binary is obtained by any of the above ways , it should be
+included in the classpath for any of the OM based programs to work.
+Subsequent sections of this tutorial assume that this build step is complete
+and <font color="red"><span
+style="color: #000000">axiom-api-&lt;version&gt;.jar </span> <span
+style="color: #000000">and</span> <span
+style="color: #000000">axiom-impl-&lt;version&gt;.jar</span></font> are
+present in the classpath along with the StAX API jar file and a StAX
+implementation.</p>
+<a name="creation"></a>
+
+<h3>Creation</h3>
+
+<p>Creation is the first and foremost action when using an Object
+representation. This part explains how OM can be built from an existing
+document or simply programmatically. OM provides a notion of a factory and a
+builder to create objects. The factory helps to keep the code at the
+interface level and the implementations separately as shown in <a
+href="#fig2">Figure 2</a>. Since OM is tightly bound to StAX, a StAX
+compliant reader should be created first with the desired input stream. Then
+one can select one of the different builders available.</p>
+
+<p>StAXOMBuilder will build pure XML infoset compliant object model whilst
+the SOAPModelBuilder returns SOAP specific objects (such as the SOAPEnvelope,
+which are sub classes of the OMElement) through its builder methods. The
+following piece of code shows the correct method of creating an OM document
+from an input stream.</p>
+
+<div align="left">
+<a name="list1"></a>
+
+<p><b>Code Listing 1</b></p>
+</div>
+<source><pre>//create the parser<br/>
+XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new FileInputStream(file));
+<br/>//create the builder<br/>
+StAXOMBuilder builder = new StAXOMBuilder(parser);
+//get the root element (in this case the envelope)<br/>
+OMElement documentElement =  builder.getDocumentElement();</pre>
+</source>
+<p>As the example shows, creating an OM from an input stream is pretty
+straightforward. However, elements and nodes can be created programmatically
+to modify the structure as well. The recommended way to create OM objects
+programmatically is to use the factory. OMAbstractFactory.getOMFactory() will
+return the proper factory and the creator methods for each type that should
+be called. Currently OM has two builders, namely the OM builder
+(StAXOMBuilder) and the SOAP model builder (StAXSOAPModelBuilder). These
+builders provide the necessary information to the XML infoset model to build
+itself.</p>
+<!-- Image -->
+<a name="fig2"></a>
+<br/>
+<p align="center" class="img"><img src="images/archi007.jpg"
+alt="OM Structure 2" class="img" width="420" height="246"/></p>
+<br/>
+<p align="center" class="img-title">Figure 2</p>
+<!--  End of Image -->
+<br/>
+<p>A simple example is shown below:</p>
+
+<div align="left">
+<p><b>Code Listing 2</b></p>
+</div>
+<source><pre class="code">//create a factory
+OMFactory factory = OMAbstractFactory.getOMFactory();
+//use the factory to create two namespace objects
+OMNamespace ns1 = factory.createOMNamespace("bar","x");
+OMNamespace ns2 = factory.createOMNamespace("bar1","y");
+//use the factory to create three elements
+OMElement root = factory.createOMElement("root",ns1);
+OMElement elt11 = factory.createOMElement("foo1",ns1);
+OMElement elt12 = factory.createOMElement("foo2",ns1);</pre></source>
+
+<p>The reason as to have a set of factory.createXXX methods is to cater for
+different implementations, but keep the programmers code intact. Its highly
+recommended to use the factory for creating OM objects as this will ease the
+switching of different OM implementations. Several differences exist between
+a programmatically created OMNode and a conventionally built OMNode. The most
+important difference is that the former will have no builder object enclosed,
+where as the latter always carries a reference to its builder.</p>
+
+<p>As stated earlier in this tutorial, since the object model is built as and
+when required, each and every OMNode should have a reference to its builder.
+If this information is not available, it is due to the object being created
+without a builder. This difference becomes evident when the user tries to get
+a non caching pull parser from the OMElement. This will be discussed in more
+detail in the <a href="#advanced">Advanced Operations</a> section.</p>
+
+<p>In order to understand the requirement of the builder reference in each
+and every OMNode, consider the following scenario. Assume that the parent
+element is built but the children elements are not. If the parent is asked to
+iterate through its children, this information is not readily available to
+the parent element and it should build its children first before attempting
+to iterate them. In order to provide a reference of the builder, each and
+every node of an OM structure should carry the reference to its builder. Each
+and every OMNode carries a flag that states its build status. Apart from this
+restriction there are no other constraints that keep the programmer away from
+mixing up programmatically made OMNode objects with OMNode objects built from
+builders.</p>
+
+<p>The SOAP object hierarchy is made in the most natural way for a
+programmer. An inspection of the API will show that it is quite close to the
+SAAJ API but with no bindings to DOM or any other model. The SOAP classes
+extend basic OM classes (such as the OMElement) hence, one can access a SOAP
+document either with the abstraction of SOAP or drill down to the underlying
+XML Object model with a simple casting.</p>
+<!--  The following illustration of the actual class diagram will be helpful in understanding this.
+Need an image here -->
+<a name="nodes"></a>
+<h3>Addition of Nodes</h3>
+
+<p>Addition and removal methods are primarily defined in the OMElement
+interface. The following are the most important in adding nodes.</p>
+
+<div align="left">
+<p><b>Code Listing 3</b></p>
+</div>
+<source><pre class="code">public void addChild(OMNode omNode);
+public void addAttribute(OMAttribute attr);</pre></source>
+
+<p>This code segment shows how the addition takes place. Note that it is
+related to the code listings 1 &amp; 2 in the <a
+href="#creation">Creation</a> section.</p>
+
+<div align="left">
+<p><b>Code Listing 4</b></p>
+</div>
+<source><pre class="code">//set the children
+elt11.addChild(elt21);
+elt12.addChild(elt22);
+root.addChild(elt11);
+root.addChild(elt12);</pre></source>
+<ul>
+  <li>AddChild method will always add the child as the last child of the
+    parent.</li>
+  <li><p>A given node can be removed from the tree by calling the detach()
+    method. A node can also be removed from the tree by calling the remove
+    method of the returned iterator which will also call the detach method of
+    the particular node internally.</p>
+  </li>
+  <li>Namespaces are a tricky part of any XML object model and is the same in
+    OM. However, the interface to the namespace have been made very simple.
+    OMNamespace is the class that represents a namespace with intentionally
+    removed setter methods. This makes the OMNamespace immutable and allows
+    the underlying implementation to share the objects without any
+  difficulty.</li>
+</ul>
+
+<p>Following are the important methods available in OMElement to handle
+namespaces.</p>
+
+<div align="left">
+<p><b>Code Listing 5</b></p>
+</div>
+<source><pre class="code">public OMNamespace declareNamespace(String uri, String prefix);
+public OMNamespace declareNamespace(OMNamespace namespace);
+public OMNamespace findNamespace(String uri, String prefix) throws OMException;</pre></source>
+
+<p>The declareNamespaceXX methods are fairly straightforward. Add a namespace
+to namespace declarations section. Note that a namespace declaration that has
+already being added will not be added twice. findNamespace is a very handy
+method to locate a namespace object higher up the object tree. It searches
+for a matching namespace in its own declarations section and jumps to the
+parent if it's not found. The search progresses up the tree until a matching
+namespace is found or the root has been reached.</p>
+
+<p>During the serialization a directly created namespace from the factory
+will only be added to the declarations when that prefix is encountered by the
+serializer. More of the serialization matters will be discussed in the <a
+href="#serializer">Serializer</a> section.</p>
+
+<p>The following simple code segment shows how the namespaces are dealt in
+OM</p>
+
+<div align="left">
+<a name="list6"></a>
+
+<p><b>Code Listing 6</b></p>
+</div>
+<source><pre class="code">OMFactory factory = OMAbstractFactory.getOMFactory();
+OMNamespace ns1 = factory.createOMNamespace("bar","x");
+OMElement root = factory.createOMElement("root",ns1);
+OMNamespace ns2 = root.declareNamespace("bar1","y");
+OMElement elt1 = factory.createOMElement("foo",ns1);
+OMElement elt2 = factory.createOMElement("yuck",ns2);
+OMText txt1 = factory.createOMText(elt2,"blah");
+elt2.addChild(txt1);
+elt1.addChild(elt2);
+root.addChild(elt1);</pre></source>
+
+<p>Serialization of the root element produces the following XML:</p>
+<pre class="xml">&lt;x:root xmlns:x="bar" xmlns:y="bar1"&gt;&lt;x:foo&gt;&lt;y:yuck&gt;blah&lt;/y:yuck&gt;&lt;/x:foo&gt;&lt;/x:root&gt;</pre>
+<a name="traversing"></a>
+<h3>Traversing</h3>
+
+<p>Traversing the object structure can be done in the usual way by using the
+list of children. Note however, that the child nodes are returned as an
+iterator. The Iterator supports the 'OM way' of accessing elements and is
+more convenient than a list for sequential access. The following code sample
+shows how the children can be accessed. The children are of the type OMNode
+that can either be OMText or OMElement.</p>
+
+<div align="left">
+<p><b>Code Listing 7</b></p>
+</div>
+<source><pre class="code">Iterator children = root.getChildren();
+while(children.hasNext()){
+        OMNode node = (OMNode)children.next();
+}</pre></source>
+
+<p>Apart from this, every OMNode has links to its siblings. If more thorough
+navigation is needed the nextSibling() and PreviousSibling() methods can be
+used. A more selective set can be chosen by using the
+getChildrenWithName(QName) methods. The getChildWithName(Qname) method
+returns the first child that matches the given QName and
+getChildrenWithName(QName) returns a collection containing all the matching
+children. The advantage of these iterators is that they won't build the whole
+object structure at once, until its required.</p>
+<!-- Special section -->
+
+<p class="special"></p>
+
+<table width="100%">
+  <tbody>
+    <tr>
+      <td><img src="images/OM005.gif" alt="Remember this" width="35"
+        height="57"/></td>
+      <td class="special-td">All iterator implementations internally stay one
+        step ahead of their apparent location to provide the correct value
+        for the hasNext() method. This hidden advancement can build elements
+        that are not intended to be built at all. Hence these iterators are
+        recommended only when caching is not a concern.</td>
+      <td></td>
+    </tr>
+  </tbody>
+</table>
+<!-- End of special section -->
+<a name="serializer"></a>
+
+<h3>Serializer</h3>
+
+<p>OM can be serialized either as the pure object model or the pull event
+stream. The serialization uses a XMLStreamWriter object to write out the
+output and hence, the same serialization mechanism can be used to write
+different types of outputs (such as text, binary, etc.).</p>
+
+<p>A caching flag is provided by OM to control the building of the in-memory
+OM. The OMNode has two methods, serializeAndConsume and serialize. When
+serializeAndConsume is called the cache flag is reset and the serializer does
+not cache the stream. Hence, the object model will not be built if the cache
+flag is not set.</p>
+
+<p>The serializer serializes namespaces in the following way:</p>
+<ol>
+  <li>When a namespace that is in the scope but not yet declared is
+    encountered, it will then be declared.</li>
+  <li>When a namespace that is in scope and already declared is encountered,
+    the existing declarations prefix is used.</li>
+  <li>When the namespaces are declared explicitly using the elements
+    declareNamespace() method, they will be serialized even if those
+    namespaces are not used in that scope.</li>
+</ol>
+
+<p>Because of this behavior, if a fragment of the XML is serialized, it will
+also be <i>namespace qualified</i> with the necessary namespace
+declarations.</p>
+
+<p>Here is an example that shows how to write the output to the console, with
+reference to the earlier code sample- <a href="#list1">Code Listing 1</a>
+that created a SOAP envelope.</p>
+
+<div align="left">
+<p><b>Code Listing 8</b></p>
+</div>
+<source><pre class="code">XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
+//dump the output to console with caching
+envelope.serialize(writer); 
+writer.flush();</pre></source>
+
+<p>or simply</p>
+<pre class="code">System.out.println(root.toStringWithConsume()); </pre>
+
+<p>The above mentioned features of the serializer forces a correct
+serialization even if only a part of the OM tree is serialized. The following
+serializations show how the serialization mechanism takes the trouble to
+accurately figure out the namespaces. The example is from <a
+href="#list6">Code Listing 6</a> which creates a small OM programmatically.
+Serialization of the root element produces the following:</p>
+<pre class="xml">&lt;x:root xmlns:x="bar" xmlns:y="bar1"&gt;&lt;x:foo&gt;&lt;y:yuck&gt;blah&lt;/y:yuck&gt;&lt;/x:foo&gt;&lt;/x:root&gt;</pre>
+
+<p>However, serialization of only the foo element produces the following:</p>
+<pre class="xml">&lt;x:foo xmlns:x="bar"&gt;&lt;y:yuck xmlns:y="bar1"&gt;blah&lt;/y:yuck&gt;&lt;/x:foo&gt;</pre>
+
+<p>Note how the serializer puts the relevant namespace declarations in
+place.</p>
+<a name="code"></a>
+<h3>Complete Code for the OM based Document Building and Serialization</h3>
+
+<p>The following code segment shows how to use the OM for completely building
+a document and then serializing it into text pushing the output to the
+console. Only the important sections are shown here. The complete program
+listing can be found in the <a href="#appendix">Appendix</a>.</p>
+
+<div align="left">
+<p><b>Code Listing 9</b></p>
+</div>
+<source><pre class="code">//create the parser
+XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new FileInputStream(file));
+//create the builder
+StAXOMBuilder builder = new StAXOMBuilder(parser);
+
+//get the root element (in this case the envelope)
+OMElement documentElement = builder.getDocumentElement();
+
+//dump the out put to console with caching
+System.out.println(documentElement.toStringWithConsume()); </pre></source>
+<a name="advanced"></a>
+
+<h2>Advanced Operations with OM</h2>
+<a name="omnavigator"></a>
+<h3>Use of the OMNavigator for Traversal</h3>
+
+<p>OM provides a utility class to navigate the OM structure. The navigator
+provides an in-order traversal of the OM tree up to the last-built node. The
+Navigator has two states called the navigable state and the completion state.
+Since the navigator provides the navigation starting from an OMElement, it is
+deemed to have completed the navigation when the starting node is reached
+again. This state is known as the completion state. Once the navigator has
+reached the complete status its navigation is done and it cannot proceed.</p>
+
+<p>It is possible that the OM tree does not get built completely when it is
+navigated. The navigable status shows whether the tree structure is
+navigable. When the navigator is complete it is not navigable anymore.
+However, it is possible for a navigator to become non-navigable without being
+complete. The following code sample shows how the navigator should be used
+and handled using its states.</p>
+
+<div align="left">
+<p><b>Code Listing 10</b></p>
+</div>
+<source><pre class="code">//Create a navigator
+OMNavigator navigator = new OMNavigator(envelope);
+OMNode node = null;
+while (navigator.isNavigable()) {
+     node = navigator.next();
+}</pre></source>
+<a name="accesspull"></a>
+<h3>Accessing the Pull Parser</h3>
+
+<p>OM is tightly integrated with StAX and the
+getXMLStreamReader()/getXMLStreamReaderWithoutCaching() methods in the
+OMElement provides a XMLStreamReader object. This XMLStreamReader instance
+has a special capability of switching between the underlying stream and the
+OM object tree if the cache setting is off. However, this functionality is
+completely transparent to the user. This is further explained in the
+following paragraphs.</p>
+
+<p>OM has the concept of caching, and OM is the actual cache of the events
+fired. However, the requester can choose to get the pull events from the
+underlying stream rather than the OM tree. This can be achieved by getting
+the pull parser with the cache off. If the pull parser was obtained without
+switching off cache, the new events fired will be cached and the tree
+updated. This returned pull parser will switch between the object structure
+and the stream underneath, and the users need not worry about the differences
+caused by the switching. The exact pull stream the original document would
+have provided would be produced even if the OM tree was fully or partially
+built. The getXMLStreamReaderWithoutCaching() method is very useful when the
+events need to be handled in a pull based manner without any intermediate
+models. This makes such operations faster and efficient.</p>
+<!-- Special section -->
+
+<p class="special"></p>
+
+<table width="100%">
+  <tbody>
+    <tr>
+      <td><img src="images/OM005.gif" alt="Remember this" width="35"
+        height="57"/></td>
+      <td class="special-td">For consistency reasons once the cache is
+        switched off it cannot be switched on again.</td>
+      <td></td>
+    </tr>
+  </tbody>
+</table>
+<!-- End of special section -->
+
+<a name="summary"></a>
+<h2>Summary</h2>
+
+<p>This is meant to be a small yet comprehensive introduction to AXIOM. AXIOM
+however, is a lot more than what is described in this tutorial. Readers are
+welcome to explore AXIOM, especially it's capabilities to handle binary
+content.</p>
+<a name="appendix"></a>
+<h2>Appendix</h2>
+<a name="1"></a>
+<h3>Program Listing for Complete OM - Build and Serialize</h3>
+<source><pre class="code">import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+
+public class TestOMBuilder {
+
+    /**
+     * Pass the file name as an argument
+     * @param args
+     */
+    public static void main(String[] args) {
+        try {
+            //create the parser
+            XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new FileInputStream(args[0]));
+            StAXOMBuilder builder = new StAXOMBuilder(parser);
+            //get the root element
+            OMElement documentElement = builder.getDocumentElement();
+
+            //dump the out put to console with caching
+            System.out.println(documentElement.toStringWithConsume()); 
+
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        }
+    }
+
+
+}</pre></source>
+<a name="links"></a>
+
+<h3>Links</h3>
+For basics in XML
+<ul>
+  <li><a
+    href="http://www-128.ibm.com/developerworks/xml/newto/index.html">Developerworks
+    Introduction to XML</a></li>
+  <li><a
+    href="http://www.bearcave.com/software/java/xml/xmlpull.html">Introduction
+    to Pull parsing</a></li>
+    <li><a
+    href="http://today.java.net/pub/a/today/2006/07/20/introduction-to-stax.html">Introduction
+    to StAX</a></li>
+</ul>
+</body>
+</document>
+	
\ No newline at end of file
diff --git a/axiom/src/site/xdoc/download.cgi b/axiom/src/site/xdoc/download.cgi
new file mode 100644
index 0000000..8bdb438
--- /dev/null
+++ b/axiom/src/site/xdoc/download.cgi
@@ -0,0 +1,6 @@
+#!/bin/sh
+# Wrapper script around mirrors.cgi script
+# (we must change to that directory in order for python to pick up the
+#  python includes correctly)
+cd /www/www.apache.org/dyn/mirrors
+/www/www.apache.org/dyn/mirrors/mirrors.cgi $*
\ No newline at end of file
diff --git a/axiom/src/site/xdoc/download.xml b/axiom/src/site/xdoc/download.xml
new file mode 100644
index 0000000..45fca73
--- /dev/null
+++ b/axiom/src/site/xdoc/download.xml
@@ -0,0 +1,250 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<document>
+    <properties>
+        <title>:: Apache AXIOM Releases ::</title>
+    </properties>
+
+    <head>
+        <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
+        <meta content="text/html; charset=iso-8859-1"/>
+    </head>
+
+    <body>
+
+        <section>
+            <h2>Releases</h2>
+            <div align="left">
+                <p>AXIOM is becoming more and more stable and the latest official version available for download is
+                    AXIOM 1.1. All the releases are available for download as source or binary. For more information,
+                    please see
+                    <a href="http://www.apache.org/dev/release.html">Apache Release FAQ</a>
+                </p>
+                <p>Please select the AXIOM version you want to download.</p>
+            </div>
+            <div align="center">
+
+                <table class="bodyTable">
+                    <tbody>
+                        <tr class="a">
+                            <td align="center" width="45">Name</td>
+                            <td align="center" width="80">Type</td>
+                            <td align="center" width="300">Distribution</td>
+                            <td align="center" width="100">Date</td>
+                            <td align="center" width="200">Description</td>
+                        </tr>
+
+                        <tr class="b">
+                            <td align="center" valign="middle">
+                                <a name="09"></a>
+                                1.1.1
+                            </td>
+                            <td align="center">Release</td>
+                            <td>Source Distribution
+                                <a href="[preferred]/ws/commons/axiom/1_1_1/axiom-1.1.1-src.zip"
+                                   title="[preferred]/ws/commons/axiom/1_1_1/axiom-1.1.1-src.zip">zip</a>
+
+                                <a href="http://www.apache.org/dist/ws/commons/axiom/1_1_1/axiom-1.1.1-src.zip.md5"
+                                   class="externalLink"
+                                   title="http://www.apache.org/dist/ws/commons/axiom/1_1_1/axiom-1.1.1-src.zip.md5">MD5</a>
+                                <a href="http://www.apache.org/dist/ws/commons/axiom/1_1_1/axiom-1.1.1-src.zip.asc"
+                                   class="externalLink"
+                                   title="http://www.apache.org/dist/ws/commons/axiom/1_1_1/axiom-1.1.1-src.zip.asc">PGP</a>
+                                <br/>
+                                Binary Distribution
+                                <a href="[preferred]/ws/commons/axiom/1_1_1/axiom-1.1.1-bin.zip"
+                                   title="[preferred]/ws/commons/axiom/1_1_1/axiom-1.1.1-bin.zip">zip</a>
+                                <a href="http://www.apache.org/dist/ws/commons/axiom/1_1_1/axiom-1.1.1-bin.zip.md5"
+                                   class="externalLink"
+                                   title="http://www.apache.org/dist/ws/commons/axiom/1_1_1/axiom-1.1.1-bin.zip.md5">MD5</a>
+                                <a href="http://www.apache.org/dist/ws/commons/axiom/1_1_1/axiom-1.1.1-bin.zip.asc"
+                                   class="externalLink"
+                                   title="http://www.apache.org/dist/ws/ws/commons/axiom/1_1_1/axiom-1.1.1-bin.zip.asc">
+                                    PGP</a>
+
+                                <br/>
+                            </td>
+                            <td>18 - 09 - 2006</td>
+                            <td>1.1.1 Release (Mirrored)</td>
+                        </tr>
+
+                        <tr class="b">
+                            <td align="center" valign="middle">
+                                <a name="09"></a>
+                                1.1
+                            </td>
+                            <td align="center">Release</td>
+                            <td>Source Distribution
+                                <a href="[preferred]/ws/commons/axiom/1_1/axiom-1.1-src.zip"
+                                   title="[preferred]/ws/commons/axiom/1_1/axiom-1.1-src.zip">zip</a>
+
+                                <a href="http://www.apache.org/dist/ws/commons/axiom/1_1/axiom-1.1-src.zip.md5"
+                                   class="externalLink"
+                                   title="http://www.apache.org/dist/ws/commons/axiom/1_1/axiom-1.1-src.zip.md5">MD5</a>
+                                <a href="http://www.apache.org/dist/ws/commons/axiom/1_1/axiom-1.1-src.zip.asc"
+                                   class="externalLink"
+                                   title="http://www.apache.org/dist/ws/commons/axiom/1_1/axiom-1.1-src.zip.asc">PGP</a>
+                                <br/>
+                                Binary Distribution
+                                <a href="[preferred]/ws/commons/axiom/1_1/axiom-1.1-bin.zip"
+                                   title="[preferred]/ws/commons/axiom/1_1/axiom-1.1-bin.zip">zip</a>
+                                <a href="http://www.apache.org/dist/ws/commons/axiom/1_1/axiom-1.1-bin.zip.md5"
+                                   class="externalLink"
+                                   title="http://www.apache.org/dist/ws/commons/axiom/1_1/axiom-1.1-bin.zip.md5">MD5</a>
+                                <a href="http://www.apache.org/dist/ws/commons/axiom/1_1/axiom-1.1-bin.zip.asc"
+                                   class="externalLink"
+                                   title="http://www.apache.org/dist/ws/ws/commons/axiom/1_1/axiom-1.1-bin.zip.asc">
+                                    PGP</a>
+
+                                <br/>
+                            </td>
+                            <td>15 - 09 - 2006</td>
+                            <td>1.1 Release (Archived)
+                                <br/>
+                                Note : This released was compiled using JDK 1.5 and will not work with JDK 1.4. Please
+                                move to AXIOM 1.1.1.
+                            </td>
+                        </tr>
+
+
+                        <tr class="b">
+                            <td align="center" valign="middle">
+                                <a name="09"></a>
+                                1.0
+                            </td>
+                            <td align="center">Release</td>
+                            <td>Source Distribution
+                                <a href="http://archive.apache.org/dist/ws/commons/axiom/1_0/axiom-1.0-src.zip"
+                                   title="http://archive.apache.org/dist/ws/commons/axiom/1_0/axiom-1.0-src.zip">zip</a>
+
+                                <a href="http://archive.apache.org/dist/ws/commons/axiom/1_0/axiom-1.0-src.zip.md5"
+                                   class="externalLink"
+                                   title="http://archive.apache.org/dist/ws/commons/axiom/1_0/axiom-1.0-src.zip.md5">
+                                    MD5</a>
+                                <a href="http://www.apache.org/dist/ws/commons/axiom/1_0/axiom-1.0-src.zip.asc"
+                                   class="externalLink"
+                                   title="http://archive.apache.org/dist/ws/commons/axiom/1_0/axiom-1.0-src.zip.asc">
+                                    PGP</a>
+                                <br/>
+                                Binary Distribution
+                                <a href="http://archive.apache.org/dist/ws/commons/axiom/1_0/axiom-1.0-bin.zip"
+                                   title="http://archive.apache.org/dist/ws/commons/axiom/1_0/axiom-0.95-bin.zip">
+                                    zip</a>
+                                <a href="http://archive.apache.org/dist/ws/commons/axiom/1_0/axiom-1.0-bin.zip.md5"
+                                   class="externalLink"
+                                   title="http://archive.apache.org/dist/ws/commons/axiom/1_0/axiom-1.0-bin.zip.md5">
+                                    MD5</a>
+                                <a href="http://archive.apache.org/dist/ws/commons/axiom/1_0/axiom-1.0-bin.zip.asc"
+                                   class="externalLink"
+                                   title="http://archive.apache.org/dist/ws/ws/commons/axiom/1_0/axiom-1.0-bin.zip.asc">
+                                    PGP</a>
+
+                                <br/>
+                            </td>
+                            <td>02 - 05 - 2006</td>
+                            <td>1.0 Release (Archived)</td>
+                        </tr>
+
+
+                        <tr class="b">
+                            <td align="center" valign="middle">
+                                <a name="09"></a>
+                                0.95
+                            </td>
+                            <td align="center">Release</td>
+                            <td>Source Distribution
+                                <a href="http://archive.apache.org/dist/ws/commons/axiom/0_95/axiom-0.95-src.zip"
+                                   title="http://archive.apache.org/dist/ws/commons/axiom/0_95/axiom-0.95-src.zip">
+                                    zip</a>
+
+                                <a href="http://archive.apache.org/dist/ws/commons/axiom/0_95/axiom-0.95-src.zip.md5"
+                                   class="externalLink"
+                                   title="http://archive.apache.org/dist/ws/commons/axiom/0_95/axiom-0.95-src.zip.md5">
+                                    MD5</a>
+                                <a href="http://archive.apache.org/dist/ws/commons/axiom/0_95/axiom-0.95-src.zip.asc"
+                                   class="externalLink"
+                                   title="http://archive.apache.org/dist/ws/commons/axiom/0_95/axiom-0.95-src.zip.asc">
+                                    PGP</a>
+                                <br/>
+                                Binary Distribution
+                                <a href="[preferred]/ws/commons/axiom/0_95/axiom-0.95-bin.zip"
+                                   title="[preferred]/ws/commons/axiom/0_95/axiom-0.95-bin.zip">zip</a>
+                                <a href="http://archive.apache.org/dist/ws/commons/axiom/0_95/axiom-0.95-bin.zip.md5"
+                                   class="externalLink"
+                                   title="http://archive.apache.org/dist/ws/commons/axiom/0_95/axiom-0.95-bin.zip.md5">
+                                    MD5</a>
+                                <a href="http://archive.apache.org/dist/ws/commons/axiom/0_95/axiom-0.95-bin.zip.asc"
+                                   class="externalLink"
+                                   title="http://archive.apache.org/dist/ws/ws/commons/axiom/0_95/axiom-0.95-bin.zip.asc">
+                                    PGP</a>
+
+                                <br/>
+                            </td>
+                            <td>23 - 03 - 2006</td>
+                            <td>0.95 Release (Archived)</td>
+                        </tr>
+
+                    </tbody>
+                </table>
+            </div>
+            <div align="left">
+                <p>[if-any logo]
+                    <a href="[link]">
+                        <img align="right" src="[logo]"
+                             border="0"/>
+                    </a>
+                    [end] The currently selected mirror is
+                    <b>[preferred]</b>
+                    . If
+                    you encounter a problem with this mirror, please select another mirror. If
+                    all mirrors are failing, there are
+                    <i>backup</i>
+                    mirrors (at the end of the
+                    mirrors list) that should be available.
+                </p>
+
+                <form action="[location]" method="get" id="SelectMirror">
+                    Other mirrors:
+                    <select name="Preferred">[if-any http][for http]
+                        <option value="[http]"
+                                selected="selected">[http]</option>
+                        [end][end][if-any ftp][for ftp]
+                        <option value="[ftp]">[ftp]</option>
+                        [end][end][if-any backup][for backup]
+                        <option value="[backup]">[backup] (backup)</option>
+                        [end][end]
+                    </select>
+
+                    <input type="submit" value="Change"/>
+                </form>
+
+                <p>You may also consult the
+                    <a href="http://www.apache.org/mirrors/">complete
+                        list of mirrors</a>
+                    .
+                </p>
+
+                <p>
+                    <strong>Note:</strong>
+                    when downloading from a mirror please check the
+                    <a
+                            href="http://www.apache.org/dev/release-signing#md5">md5sum</a>
+                    and verify
+                    the
+                    <a href="http://www.apache.org/dev/release-signing#openpgp">OpenPGP</a>
+                    compatible signature from the main Apache site. These can be downloaded by
+                    following the links above. This
+                    <a
+                            href="http://www.apache.org/dist/ws/commons/axiom/KEYS">KEYS</a>
+                    file contains the
+                    public keys used for signing release. It is recommended that (when possible)
+                    a
+                    <a href="http://www.apache.org/dev/release-signing#web-of-trust">web of
+                        trust</a>
+                    is used to confirm the identity of these keys.
+                </p>
+            </div>
+
+        </section>
+    </body>
+</document>
diff --git a/axiom/src/site/xdoc/images/OM002.jpg b/axiom/src/site/xdoc/images/OM002.jpg
new file mode 100644
index 0000000..a0a30db
--- /dev/null
+++ b/axiom/src/site/xdoc/images/OM002.jpg
Binary files differ
diff --git a/axiom/src/site/xdoc/images/OM003.jpg b/axiom/src/site/xdoc/images/OM003.jpg
new file mode 100644
index 0000000..3c669a4
--- /dev/null
+++ b/axiom/src/site/xdoc/images/OM003.jpg
Binary files differ
diff --git a/axiom/src/site/xdoc/images/OM004.jpg b/axiom/src/site/xdoc/images/OM004.jpg
new file mode 100644
index 0000000..309bd21
--- /dev/null
+++ b/axiom/src/site/xdoc/images/OM004.jpg
Binary files differ
diff --git a/axiom/src/site/xdoc/images/OM005.gif b/axiom/src/site/xdoc/images/OM005.gif
new file mode 100644
index 0000000..49209e4
--- /dev/null
+++ b/axiom/src/site/xdoc/images/OM005.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/OM006.gif b/axiom/src/site/xdoc/images/OM006.gif
new file mode 100644
index 0000000..2e17ed0
--- /dev/null
+++ b/axiom/src/site/xdoc/images/OM006.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/OM007.gif b/axiom/src/site/xdoc/images/OM007.gif
new file mode 100644
index 0000000..010fe53
--- /dev/null
+++ b/axiom/src/site/xdoc/images/OM007.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/OM008.gif b/axiom/src/site/xdoc/images/OM008.gif
new file mode 100644
index 0000000..345a4a6
--- /dev/null
+++ b/axiom/src/site/xdoc/images/OM008.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/OM1.png b/axiom/src/site/xdoc/images/OM1.png
new file mode 100644
index 0000000..c09b9c9
--- /dev/null
+++ b/axiom/src/site/xdoc/images/OM1.png
Binary files differ
diff --git a/axiom/src/site/xdoc/images/add.gif b/axiom/src/site/xdoc/images/add.gif
new file mode 100644
index 0000000..ac0bdcc
--- /dev/null
+++ b/axiom/src/site/xdoc/images/add.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/archi006.jpg b/axiom/src/site/xdoc/images/archi006.jpg
new file mode 100644
index 0000000..50a2122
--- /dev/null
+++ b/axiom/src/site/xdoc/images/archi006.jpg
Binary files differ
diff --git a/axiom/src/site/xdoc/images/archi007.jpg b/axiom/src/site/xdoc/images/archi007.jpg
new file mode 100644
index 0000000..52db437
--- /dev/null
+++ b/axiom/src/site/xdoc/images/archi007.jpg
Binary files differ
diff --git a/axiom/src/site/xdoc/images/collapsed.gif b/axiom/src/site/xdoc/images/collapsed.gif
new file mode 100644
index 0000000..6e71084
--- /dev/null
+++ b/axiom/src/site/xdoc/images/collapsed.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/expanded.gif b/axiom/src/site/xdoc/images/expanded.gif
new file mode 100644
index 0000000..0fef3d8
--- /dev/null
+++ b/axiom/src/site/xdoc/images/expanded.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/external-classic.png b/axiom/src/site/xdoc/images/external-classic.png
new file mode 100644
index 0000000..09a5425
--- /dev/null
+++ b/axiom/src/site/xdoc/images/external-classic.png
Binary files differ
diff --git a/axiom/src/site/xdoc/images/external.png b/axiom/src/site/xdoc/images/external.png
new file mode 100644
index 0000000..3f999fc
--- /dev/null
+++ b/axiom/src/site/xdoc/images/external.png
Binary files differ
diff --git a/axiom/src/site/xdoc/images/file.gif b/axiom/src/site/xdoc/images/file.gif
new file mode 100644
index 0000000..72c13cc
--- /dev/null
+++ b/axiom/src/site/xdoc/images/file.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/fix.gif b/axiom/src/site/xdoc/images/fix.gif
new file mode 100644
index 0000000..2585f13
--- /dev/null
+++ b/axiom/src/site/xdoc/images/fix.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/folder-closed.gif b/axiom/src/site/xdoc/images/folder-closed.gif
new file mode 100644
index 0000000..2baed62
--- /dev/null
+++ b/axiom/src/site/xdoc/images/folder-closed.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/folder-open.gif b/axiom/src/site/xdoc/images/folder-open.gif
new file mode 100644
index 0000000..3955d19
--- /dev/null
+++ b/axiom/src/site/xdoc/images/folder-open.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/help_logo.gif b/axiom/src/site/xdoc/images/help_logo.gif
new file mode 100644
index 0000000..cc25c03
--- /dev/null
+++ b/axiom/src/site/xdoc/images/help_logo.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_alert.gif b/axiom/src/site/xdoc/images/icon_alert.gif
new file mode 100644
index 0000000..4968bca
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_alert.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_alertsml.gif b/axiom/src/site/xdoc/images/icon_alertsml.gif
new file mode 100644
index 0000000..641308d
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_alertsml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_arrowfolder1_sml.gif b/axiom/src/site/xdoc/images/icon_arrowfolder1_sml.gif
new file mode 100644
index 0000000..89408af
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_arrowfolder1_sml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_arrowfolder2_sml.gif b/axiom/src/site/xdoc/images/icon_arrowfolder2_sml.gif
new file mode 100644
index 0000000..d9e7e1c
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_arrowfolder2_sml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_arrowfolderclosed1_sml.gif b/axiom/src/site/xdoc/images/icon_arrowfolderclosed1_sml.gif
new file mode 100644
index 0000000..c48e8b6
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_arrowfolderclosed1_sml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_arrowfolderopen2_sml.gif b/axiom/src/site/xdoc/images/icon_arrowfolderopen2_sml.gif
new file mode 100644
index 0000000..477e327
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_arrowfolderopen2_sml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_arrowmembers1_sml.gif b/axiom/src/site/xdoc/images/icon_arrowmembers1_sml.gif
new file mode 100644
index 0000000..b4dea83
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_arrowmembers1_sml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_arrowmembers2_sml.gif b/axiom/src/site/xdoc/images/icon_arrowmembers2_sml.gif
new file mode 100644
index 0000000..0e74357
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_arrowmembers2_sml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_arrowusergroups1_sml.gif b/axiom/src/site/xdoc/images/icon_arrowusergroups1_sml.gif
new file mode 100644
index 0000000..5177959
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_arrowusergroups1_sml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_arrowusergroups2_sml.gif b/axiom/src/site/xdoc/images/icon_arrowusergroups2_sml.gif
new file mode 100644
index 0000000..574bb45
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_arrowusergroups2_sml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_arrowwaste1_sml.gif b/axiom/src/site/xdoc/images/icon_arrowwaste1_sml.gif
new file mode 100644
index 0000000..25d75f7
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_arrowwaste1_sml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_arrowwaste2_sml.gif b/axiom/src/site/xdoc/images/icon_arrowwaste2_sml.gif
new file mode 100644
index 0000000..54dbf42
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_arrowwaste2_sml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_confirmsml.gif b/axiom/src/site/xdoc/images/icon_confirmsml.gif
new file mode 100644
index 0000000..ca3c810
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_confirmsml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_doc_lrg.gif b/axiom/src/site/xdoc/images/icon_doc_lrg.gif
new file mode 100644
index 0000000..b458267
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_doc_lrg.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_doc_sml.gif b/axiom/src/site/xdoc/images/icon_doc_sml.gif
new file mode 100644
index 0000000..239bfaa
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_doc_sml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_error_lrg.gif b/axiom/src/site/xdoc/images/icon_error_lrg.gif
new file mode 100644
index 0000000..fccffd1
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_error_lrg.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_error_sml.gif b/axiom/src/site/xdoc/images/icon_error_sml.gif
new file mode 100644
index 0000000..61132ef
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_error_sml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_folder_lrg.gif b/axiom/src/site/xdoc/images/icon_folder_lrg.gif
new file mode 100644
index 0000000..3683e75
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_folder_lrg.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_folder_sml.gif b/axiom/src/site/xdoc/images/icon_folder_sml.gif
new file mode 100644
index 0000000..8e26f89
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_folder_sml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_help_lrg.gif b/axiom/src/site/xdoc/images/icon_help_lrg.gif
new file mode 100644
index 0000000..c216295
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_help_lrg.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_help_sml.gif b/axiom/src/site/xdoc/images/icon_help_sml.gif
new file mode 100644
index 0000000..43bfd56
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_help_sml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_info_lrg.gif b/axiom/src/site/xdoc/images/icon_info_lrg.gif
new file mode 100644
index 0000000..b390fd4
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_info_lrg.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_info_sml.gif b/axiom/src/site/xdoc/images/icon_info_sml.gif
new file mode 100644
index 0000000..c6cb9ad
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_info_sml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_infosml.gif b/axiom/src/site/xdoc/images/icon_infosml.gif
new file mode 100644
index 0000000..1aa2d30
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_infosml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_members_lrg.gif b/axiom/src/site/xdoc/images/icon_members_lrg.gif
new file mode 100644
index 0000000..7ba2df6
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_members_lrg.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_members_sml.gif b/axiom/src/site/xdoc/images/icon_members_sml.gif
new file mode 100644
index 0000000..997e699
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_members_sml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_sortdown.gif b/axiom/src/site/xdoc/images/icon_sortdown.gif
new file mode 100644
index 0000000..9561bbe
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_sortdown.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_sortleft.gif b/axiom/src/site/xdoc/images/icon_sortleft.gif
new file mode 100644
index 0000000..4fd21e8
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_sortleft.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_sortright.gif b/axiom/src/site/xdoc/images/icon_sortright.gif
new file mode 100644
index 0000000..ea8076e
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_sortright.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_sortup.gif b/axiom/src/site/xdoc/images/icon_sortup.gif
new file mode 100644
index 0000000..61942d6
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_sortup.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_success_lrg.gif b/axiom/src/site/xdoc/images/icon_success_lrg.gif
new file mode 100644
index 0000000..9af317d
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_success_lrg.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_success_sml.gif b/axiom/src/site/xdoc/images/icon_success_sml.gif
new file mode 100644
index 0000000..52e85a4
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_success_sml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_usergroups_lrg.gif b/axiom/src/site/xdoc/images/icon_usergroups_lrg.gif
new file mode 100644
index 0000000..3a4e356
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_usergroups_lrg.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_usergroups_sml.gif b/axiom/src/site/xdoc/images/icon_usergroups_sml.gif
new file mode 100644
index 0000000..9236101
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_usergroups_sml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_warning_lrg.gif b/axiom/src/site/xdoc/images/icon_warning_lrg.gif
new file mode 100644
index 0000000..83359d8
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_warning_lrg.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_warning_sml.gif b/axiom/src/site/xdoc/images/icon_warning_sml.gif
new file mode 100644
index 0000000..873bbb5
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_warning_sml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_waste_lrg.gif b/axiom/src/site/xdoc/images/icon_waste_lrg.gif
new file mode 100644
index 0000000..e5434aa
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_waste_lrg.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/icon_waste_sml.gif b/axiom/src/site/xdoc/images/icon_waste_sml.gif
new file mode 100644
index 0000000..6dd046d
--- /dev/null
+++ b/axiom/src/site/xdoc/images/icon_waste_sml.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/newwindow-classic.png b/axiom/src/site/xdoc/images/newwindow-classic.png
new file mode 100644
index 0000000..5987117
--- /dev/null
+++ b/axiom/src/site/xdoc/images/newwindow-classic.png
Binary files differ
diff --git a/axiom/src/site/xdoc/images/newwindow.png b/axiom/src/site/xdoc/images/newwindow.png
new file mode 100644
index 0000000..6287f72
--- /dev/null
+++ b/axiom/src/site/xdoc/images/newwindow.png
Binary files differ
diff --git a/axiom/src/site/xdoc/images/none.png b/axiom/src/site/xdoc/images/none.png
new file mode 100644
index 0000000..fef6d18
--- /dev/null
+++ b/axiom/src/site/xdoc/images/none.png
Binary files differ
diff --git a/axiom/src/site/xdoc/images/nw_maj.gif b/axiom/src/site/xdoc/images/nw_maj.gif
new file mode 100644
index 0000000..452296b
--- /dev/null
+++ b/axiom/src/site/xdoc/images/nw_maj.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/nw_maj_hi.gif b/axiom/src/site/xdoc/images/nw_maj_hi.gif
new file mode 100644
index 0000000..54c3933
--- /dev/null
+++ b/axiom/src/site/xdoc/images/nw_maj_hi.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/nw_maj_rond.gif b/axiom/src/site/xdoc/images/nw_maj_rond.gif
new file mode 100644
index 0000000..add42a4
--- /dev/null
+++ b/axiom/src/site/xdoc/images/nw_maj_rond.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/nw_med.gif b/axiom/src/site/xdoc/images/nw_med.gif
new file mode 100644
index 0000000..d2b6d91
--- /dev/null
+++ b/axiom/src/site/xdoc/images/nw_med.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/nw_med_hi.gif b/axiom/src/site/xdoc/images/nw_med_hi.gif
new file mode 100644
index 0000000..0c2db4c
--- /dev/null
+++ b/axiom/src/site/xdoc/images/nw_med_hi.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/nw_med_rond.gif b/axiom/src/site/xdoc/images/nw_med_rond.gif
new file mode 100644
index 0000000..8aaa564
--- /dev/null
+++ b/axiom/src/site/xdoc/images/nw_med_rond.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/nw_min.gif b/axiom/src/site/xdoc/images/nw_min.gif
new file mode 100644
index 0000000..bf4bc75
--- /dev/null
+++ b/axiom/src/site/xdoc/images/nw_min.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/nw_min_036.gif b/axiom/src/site/xdoc/images/nw_min_036.gif
new file mode 100644
index 0000000..eb344a8
--- /dev/null
+++ b/axiom/src/site/xdoc/images/nw_min_036.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/nw_min_hi.gif b/axiom/src/site/xdoc/images/nw_min_hi.gif
new file mode 100644
index 0000000..a8a30ab
--- /dev/null
+++ b/axiom/src/site/xdoc/images/nw_min_hi.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/om2.png b/axiom/src/site/xdoc/images/om2.png
new file mode 100644
index 0000000..fa52092
--- /dev/null
+++ b/axiom/src/site/xdoc/images/om2.png
Binary files differ
diff --git a/axiom/src/site/xdoc/images/om3.png b/axiom/src/site/xdoc/images/om3.png
new file mode 100644
index 0000000..939de37
--- /dev/null
+++ b/axiom/src/site/xdoc/images/om3.png
Binary files differ
diff --git a/axiom/src/site/xdoc/images/pdf.gif b/axiom/src/site/xdoc/images/pdf.gif
new file mode 100644
index 0000000..7bce338
--- /dev/null
+++ b/axiom/src/site/xdoc/images/pdf.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/poweredby_036.gif b/axiom/src/site/xdoc/images/poweredby_036.gif
new file mode 100644
index 0000000..49d0345
--- /dev/null
+++ b/axiom/src/site/xdoc/images/poweredby_036.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/product_logo.gif b/axiom/src/site/xdoc/images/product_logo.gif
new file mode 100644
index 0000000..327b838
--- /dev/null
+++ b/axiom/src/site/xdoc/images/product_logo.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/remove.gif b/axiom/src/site/xdoc/images/remove.gif
new file mode 100644
index 0000000..ad4b238
--- /dev/null
+++ b/axiom/src/site/xdoc/images/remove.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/se_maj_rond.gif b/axiom/src/site/xdoc/images/se_maj_rond.gif
new file mode 100644
index 0000000..da2510e
--- /dev/null
+++ b/axiom/src/site/xdoc/images/se_maj_rond.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/strich.gif b/axiom/src/site/xdoc/images/strich.gif
new file mode 100644
index 0000000..a33e79d
--- /dev/null
+++ b/axiom/src/site/xdoc/images/strich.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/sw_maj_rond.gif b/axiom/src/site/xdoc/images/sw_maj_rond.gif
new file mode 100644
index 0000000..110bdf4
--- /dev/null
+++ b/axiom/src/site/xdoc/images/sw_maj_rond.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/sw_med_rond.gif b/axiom/src/site/xdoc/images/sw_med_rond.gif
new file mode 100644
index 0000000..6671c3d
--- /dev/null
+++ b/axiom/src/site/xdoc/images/sw_med_rond.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/sw_min.gif b/axiom/src/site/xdoc/images/sw_min.gif
new file mode 100644
index 0000000..d96369d
--- /dev/null
+++ b/axiom/src/site/xdoc/images/sw_min.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/images/update.gif b/axiom/src/site/xdoc/images/update.gif
new file mode 100644
index 0000000..71ca225
--- /dev/null
+++ b/axiom/src/site/xdoc/images/update.gif
Binary files differ
diff --git a/axiom/src/site/xdoc/navigation.xml b/axiom/src/site/xdoc/navigation.xml
new file mode 100644
index 0000000..f9d1880
--- /dev/null
+++ b/axiom/src/site/xdoc/navigation.xml
@@ -0,0 +1,26 @@
+<project name="AXIOM">
+	<title>Web Services Commons : AXIOM Implemenation</title>
+	<body>
+		<menu name="AXIOM">
+			<item name="Home" href="index.html"/>
+			<item nane="Downloads">
+				<item name="Releases" href="download.cgi"/>
+				<item name="Source Code" href="http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/axiom/"/>
+			</item>
+			<item name="Documentation">
+				<item name="OM Tutorial" href="OMTutorial.html"/>
+				<item name="Javadocs" href="/apidocs/index.html"/>
+                <item name="Checkout Source" href="svn.html"/>
+            </item>
+			<item name="Project Information">
+				<item name="Mailing Lists" href="/mail-lists.html"/>
+				<item name="Project Team" href="/team-list.html"/>
+				<item name="Issue Tracking" href="http://issues.apache.org/jira/browse/WSCOMMONS"/>
+				<item name="Dependencies" href="/dependencies.html"/>
+
+            </item>
+            <item name="License" href="http://www.apache.org/licenses/LICENSE-2.0.html"/>
+        </menu>
+	</body>
+	
+</project>